r308397 - Debug Info: Set the MainFileName when generating -gmodules debug info for PCM.

Adrian Prantl via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 18 16:58:34 PDT 2017


Author: adrian
Date: Tue Jul 18 16:58:34 2017
New Revision: 308397

URL: http://llvm.org/viewvc/llvm-project?rev=308397&view=rev
Log:
Debug Info: Set the MainFileName when generating -gmodules debug info for PCM.

Previously it was uninitialized and thus always defaulted to "<stdin>".
This is mostly a cosmetic change that helps making the debug info more readable.

Modified:
    cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
    cfe/trunk/test/Modules/ModuleDebugInfo.m

Modified: cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp?rev=308397&r1=308396&r2=308397&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (original)
+++ cfe/trunk/lib/CodeGen/ObjectFilePCHContainerOperations.cpp Tue Jul 18 16:58:34 2017
@@ -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());
   }

Modified: cfe/trunk/test/Modules/ModuleDebugInfo.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/ModuleDebugInfo.m?rev=308397&r1=308396&r2=308397&view=diff
==============================================================================
--- cfe/trunk/test/Modules/ModuleDebugInfo.m (original)
+++ cfe/trunk/test/Modules/ModuleDebugInfo.m Tue Jul 18 16:58:34 2017
@@ -23,8 +23,10 @@
 @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]+]],




More information about the cfe-commits mailing list