[PATCH] D55037: [-gmodules] Honor -fdebug-prefix-map in the debug info inside PCMs.

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 29 14:36:15 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC347926: [-gmodules] Honor -fdebug-prefix-map in the debug info inside PCMs. (authored by adrian, committed by ).

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55037/new/

https://reviews.llvm.org/D55037

Files:
  lib/CodeGen/ObjectFilePCHContainerOperations.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/Modules/module-debuginfo-prefix.m


Index: test/Modules/module-debuginfo-prefix.m
===================================================================
--- test/Modules/module-debuginfo-prefix.m
+++ test/Modules/module-debuginfo-prefix.m
@@ -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"
Index: lib/Frontend/CompilerInvocation.cpp
===================================================================
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -3264,6 +3264,12 @@
     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;
Index: lib/CodeGen/ObjectFilePCHContainerOperations.cpp
===================================================================
--- lib/CodeGen/ObjectFilePCHContainerOperations.cpp
+++ lib/CodeGen/ObjectFilePCHContainerOperations.cpp
@@ -156,6 +156,8 @@
         LangOpts.CurrentModule.empty() ? MainFileName : LangOpts.CurrentModule;
     CodeGenOpts.setDebugInfo(codegenoptions::FullDebugInfo);
     CodeGenOpts.setDebuggerTuning(CI.getCodeGenOpts().getDebuggerTuning());
+    CodeGenOpts.DebugPrefixMap =
+        CI.getInvocation().getCodeGenOpts().DebugPrefixMap;
   }
 
   ~PCHContainerGenerator() override = default;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55037.175969.patch
Type: text/x-patch
Size: 2354 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181129/40c6683b/attachment.bin>


More information about the cfe-commits mailing list