[PATCH] D20959: [clang-format] make header guard identification stricter (with Lexer).

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 6 01:27:52 PDT 2016


djasper added inline comments.

================
Comment at: lib/Format/Format.cpp:1491
@@ -1471,3 +1490,3 @@
 
   std::unique_ptr<Environment> Env =
       Environment::CreateVirtualEnvironment(Code, FileName, /*Ranges=*/{});
----------------
I think you should pull this part out into a separate function, possibly named getOffsetAfterHeaderGuardsAndComments(). This function is growing too much.

================
Comment at: lib/Format/Format.cpp:1500
@@ +1499,3 @@
+  // Get the first token.
+  Lex.LexFromRawLexer(Tok);
+  skipComments(Lex, Tok);
----------------
Can this go wrong? Maybe in an empty file?


http://reviews.llvm.org/D20959





More information about the cfe-commits mailing list