[clang] c025235 - Revert "Allow remapping Clang module include paths"
Adrian Prantl via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 24 17:57:45 PDT 2020
Author: Adrian Prantl
Date: 2020-03-24T17:57:34-07:00
New Revision: c025235e962e2cec58e47a572eac3f88a55f3a1e
URL: https://github.com/llvm/llvm-project/commit/c025235e962e2cec58e47a572eac3f88a55f3a1e
DIFF: https://github.com/llvm/llvm-project/commit/c025235e962e2cec58e47a572eac3f88a55f3a1e.diff
LOG: Revert "Allow remapping Clang module include paths"
to investigate why this commit broke a test in the LLDB testsuite.
This reverts commit dca920a904c27f4c86e909ef2e4e343d48168cca.
Added:
Modified:
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/Modules/debug-info-moduleimport.m
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 49c57e9860a6..da6cb458982b 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -2483,17 +2483,6 @@ llvm::DIModule *CGDebugInfo::getOrCreateModuleRef(ASTSourceDescriptor Mod,
assert(StringRef(M->Name).startswith(CGM.getLangOpts().ModuleName) &&
"clang module without ASTFile must be specified by -fmodule-name");
- // Return a StringRef to the remapped Path.
- auto RemapPath = [this](StringRef Path) -> std::string {
- std::string Remapped = remapDIPath(Path);
- StringRef Relative(Remapped);
- StringRef CompDir = TheCU->getDirectory();
- if (Relative.consume_front(CompDir))
- Relative.consume_front(llvm::sys::path::get_separator());
-
- return Relative.str();
- };
-
if (CreateSkeletonCU && IsRootModule && !Mod.getASTFile().empty()) {
// PCH files don't have a signature field in the control block,
// but LLVM detects skeleton CUs by looking for a non-zero DWO id.
@@ -2507,12 +2496,16 @@ llvm::DIModule *CGDebugInfo::getOrCreateModuleRef(ASTSourceDescriptor Mod,
if (!llvm::sys::path::is_absolute(Mod.getASTFile()))
PCM = Mod.getPath();
llvm::sys::path::append(PCM, Mod.getASTFile());
- DIB.createCompileUnit(
- TheCU->getSourceLanguage(),
- // TODO: Support "Source" from external AST providers?
- DIB.createFile(Mod.getModuleName(), TheCU->getDirectory()),
- TheCU->getProducer(), false, StringRef(), 0, RemapPath(PCM),
- llvm::DICompileUnit::FullDebug, Signature);
+ std::string RemappedPCM = remapDIPath(PCM);
+ StringRef RelativePCM(RemappedPCM);
+ StringRef CompDir = TheCU->getDirectory();
+ if (RelativePCM.consume_front(CompDir))
+ RelativePCM.consume_front(llvm::sys::path::get_separator());
+ DIB.createCompileUnit(TheCU->getSourceLanguage(),
+ // TODO: Support "Source" from external AST providers?
+ DIB.createFile(Mod.getModuleName(), CompDir),
+ TheCU->getProducer(), false, StringRef(), 0, RelativePCM,
+ llvm::DICompileUnit::FullDebug, Signature);
DIB.finalize();
}
@@ -2520,10 +2513,9 @@ llvm::DIModule *CGDebugInfo::getOrCreateModuleRef(ASTSourceDescriptor Mod,
IsRootModule ? nullptr
: getOrCreateModuleRef(ASTSourceDescriptor(*M->Parent),
CreateSkeletonCU);
- std::string IncludePath = Mod.getPath().str();
llvm::DIModule *DIMod =
DBuilder.createModule(Parent, Mod.getModuleName(), ConfigMacros,
- RemapPath(IncludePath));
+ Mod.getPath());
ModuleCache[M].reset(DIMod);
return DIMod;
}
diff --git a/clang/test/Modules/debug-info-moduleimport.m b/clang/test/Modules/debug-info-moduleimport.m
index 5787ffe22751..9dee9964b538 100644
--- a/clang/test/Modules/debug-info-moduleimport.m
+++ b/clang/test/Modules/debug-info-moduleimport.m
@@ -34,11 +34,9 @@
// RUN: %clang_cc1 -debug-info-kind=limited -fmodules -fimplicit-module-maps \
// RUN: -fmodules-cache-path=%t -fdebug-prefix-map=%t=/MODULE-CACHE \
-// RUN: -fdebug-prefix-map=%S=/SRCDIR \
// RUN: -fmodule-format=obj -dwarf-ext-refs \
// RUN: %s -I %S/Inputs -isysroot /tmp/.. -I %t -emit-llvm -o - \
// RUN: | FileCheck %s --check-prefix=SKEL-CHECK
-// SKEL-CHECK: includePath: "/SRCDIR/Inputs"
// SKEL-CHECK: distinct !DICompileUnit({{.*}}file: ![[CUFILE:[0-9]+]]
// SKEL-CHECK: ![[CUFILE]] = !DIFile({{.*}}directory: "[[COMP_DIR:.*]]"
// SKEL-CHECK: distinct !DICompileUnit({{.*}}file: ![[DWOFILE:[0-9]+]]{{.*}}splitDebugFilename: "/MODULE-CACHE{{.*}}dwoId
More information about the cfe-commits
mailing list