r347926 - [-gmodules] Honor -fdebug-prefix-map in the debug info inside PCMs.
Adrian Prantl via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 29 14:33:09 PST 2018
Author: adrian
Date: Thu Nov 29 14:33:09 2018
New Revision: 347926
URL: http://llvm.org/viewvc/llvm-project?rev=347926&view=rev
Log:
[-gmodules] Honor -fdebug-prefix-map in the debug info inside PCMs.
This patch passes -fdebug-prefix-map (a feature for renaming source
paths in the debug info) through to the per-module codegen options and
adds the debug prefix map to the module hash.
<rdar://problem/46045865>
Differential Revision: https://reviews.llvm.org/D55037
Added:
cfe/trunk/test/Modules/module-debuginfo-prefix.m
Modified:
cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=347926&r1=347925&r2=347926&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)
+++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Thu Nov 29 14:33:09 2018
@@ -156,6 +156,8 @@ public:
LangOpts.CurrentModule.empty() ? MainFileName : LangOpts.CurrentModule;
CodeGenOpts.setDebugInfo(codegenoptions::FullDebugInfo);
CodeGenOpts.setDebuggerTuning(CI.getCodeGenOpts().getDebuggerTuning());
+ CodeGenOpts.DebugPrefixMap =
+ CI.getInvocation().getCodeGenOpts().DebugPrefixMap;
}
~PCHContainerGenerator() override = default;
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=347926&r1=347925&r2=347926&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Thu Nov 29 14:33:09 2018
@@ -3264,6 +3264,12 @@ std::string CompilerInvocation::getModul
code = ext->hashExtension(code);
}
+ // When compiling with -gmodules, also hash -fdebug-prefix-map as it
+ // affects the debug info in the PCM.
+ if (getCodeGenOpts().DebugTypeExtRefs)
+ for (const auto &KeyValue : getCodeGenOpts().DebugPrefixMap)
+ code = hash_combine(code, KeyValue.first, KeyValue.second);
+
// Extend the signature with the enabled sanitizers, if at least one is
// enabled. Sanitizers which cannot affect AST generation aren't hashed.
SanitizerSet SanHash = LangOpts->Sanitize;
Added: cfe/trunk/test/Modules/module-debuginfo-prefix.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/module-debuginfo-prefix.m?rev=347926&view=auto
==============================================================================
--- cfe/trunk/test/Modules/module-debuginfo-prefix.m (added)
+++ cfe/trunk/test/Modules/module-debuginfo-prefix.m Thu Nov 29 14:33:09 2018
@@ -0,0 +1,23 @@
+// REQUIRES: asserts
+
+// Modules:
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -x objective-c -fmodules -fmodule-format=obj \
+// RUN: -fdebug-prefix-map=%S/Inputs=/OVERRIDE \
+// RUN: -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s \
+// RUN: -I %S/Inputs -I %t -emit-llvm -o %t.ll \
+// RUN: -mllvm -debug-only=pchcontainer &>%t-mod.ll
+// RUN: cat %t-mod.ll | FileCheck %s
+
+// PCH:
+// RUN: %clang_cc1 -x objective-c -emit-pch -fmodule-format=obj -I %S/Inputs \
+// RUN: -fdebug-prefix-map=%S/Inputs=/OVERRIDE \
+// RUN: -o %t.pch %S/Inputs/DebugObjC.h \
+// RUN: -mllvm -debug-only=pchcontainer &>%t-pch.ll
+// RUN: cat %t-pch.ll | FileCheck %s
+
+#ifdef MODULES
+ at import DebugObjC;
+#endif
+
+// CHECK: !DIFile({{.*}}"/OVERRIDE/DebugObjC.h"
More information about the cfe-commits
mailing list