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

Ben Hamilton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 28 13:56:41 PST 2018


benhamilton added inline comments.


================
Comment at: lib/Format/TokenAnnotator.cpp:346
+  bool parseCpp11AttributeSpecifier(FormatToken *Tok) {
+    if (!Style.isCpp()) return false;
+    if (!Tok || !Tok->startsSequence(tok::l_square, tok::l_square))
----------------
aaron.ballman wrote:
> C can use this syntax as well with `-fdouble-square-bracket-attributes`, which would be good to also support.
Ah, good to know. As far as I know, `clang-format` doesn't actually distinguish between C and C++ (or Objective-C and Objective-C++).

In this case, `isCpp()` returns true for all of C, C++, Objective-C, and Objective-C++:

https://github.com/llvm-mirror/clang/blob/master/include/clang/Format/Format.h#L1229


Repository:
  rC Clang

https://reviews.llvm.org/D43902





More information about the cfe-commits mailing list