Skip to content

Commit 2b95986

Browse files
Merge pull request llvm#7441 from adrian-prantl/dwarf-pch-container
Propagate the DWARF version from the main compiler invocation to PCHC…
2 parents becbde0 + 2d1d0a3 commit 2b95986

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ class PCHContainerGenerator : public ASTConsumer {
162162
LangOpts.CurrentModule.empty() ? MainFileName : LangOpts.CurrentModule;
163163
CodeGenOpts.setDebugInfo(llvm::codegenoptions::FullDebugInfo);
164164
CodeGenOpts.setDebuggerTuning(CI.getCodeGenOpts().getDebuggerTuning());
165+
CodeGenOpts.DwarfVersion = CI.getCodeGenOpts().DwarfVersion;
165166
CodeGenOpts.DebugPrefixMap =
166167
CI.getInvocation().getCodeGenOpts().DebugPrefixMap;
167168
CodeGenOpts.DebugStrictDwarf = CI.getCodeGenOpts().DebugStrictDwarf;

clang/test/Modules/ModuleDebugInfo.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66

77
// Modules:
88
// RUN: rm -rf %t
9-
// RUN: %clang_cc1 -triple %itanium_abi_triple -x objective-c++ -std=c++11 -debugger-tuning=lldb -debug-info-kind=limited -fmodules -fmodule-format=obj -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s -I %S/Inputs -I %t -emit-llvm -o %t.ll -mllvm -debug-only=pchcontainer &>%t-mod.ll
9+
// RUN: %clang_cc1 -triple %itanium_abi_triple -x objective-c++ -std=c++11 -debugger-tuning=lldb -debug-info-kind=limited -dwarf-version=5 -fmodules -fmodule-format=obj -fimplicit-module-maps -DMODULES -fmodules-cache-path=%t %s -I %S/Inputs -I %t -emit-llvm -o %t.ll -mllvm -debug-only=pchcontainer &>%t-mod.ll
1010
// RUN: cat %t-mod.ll | FileCheck %s
1111
// RUN: cat %t-mod.ll | FileCheck --check-prefix=CHECK-NEG %s
1212
// RUN: cat %t-mod.ll | FileCheck --check-prefix=CHECK-MOD %s
13+
// RUN: cat %t-mod.ll | FileCheck --check-prefix=CHECK-MOD-DWARF %s
1314

1415
// PCH:
1516
// RUN: %clang_cc1 -triple %itanium_abi_triple -x c++ -std=c++11 -debugger-tuning=lldb -emit-pch -fmodule-format=obj -I %S/Inputs -o %t.pch %S/Inputs/DebugCXX.h -mllvm -debug-only=pchcontainer &>%t-pch.ll
@@ -20,6 +21,8 @@
2021
@import DebugCXX;
2122
#endif
2223

24+
// CHECK-MOD-DWARF: !"Dwarf Version", i32 5
25+
2326
// CHECK-MOD: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus,
2427
// CHECK-MOD: distinct !DICompileUnit(language: DW_LANG_{{.*}}C_plus_plus,
2528

0 commit comments

Comments
 (0)