================
Comment at: lib/Format/UnwrappedLineParser.h:233-237
@@ +232,7 @@
+  // #if/#else/#endif directives.
+  enum PPBranchKind {
+    PP_If,  // Any #if, #ifdef, #ifndef, #elif, except for #if 0
+    PP_If0, // #if 0
+    PP_Else // #else
+  };
+
----------------
I'd go with two states (PP_Conditional and PP_Unreachable or something).

================
Comment at: lib/Format/UnwrappedLineParser.h:243
@@ +242,3 @@
+  // Holds the number of PP_If0 on PPStack.
+  int InsideIf0;
+
----------------
I'd go with a bool Unreachable or IgnoreUnwrappedLines or something similar, 
and keep track of all pp conditionals inside an unreachable branch as normal 
conditionals (they don't change anything).

================
Comment at: lib/Format/UnwrappedLineParser.cpp:368
@@ +367,3 @@
+void UnwrappedLineParser::parsePPElse() {
+  if (!PPStack.empty() && PPStack.back() != PP_Else) {
+    if (PPStack.back() == PP_If0)
----------------
I think we want to pop the stack in this case. If there's an error, I'd rather 
we stop ignoring code too early.


http://llvm-reviews.chandlerc.com/D855
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to