[PATCH] D41005: Reuse preamble even if an unsaved file does not exist

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 3 07:34:05 PST 2018


ilya-biryukov added inline comments.


================
Comment at: include/clang/Frontend/ASTUnit.h:581
 
+  unsigned getPreambleCounter() const { return PreambleCounter; }
+
----------------
NIT: `getPreambleCounterForTests()`? This is clearly an internal detail, would try giving it a name that discourages using it outside the testing code.


================
Comment at: lib/Frontend/ASTUnit.cpp:1369
         // Try again next time.
-        PreambleRebuildCounter = 1;
+        ++PreambleCounter;
+        PreambleRebuildCountdown = 1;
----------------
Why not increase this counter unconditionally for **every** error? (And a non-error case too, I guess)


================
Comment at: lib/Frontend/PrecompiledPreamble.cpp:471
+    } else {
+      auto FilePath = PathNormalized(RB.first.begin(), RB.first.end());
+      OverridenFileBuffers[FilePath] = PreambleHash;
----------------
Could we avoid adding path normalization in this patch? Would it break anything?
This is clearly an important detail that preamble **might** get wrong, but I'd rather add it in a separate patch to avoid putting multiple things in the same patch.


Repository:
  rC Clang

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

https://reviews.llvm.org/D41005





More information about the cfe-commits mailing list