[PATCH] D43902: [clang-format] Don't detect C++11 attribute specifiers as ObjC

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 5 10:43:54 PST 2018

krasimir added inline comments.

Comment at: lib/Format/TokenAnnotator.cpp:323
+  const FormatToken *parseCpp11Attribute(const FormatToken &Tok,
+                                         bool NamespaceAllowed) {
Please inline this into the other function: it's used only once and its name and arguments aren't clear outside of that context.

Comment at: unittests/Format/FormatTest.cpp:12083
+TEST_F(FormatTest, GuessLanguageWithCpp11AttributeSpecifiers) {
+  EXPECT_EQ(FormatStyle::LK_Cpp, guessLanguage("foo.h", "[[noreturn]];"));
djasper wrote:
> You are not adding any test (AFAICT) that tests that you have correctly set TT_AttributeSpecifier or that you are making any formatting decisions based on it. If you can't test it, remove that part of this patch.
This will also require adding tests about not messing up the formatting inside/around attribute specifiers too much. At least take these examples and copy them to the C++/ObjC formatting unittests.

  rC Clang


More information about the cfe-commits mailing list