[PATCH] D33493: Speed up preamble loading

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 7 09:23:03 PDT 2017


arphaman added inline comments.


================
Comment at: include/clang/Frontend/ASTUnit.h:192
+  /// of that loading
+  std::map<const std::string, SourceLocation> SrcLocCache;
+
----------------
You can use an `llvm::StringMap` instead.


================
Comment at: lib/Frontend/ASTUnit.cpp:1152
+  else
+    SrcLocCache.clear();
 
----------------
Why is `clear` in an `else` here? We always create a new `SourceManager` in this function, so the previously cached locations will be invalid, so shouldn't we always clear the cache before `TranslateStoredDiagnostics`?


https://reviews.llvm.org/D33493





More information about the cfe-commits mailing list