reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced

Declarations

tools/clang/include/clang/Format/Format.h
 2372 FormatStyle::LanguageKind guessLanguage(StringRef FileName, StringRef Code);

References

tools/clang/lib/Format/Format.cpp
 2578   FormatStyle Style = getLLVMStyle(guessLanguage(FileName, Code));
tools/clang/unittests/Format/FormatTest.cpp
14517   EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo.cc", ""));
14518   EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo.m", ""));
14519   EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo.mm", ""));
14520   EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo.h", ""));
14522             guessLanguage("foo.h", "@interface Foo\n@end\n"));
14525       guessLanguage("foo.h", "#define TRY(x, y) @try { x; } @finally { y; }"));
14527             guessLanguage("foo.h", "#define AVAIL(x) @available(x, *))"));
14528   EXPECT_EQ(FormatStyle::LK_ObjC, guessLanguage("foo.h", "@class Foo;"));
14529   EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo", ""));
14531             guessLanguage("foo", "@interface Foo\n@end\n"));
14533             guessLanguage("foo.h", "int DoStuff(CGRect rect);\n"));
14536       guessLanguage("foo.h",
14540       guessLanguage("foo.h", "#define FOO(...) auto bar = [] __VA_ARGS__;"));
14544   EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo.h", "[[noreturn]];"));
14546             guessLanguage("foo.h", "array[[calculator getIndex]];"));
14548             guessLanguage("foo.h", "[[noreturn, deprecated(\"so sorry\")]];"));
14551       guessLanguage("foo.h", "[[noreturn, deprecated(\"gone, sorry\")]];"));
14553             guessLanguage("foo.h", "[[noreturn foo] bar];"));
14555             guessLanguage("foo.h", "[[clang::fallthrough]];"));
14557             guessLanguage("foo.h", "[[clang:fallthrough] foo];"));
14559             guessLanguage("foo.h", "[[gsl::suppress(\"type\")]];"));
14561             guessLanguage("foo.h", "[[using clang: fallthrough]];"));
14563             guessLanguage("foo.h", "[[abusing clang:fallthrough] bar];"));
14565             guessLanguage("foo.h", "[[using gsl: suppress(\"type\")]];"));
14568       guessLanguage("foo.h", "for (auto &&[endpoint, stream] : streams_)"));
14571       guessLanguage("foo.h",
14573   EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo.h", "[[foo::bar, ...]]"));
14577   EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo.h", "FOO(^);"));
14578   EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo.h", "FOO(^, Bar);"));
14580             guessLanguage("foo.h", "int(^)(char, float);"));
14582             guessLanguage("foo.h", "int(^foo)(char, float);"));
14584             guessLanguage("foo.h", "int(^foo[10])(char, float);"));
14586             guessLanguage("foo.h", "int(^foo[kNumEntries])(char, float);"));
14589       guessLanguage("foo.h", "int(^foo[(kNumEntries + 10)])(char, float);"));
14594             guessLanguage("foo.h", "void f() {\n"
14600             guessLanguage("foo.h", "void f() {\n"
14606             guessLanguage("foo.h", "void f() {\n"
14612             guessLanguage("foo.h", "void f() {\n"
14618             guessLanguage("foo.h", "void f() {\n"
14624             guessLanguage("foo.h", "void f() {\n"
14633             guessLanguage("foo.h", "#define FOO ({ std::string s; })"));
14635             guessLanguage("foo.h", "#define FOO ({ NSString *s; })"));
14638       guessLanguage("foo.h", "#define FOO ({ foo(); ({ std::string s; }) })"));
14641       guessLanguage("foo.h", "#define FOO ({ foo(); ({ NSString *s; }) })"));