[clang] [clang] Store the Input PCH Path Using Absolute Paths in a PCH (PR #178781)

Cyndy Ishida via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 30 10:01:35 PST 2026


================
@@ -1752,7 +1752,10 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, StringRef isysroot) {
   Record.push_back(PPOpts.UsePredefines);
   // Detailed record is important since it is used for the module cache hash.
   Record.push_back(PPOpts.DetailedRecord);
-  AddString(PPOpts.ImplicitPCHInclude, Record);
+  if (PPOpts.ImplicitPCHInclude.empty())
+    AddString(PPOpts.ImplicitPCHInclude, Record);
----------------
cyndyishida wrote:

I would be pretty surprised if a `string.empty()` check would make a noticeable difference. Where does your intuition come from? I also don't see how adding a check for empty input is complex in a centralized location. What I do believe is more complex is call sites needing to reason about that and not being sure why. 

https://github.com/llvm/llvm-project/pull/178781


More information about the cfe-commits mailing list