[PATCH] Clang-format: Fix for #pragma option formatting

Daniel Jasper djasper at google.com
Thu Apr 16 01:42:59 PDT 2015


Just a few nitpicks. Sorry for the delay.


================
Comment at: lib/Format/TokenAnnotator.cpp:575
@@ -574,1 +574,3 @@
       }
+    } else if (CurrentToken && CurrentToken->TokenText == "option") {
+      auto PreviousToken = CurrentToken;
----------------
Generally, we should use the new Keywords object here and above. But I can fix that as a follow-up.

================
Comment at: lib/Format/TokenAnnotator.cpp:576
@@ +575,3 @@
+    } else if (CurrentToken && CurrentToken->TokenText == "option") {
+      auto PreviousToken = CurrentToken;
+      next(); // Consume "option".
----------------
Just use CurrentToken->Previous?

================
Comment at: lib/Format/TokenAnnotator.cpp:580
@@ +579,3 @@
+        // Don't add space after binary operator.
+        if (PreviousToken->Type == TT_BinaryOperator) {
+          CurrentToken->Type = TT_ImplicitStringLiteral;
----------------
We don't use braces around single-statement ifs in LLVM/Clang.

http://reviews.llvm.org/D8121

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list