[clang] eb200e5 - Emit the C++ dialect in -gmodules .pcm files.

Adrian Prantl via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 10 16:14:06 PST 2022


Author: Adrian Prantl
Date: 2022-01-10T16:13:40-08:00
New Revision: eb200e584ece7ca8c1f8cac59ca5418956ccf1e4

URL: https://github.com/llvm/llvm-project/commit/eb200e584ece7ca8c1f8cac59ca5418956ccf1e4
DIFF: https://github.com/llvm/llvm-project/commit/eb200e584ece7ca8c1f8cac59ca5418956ccf1e4.diff

LOG: Emit the C++ dialect in -gmodules .pcm files.

Because of commit: https://reviews.llvm.org/D104291 the -gmodules .pcm
files do not have the same DW_AT_language dialect as the .o file. This
was a simple matter of passing the DebugStrictDwarf flag to the
PCHContainerGenerator object's CodeGenOpts from the CompilerInstance
passed in to it.

Before this change if you ran dwarfdump on the gmodule cache folder
you would get DW_AT_language (DW_LANG_C_plus_plus) even when using
-std=c++14 with clang

Patch by Shubham Rastogi!

Differential Revision: https://reviews.llvm.org/D116790

Added: 
    

Modified: 
    clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
    clang/test/Modules/ModuleDebugInfo.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
index f7b83c45022d6..9fe7e5d1f5c31 100644
--- a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
+++ b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
@@ -156,6 +156,7 @@ class PCHContainerGenerator : public ASTConsumer {
     CodeGenOpts.setDebuggerTuning(CI.getCodeGenOpts().getDebuggerTuning());
     CodeGenOpts.DebugPrefixMap =
         CI.getInvocation().getCodeGenOpts().DebugPrefixMap;
+    CodeGenOpts.DebugStrictDwarf = CI.getCodeGenOpts().DebugStrictDwarf;
   }
 
   ~PCHContainerGenerator() override = default;

diff  --git a/clang/test/Modules/ModuleDebugInfo.cpp b/clang/test/Modules/ModuleDebugInfo.cpp
index 433002c6cdbe3..558e2e223a880 100644
--- a/clang/test/Modules/ModuleDebugInfo.cpp
+++ b/clang/test/Modules/ModuleDebugInfo.cpp
@@ -24,7 +24,7 @@
 // CHECK-MOD: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus,
 
 // CHECK: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus,
-// CHECK-CXX: distinct !DICompileUnit(language: DW_LANG_C_plus_plus,
+// CHECK-CXX: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_11,
 // CHECK-SAME:                    isOptimized: false,
 // CHECK-NOT:                     splitDebugFilename:
 // CHECK-SAME:                    dwoId:


        


More information about the cfe-commits mailing list