https://github.com/mpark updated https://github.com/llvm/llvm-project/pull/180023
>From 3d27d8d0a7a9fd82185a04c6c6edecb4b93f7986 Mon Sep 17 00:00:00 2001 From: Michael Park <[email protected]> Date: Thu, 5 Feb 2026 12:09:20 -0800 Subject: [PATCH 1/2] [C++20][Modules] Fix relocatable PCH feature. --- clang/lib/Serialization/ASTWriter.cpp | 6 +++--- clang/test/PCH/reloc.c | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 3e10bbfedfe65..cd8c552694945 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -1526,10 +1526,10 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, StringRef isysroot) { // Write out all other paths relative to the base directory if possible. BaseDirectory.assign(BaseDir->begin(), BaseDir->end()); - } else if (!isysroot.empty()) { - // Write out paths relative to the sysroot if possible. - BaseDirectory = std::string(isysroot); } + } else if (!isysroot.empty()) { + // Write out paths relative to the sysroot if possible. + BaseDirectory = std::string(isysroot); } // Module map file diff --git a/clang/test/PCH/reloc.c b/clang/test/PCH/reloc.c index 435fde2e19234..019e3c495218b 100644 --- a/clang/test/PCH/reloc.c +++ b/clang/test/PCH/reloc.c @@ -3,6 +3,11 @@ // RUN: %clang -target x86_64-apple-darwin11 -fsyntax-only \ // RUN: -include-pch %t -isysroot %S/Inputs/libroot %s -Xclang -verify // RUN: not %clang -target x86_64-apple-darwin11 -include-pch %t %s +// RUN: llvm-bcanalyzer --dump --disable-histogram %t \ +// RUN: | FileCheck %s +// CHECK: <ORIGINAL_FILE {{.*}}/> blob data = 'usr{{[/\\]}}include{{[/\\]}}reloc.h' +// CHECK: <INPUT_FILE {{.*}}/> blob data = 'usr{{[/\\]}}include{{[/\\]}}reloc.h' +// CHECK: <INPUT_FILE {{.*}}/> blob data = 'usr{{[/\\]}}include{{[/\\]}}reloc2.h' // REQUIRES: x86-registered-target #include <reloc.h> >From 8de88599743147f35925fc346b2ba829340ee507 Mon Sep 17 00:00:00 2001 From: Michael Park <[email protected]> Date: Thu, 5 Feb 2026 20:52:52 -0800 Subject: [PATCH 2/2] Try cleaning the path to fix Windows breakage. --- clang/lib/Serialization/ASTWriter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index cd8c552694945..b55440b4a4f39 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -1529,7 +1529,9 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, StringRef isysroot) { } } else if (!isysroot.empty()) { // Write out paths relative to the sysroot if possible. - BaseDirectory = std::string(isysroot); + SmallString<128> CleanedSysroot(isysroot); + cleanPathForOutput(PP.getFileManager(), CleanedSysroot); + BaseDirectory.assign(CleanedSysroot.begin(), CleanedSysroot.end()); } // Module map file _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
