[PATCH] D57223: [Tooling] Handle #pragma once header guard in include insertion.

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 28 13:25:59 PST 2019


ilya-biryukov accepted this revision.
ilya-biryukov added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: lib/Tooling/Inclusions/HeaderIncludes.cpp:77
+// before/after header guards (e.g. #ifndef/#define pair, #pragma once). If no
+// header guard presents in the code, this will returns the offset after
+// skipping all comments from the start of the code.
----------------
typo NITs:
s/header guards presents/header guard is present
s/will returns/will return



================
Comment at: lib/Tooling/Inclusions/HeaderIncludes.cpp:84
+  // found.
+  auto ConsumeHeaderGuardAndComment =
+      [&](std::function<unsigned(const SourceManager &SM, Lexer &Lex,
----------------
This function is getting really complex after this change. The comments help, but still.
I don't have a good recipe to improve it, though, especially without changing the whole file, so happy to keep as is.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57223/new/

https://reviews.llvm.org/D57223





More information about the cfe-commits mailing list