]> granicus.if.org Git - clang/commitdiff
Debug Info: Set the MainFileName when generating -gmodules debug info for PCM.
authorAdrian Prantl <aprantl@apple.com>
Tue, 18 Jul 2017 23:58:34 +0000 (23:58 +0000)
committerAdrian Prantl <aprantl@apple.com>
Tue, 18 Jul 2017 23:58:34 +0000 (23:58 +0000)
Previously it was uninitialized and thus always defaulted to "<stdin>".
This is mostly a cosmetic change that helps making the debug info more readable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308397 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/ObjectFilePCHContainerOperations.cpp
test/Modules/ModuleDebugInfo.m

index 37ecc05aa1eee01d0bf5cea4ef252fb1f22b8839..d0760b9cc2a60a989418676a1d3b195439652809 100644 (file)
@@ -152,6 +152,9 @@ public:
     CodeGenOpts.CodeModel = "default";
     CodeGenOpts.ThreadModel = "single";
     CodeGenOpts.DebugTypeExtRefs = true;
+    // When building a module MainFileName is the name of the modulemap file.
+    CodeGenOpts.MainFileName =
+        LangOpts.CurrentModule.empty() ? MainFileName : LangOpts.CurrentModule;
     CodeGenOpts.setDebugInfo(codegenoptions::FullDebugInfo);
     CodeGenOpts.setDebuggerTuning(CI.getCodeGenOpts().getDebuggerTuning());
   }
index d1a0e8d5e80a889f0f81442d971477be1922d9d4..9289abe080807f39bdc6274fbdad0ba958c606e5 100644 (file)
 @import DebugObjC;
 #endif
 
-// CHECK: distinct !DICompileUnit(language: DW_LANG_ObjC
-// CHECK-SAME:                    isOptimized: false,
+// CHECK: distinct !DICompileUnit(language: DW_LANG_ObjC, file: ![[FILE:[0-9]+]],
+// CHECK-SAME:                    isOptimized: false
+
+// CHECK: ![[FILE]] = !DIFile(filename: "{{DebugObjC|.*DebugObjC.h}}"
 
 // CHECK: !DICompositeType(tag: DW_TAG_enumeration_type,
 // CHECK-SAME:             scope: ![[MODULE:[0-9]+]],