[Lldb-commits] [lldb] 525a591 - Revert 76c5f277f2 "Re-land [Debug][CodeView] Emit fully qualified names for globals"
Hans Wennborg via lldb-commits
lldb-commits at lists.llvm.org
Mon May 18 02:26:49 PDT 2020
Author: Hans Wennborg
Date: 2020-05-18T11:26:30+02:00
New Revision: 525a591f0f48b9d54018bf5245f2abee09c9c1c8
URL: https://github.com/llvm/llvm-project/commit/525a591f0f48b9d54018bf5245f2abee09c9c1c8
DIFF: https://github.com/llvm/llvm-project/commit/525a591f0f48b9d54018bf5245f2abee09c9c1c8.diff
LOG: Revert 76c5f277f2 "Re-land [Debug][CodeView] Emit fully qualified names for globals"
> Before this patch, S_[L|G][THREAD32|DATA32] records were emitted with a simple name, not the fully qualified name (namespace + class scope).
>
> Differential Revision: https://reviews.llvm.org/D79447
This causes asserts in Chromium builds:
CodeViewDebug.cpp:2997: void llvm::CodeViewDebug::emitDebugInfoForUDTs(const std::vector<std::pair<std::string, const DIType *>> &):
Assertion `OriginalSize == UDTs.size()' failed.
I will follow up on the Phabricator issue.
Added:
Modified:
lldb/test/Shell/SymbolFile/PDB/variables.test
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
llvm/test/DebugInfo/COFF/global-constants.ll
llvm/test/DebugInfo/COFF/global_visibility.ll
llvm/test/DebugInfo/COFF/globals.ll
llvm/test/DebugInfo/COFF/types-array-unsized.ll
Removed:
################################################################################
diff --git a/lldb/test/Shell/SymbolFile/PDB/variables.test b/lldb/test/Shell/SymbolFile/PDB/variables.test
index a6c715360958..ae14f02754ce 100644
--- a/lldb/test/Shell/SymbolFile/PDB/variables.test
+++ b/lldb/test/Shell/SymbolFile/PDB/variables.test
@@ -13,12 +13,12 @@ GLOBALS: SymbolFile pdb ([[MOD]])
GLOBALS: CompileUnit{{.*}}, language = "c++", file = '{{.*}}\VariablesTest.cpp'
GLOBALS-DAG: Variable{{.*}}, name = "g_IntVar"
GLOBALS-SAME: scope = global, location = {{.*}}, external
+GLOBALS-DAG: Variable{{.*}}, name = "m_StaticClassMember"
+GLOBALS-SAME: scope = global, location = {{.*}}, external
GLOBALS-DAG: Variable{{.*}}, name = "g_pConst"
GLOBALS-SAME: scope = global, location = {{.*}}, external
GLOBALS-DAG: Variable{{.*}}, name = "same_name_var"
GLOBALS-SAME: scope = global, location = {{.*}}, external
-GLOBALS-DAG: Variable{{.*}}, name = "Class::m_StaticClassMember"
-GLOBALS-SAME: scope = global, location = {{.*}}, external
GLOBALS-DAG: Variable{{.*}}, name = "g_EnumVar"
GLOBALS-SAME: scope = global, location = {{.*}}, external
GLOBALS-DAG: Variable{{.*}}, name = "g_tls"
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index 6f75dbd889fe..f167cead4e2c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -343,24 +343,8 @@ static std::string formatNestedName(ArrayRef<StringRef> QualifiedNameComponents,
return FullyQualifiedName;
}
-struct CodeViewDebug::TypeLoweringScope {
- TypeLoweringScope(CodeViewDebug &CVD) : CVD(CVD) { ++CVD.TypeEmissionLevel; }
- ~TypeLoweringScope() {
- // Don't decrement TypeEmissionLevel until after emitting deferred types, so
- // inner TypeLoweringScopes don't attempt to emit deferred types.
- if (CVD.TypeEmissionLevel == 1)
- CVD.emitDeferredCompleteTypes();
- --CVD.TypeEmissionLevel;
- }
- CodeViewDebug &CVD;
-};
-
std::string CodeViewDebug::getFullyQualifiedName(const DIScope *Scope,
StringRef Name) {
- // Ensure types in the scope chain are emitted as soon as possible.
- // This can create otherwise a situation where S_UDTs are emitted while
- // looping in emitDebugInfoForUDTs.
- TypeLoweringScope S(*this);
SmallVector<StringRef, 5> QualifiedNameComponents;
collectParentScopeNames(Scope, QualifiedNameComponents);
return formatNestedName(QualifiedNameComponents, Name);
@@ -371,6 +355,18 @@ std::string CodeViewDebug::getFullyQualifiedName(const DIScope *Ty) {
return getFullyQualifiedName(Scope, getPrettyScopeName(Ty));
}
+struct CodeViewDebug::TypeLoweringScope {
+ TypeLoweringScope(CodeViewDebug &CVD) : CVD(CVD) { ++CVD.TypeEmissionLevel; }
+ ~TypeLoweringScope() {
+ // Don't decrement TypeEmissionLevel until after emitting deferred types, so
+ // inner TypeLoweringScopes don't attempt to emit deferred types.
+ if (CVD.TypeEmissionLevel == 1)
+ CVD.emitDeferredCompleteTypes();
+ --CVD.TypeEmissionLevel;
+ }
+ CodeViewDebug &CVD;
+};
+
TypeIndex CodeViewDebug::getScopeIndex(const DIScope *Scope) {
// No scope means global scope and that uses the zero index.
if (!Scope || isa<DIFile>(Scope))
@@ -2985,16 +2981,10 @@ void CodeViewDebug::emitEndSymbolRecord(SymbolKind EndKind) {
}
void CodeViewDebug::emitDebugInfoForUDTs(
- const std::vector<std::pair<std::string, const DIType *>> &UDTs) {
-#ifndef NDEBUG
- size_t OriginalSize = UDTs.size();
-#endif
+ ArrayRef<std::pair<std::string, const DIType *>> UDTs) {
for (const auto &UDT : UDTs) {
const DIType *T = UDT.second;
assert(shouldEmitUdt(T));
- // Ensure no new types are discovered when executing the code below.
- // See discussion in https://reviews.llvm.org/D79512
- assert(OriginalSize == UDTs.size());
MCSymbol *UDTRecordEnd = beginSymbolRecord(SymbolKind::S_UDT);
OS.AddComment("Type");
@@ -3102,14 +3092,6 @@ void CodeViewDebug::emitGlobalVariableList(ArrayRef<CVGlobalVariable> Globals) {
void CodeViewDebug::emitDebugInfoForGlobal(const CVGlobalVariable &CVGV) {
const DIGlobalVariable *DIGV = CVGV.DIGV;
-
- const DIScope *Scope = DIGV->getScope();
- // For static data members, get the scope from the declaration.
- if (const auto *MemberDecl = dyn_cast_or_null<DIDerivedType>(
- DIGV->getRawStaticDataMemberDeclaration()))
- Scope = MemberDecl->getScope();
- std::string QualifiedName = getFullyQualifiedName(Scope, DIGV->getName());
-
if (const GlobalVariable *GV =
CVGV.GVInfo.dyn_cast<const GlobalVariable *>()) {
// DataSym record, see SymbolRecord.h for more info. Thread local data
@@ -3129,9 +3111,13 @@ void CodeViewDebug::emitDebugInfoForGlobal(const CVGlobalVariable &CVGV) {
OS.EmitCOFFSectionIndex(GVSym);
OS.AddComment("Name");
const unsigned LengthOfDataRecord = 12;
- emitNullTerminatedSymbolName(OS, QualifiedName, LengthOfDataRecord);
+ emitNullTerminatedSymbolName(
+ OS, getFullyQualifiedName(DIGV->getScope(), DIGV->getName()),
+ LengthOfDataRecord);
endSymbolRecord(DataEnd);
} else {
+ // FIXME: Currently this only emits the global variables in the IR metadata.
+ // This should also emit enums and static data members.
const DIExpression *DIE = CVGV.GVInfo.get<const DIExpression *>();
assert(DIE->isConstant() &&
"Global constant variables must contain a constant expression.");
@@ -3151,7 +3137,13 @@ void CodeViewDebug::emitDebugInfoForGlobal(const CVGlobalVariable &CVGV) {
OS.emitBinaryData(SRef);
OS.AddComment("Name");
- emitNullTerminatedSymbolName(OS, QualifiedName);
+ const DIScope *Scope = DIGV->getScope();
+ // For static data members, get the scope from the declaration.
+ if (const auto *MemberDecl = dyn_cast_or_null<DIDerivedType>(
+ DIGV->getRawStaticDataMemberDeclaration()))
+ Scope = MemberDecl->getScope();
+ emitNullTerminatedSymbolName(OS,
+ getFullyQualifiedName(Scope, DIGV->getName()));
endSymbolRecord(SConstantEnd);
}
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
index 82f0293874d0..f690376ada89 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
@@ -310,8 +310,8 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase {
void emitDebugInfoForRetainedTypes();
- void emitDebugInfoForUDTs(
- const std::vector<std::pair<std::string, const DIType *>> &UDTs);
+ void
+ emitDebugInfoForUDTs(ArrayRef<std::pair<std::string, const DIType *>> UDTs);
void emitDebugInfoForGlobals();
void emitGlobalVariableList(ArrayRef<CVGlobalVariable> Globals);
diff --git a/llvm/test/DebugInfo/COFF/global-constants.ll b/llvm/test/DebugInfo/COFF/global-constants.ll
index f930df48be10..7f68465da00f 100644
--- a/llvm/test/DebugInfo/COFF/global-constants.ll
+++ b/llvm/test/DebugInfo/COFF/global-constants.ll
@@ -1,17 +1,17 @@
; RUN: llc < %s | FileCheck %s --check-prefix=ASM
; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s --check-prefix=OBJ
-; // C++ source to regenerate:
+; C++ source to regenerate:
; namespace Test1 {
; const float TestConst1 = 3.14;
; }
; struct S {
; static const int TestConst2 = -10;
; enum { SEnum = 42 };
-; };
+; }
; enum TestEnum : int {
-; ENUM_A = 2147000000,
-; ENUM_B = -2147000000,
+; ENUM_A = 2147000000,
+; ENUM_B = -2147000000,
; };
; void useConst(int);
; void foo() {
@@ -20,33 +20,27 @@
; useConst(ENUM_B);
; useConst(S::SEnum);
; }
-;
-; $ clang a.cpp -S -emit-llvm -g -gcodeview
+; $ clang t.cpp -S -emit-llvm -g -gcodeview -o t.ll
; ASM-LABEL: .long 241 # Symbol subsection for globals
-
-; ASM: .short 4359 # Record kind: S_CONSTANT
-; ASM-NEXT: .long 4099 # Type
-; ASM-NEXT: .byte 0x04, 0x80, 0xc3, 0xf5 # Value
-; ASM-NEXT: .byte 0x48, 0x40
-; ASM-NEXT: .asciz "Test1::TestConst1" # Name
-; ASM-NEXT: .p2align 2
-
-; ASM: .short 4359 # Record kind: S_CONSTANT
-; ASM-NEXT: .long 4101 # Type
-; ASM-NEXT: .byte 0x0a, 0x80, 0xf6, 0xff # Value
-; ASM-NEXT: .byte 0xff, 0xff, 0xff, 0xff
-; ASM-NEXT: .byte 0xff, 0xff
-; ASM-NEXT: .asciz "S::TestConst2" # Name
-; ASM-NEXT: .p2align 2
-
-; ASM: .short 4359 # Record kind: S_CONSTANT
-; ASM-NEXT: .long 4110 # Type
-; ASM-NEXT: .byte 0x0a, 0x80, 0x40, 0x61 # Value
-; ASM-NEXT: .byte 0x07, 0x80, 0xff, 0xff
-; ASM-NEXT: .byte 0xff, 0xff
-; ASM-NEXT: .asciz "ENUM_B" # Name
-; ASM-NEXT: .p2align 2
+; ASM: .short {{.*-.*}} # Record length
+; ASM: .short 4359 # Record kind: S_CONSTANT
+; ASM-NEXT: .long 4102 # Type
+; ASM-NEXT: .byte 0x04, 0x80, 0xc3, 0xf5 # Value
+; ASM-NEXT: .byte 0x48, 0x40
+; ASM-NEXT: .asciz "Test1::TestConst1" # Name
+; ASM: .short {{.*-.*}} # Record length
+; ASM: .short 4359 # Record kind: S_CONSTANT
+; ASM-NEXT: .long 4103 # Type
+; ASM-NEXT: .byte 0x61, 0x00 # Value
+; ASM-NEXT: .asciz "S::TestConst2" # Name
+; ASM: .short {{.*-.*}} # Record length
+; ASM: .short 4359 # Record kind: S_CONSTANT
+; ASM-NEXT: .long 4105 # Type
+; ASM-NEXT: .byte 0x0a, 0x80, 0x40, 0x61 # Value
+; ASM-NEXT: .byte 0x07, 0x80, 0xff, 0xff
+; ASM-NEXT: .byte 0xff, 0xff
+; ASM-NEXT: .asciz "ENUM_B" # Name
; ASM-NOT: .asciz "S::SEnum" # Name
; OBJ: CodeViewDebugInfo [
@@ -56,85 +50,110 @@
; OBJ: SubSectionType: Symbols (0xF1)
; OBJ: ConstantSym {
; OBJ-NEXT: Kind: S_CONSTANT (0x1107)
-; OBJ-NEXT: Type: const float (0x1003)
+; OBJ-NEXT: Type: const float (0x1006)
; OBJ-NEXT: Value: 1078523331
; OBJ-NEXT: Name: Test1::TestConst1
; OBJ-NEXT: }
; OBJ-NEXT: ConstantSym {
; OBJ-NEXT: Kind: S_CONSTANT (0x1107)
-; OBJ-NEXT: Type: const int (0x1005)
-; OBJ-NEXT: Value: 18446744073709551606
+; OBJ-NEXT: Type: const char (0x1007)
+; OBJ-NEXT: Value: 97
; OBJ-NEXT: Name: S::TestConst2
; OBJ-NEXT: }
; OBJ-NEXT: ConstantSym {
; OBJ-NEXT: Kind: S_CONSTANT (0x1107)
-; OBJ-NEXT: Type: TestEnum (0x100E)
+; OBJ-NEXT: Type: TestEnum (0x1009)
; OBJ-NEXT: Value: 18446744071562551616
; OBJ-NEXT: Name: ENUM_B
; OBJ-NEXT: }
; OBJ-NOT: Name: S::SEnum
-; ModuleID = 'a.cpp'
-source_filename = "a.cpp"
-target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-pc-windows-msvc19.25.28614"
+; ModuleID = 't.cpp'
+source_filename = "t.cpp"
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc19.16.27030"
+
+; Function Attrs: noinline nounwind optnone uwtable
+define dso_local void @"?useConst@@YAXH at Z"(i32) #0 !dbg !32 {
+entry:
+ %.addr = alloca i32, align 4
+ store i32 %0, i32* %.addr, align 4
+ call void @llvm.dbg.declare(metadata i32* %.addr, metadata !36, metadata !DIExpression()), !dbg !37
+ ret void, !dbg !37
+}
+
+; Function Attrs: nounwind readnone speculatable
+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
-; Function Attrs: noinline optnone uwtable
-define dso_local void @"?foo@@YAXXZ"() #0 !dbg !31 {
+; Function Attrs: noinline norecurse nounwind optnone uwtable
+define dso_local i32 @main() #2 !dbg !38 {
entry:
- call void @"?useConst@@YAXH at Z"(i32 3), !dbg !35
- call void @"?useConst@@YAXH at Z"(i32 -10), !dbg !36
- call void @"?useConst@@YAXH at Z"(i32 -2147000000), !dbg !37
- call void @"?useConst@@YAXH at Z"(i32 42), !dbg !38
- ret void, !dbg !39
+ %retval = alloca i32, align 4
+ store i32 0, i32* %retval, align 4
+ call void @"?useConst@@YAXH at Z"(i32 3), !dbg !41
+ call void @"?useConst@@YAXH at Z"(i32 97), !dbg !42
+ call void @"?useConst@@YAXH at Z"(i32 -2147000000), !dbg !43
+ call void @"?useConst@@YAXH at Z"(i32 42), !dbg !44
+ call void @llvm.debugtrap(), !dbg !45
+ ret i32 0, !dbg !46
}
-declare dso_local void @"?useConst@@YAXH at Z"(i32) #1
+; Function Attrs: nounwind
+declare void @llvm.debugtrap() #3
-attributes #0 = { noinline optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { nounwind readnone speculatable }
+attributes #2 = { noinline norecurse nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #3 = { nounwind }
!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!26, !27, !28, !29}
-!llvm.ident = !{!30}
+!llvm.module.flags = !{!27, !28, !29, !30}
+!llvm.ident = !{!31}
-!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.0.0 (https://github.com/llvm/llvm-project.git 202f144bffd0be254a829924195e1b8ebabcbb79)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !15, globals: !16, nameTableKind: None)
-!1 = !DIFile(filename: "a.cpp", directory: "F:\\llvm-project\\__test", checksumkind: CSK_MD5, checksum: "a1dbf3aabea9e8f9d1be48f60287942f")
-!2 = !{!3, !11}
-!3 = !DICompositeType(tag: DW_TAG_enumeration_type, scope: !4, file: !1, line: 6, baseType: !8, size: 32, elements: !9, identifier: ".?AW4<unnamed-enum-SEnum>@S@@")
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 9.0.0 (https://github.com/llvm/llvm-project.git f60f863075c7056f26e701b0405fc5752f0db576)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !16, globals: !17, nameTableKind: None)
+!1 = !DIFile(filename: "t.cpp", directory: "C:\5Csrc\5Ctesting", checksumkind: CSK_MD5, checksum: "70da26ef1009521e2127bf71f8d532a2")
+!2 = !{!3, !12}
+!3 = !DICompositeType(tag: DW_TAG_enumeration_type, scope: !4, file: !1, line: 6, baseType: !9, size: 32, elements: !10, identifier: ".?AW4<unnamed-enum-SEnum>@S@@")
!4 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !1, line: 4, size: 8, flags: DIFlagTypePassByValue, elements: !5, identifier: ".?AUS@@")
!5 = !{!6, !3}
-!6 = !DIDerivedType(tag: DW_TAG_member, name: "TestConst2", scope: !4, file: !1, line: 5, baseType: !7, flags: DIFlagStaticMember, extraData: i32 -10)
+!6 = !DIDerivedType(tag: DW_TAG_member, name: "TestConst2", scope: !4, file: !1, line: 5, baseType: !7, flags: DIFlagStaticMember, extraData: i8 97)
!7 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !8)
-!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
-!9 = !{!10}
-!10 = !DIEnumerator(name: "SEnum", value: 42)
-!11 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "TestEnum", file: !1, line: 8, baseType: !8, size: 32, elements: !12, identifier: ".?AW4TestEnum@@")
-!12 = !{!13, !14}
-!13 = !DIEnumerator(name: "ENUM_A", value: 2147000000)
-!14 = !DIEnumerator(name: "ENUM_B", value: -2147000000)
-!15 = !{!4}
-!16 = !{!17, !22, !24}
-!17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression(DW_OP_constu, 1078523331, DW_OP_stack_value))
-!18 = distinct !DIGlobalVariable(name: "TestConst1", scope: !19, file: !1, line: 2, type: !20, isLocal: true, isDefinition: true)
-!19 = !DINamespace(name: "Test1", scope: null)
-!20 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !21)
-!21 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
-!22 = !DIGlobalVariableExpression(var: !23, expr: !DIExpression(DW_OP_constu, 18446744073709551606, DW_OP_stack_value))
-!23 = distinct !DIGlobalVariable(name: "TestConst2", scope: !0, file: !1, line: 5, type: !7, isLocal: true, isDefinition: true, declaration: !6)
-!24 = !DIGlobalVariableExpression(var: !25, expr: !DIExpression(DW_OP_constu, 18446744071562551616, DW_OP_stack_value))
-!25 = distinct !DIGlobalVariable(name: "ENUM_B", scope: !0, file: !1, line: 10, type: !11, isLocal: true, isDefinition: true)
-!26 = !{i32 2, !"CodeView", i32 1}
-!27 = !{i32 2, !"Debug Info Version", i32 3}
-!28 = !{i32 1, !"wchar_size", i32 2}
-!29 = !{i32 7, !"PIC Level", i32 2}
-!30 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git 202f144bffd0be254a829924195e1b8ebabcbb79)"}
-!31 = distinct !DISubprogram(name: "foo", linkageName: "?foo@@YAXXZ", scope: !1, file: !1, line: 13, type: !32, scopeLine: 13, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !34)
-!32 = !DISubroutineType(types: !33)
-!33 = !{null}
-!34 = !{}
-!35 = !DILocation(line: 14, scope: !31)
-!36 = !DILocation(line: 15, scope: !31)
-!37 = !DILocation(line: 16, scope: !31)
-!38 = !DILocation(line: 17, scope: !31)
-!39 = !DILocation(line: 18, scope: !31)
+!8 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
+!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!10 = !{!11}
+!11 = !DIEnumerator(name: "SEnum", value: 42)
+!12 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "TestEnum", file: !1, line: 8, baseType: !9, size: 32, elements: !13, identifier: ".?AW4TestEnum@@")
+!13 = !{!14, !15}
+!14 = !DIEnumerator(name: "ENUM_A", value: 2147000000)
+!15 = !DIEnumerator(name: "ENUM_B", value: -2147000000)
+!16 = !{!4}
+!17 = !{!18, !23, !25}
+!18 = !DIGlobalVariableExpression(var: !19, expr: !DIExpression(DW_OP_constu, 1078523331, DW_OP_stack_value))
+!19 = distinct !DIGlobalVariable(name: "TestConst1", scope: !20, file: !1, line: 2, type: !21, isLocal: true, isDefinition: true)
+!20 = !DINamespace(name: "Test1", scope: null)
+!21 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !22)
+!22 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
+!23 = !DIGlobalVariableExpression(var: !24, expr: !DIExpression(DW_OP_constu, 97, DW_OP_stack_value))
+!24 = distinct !DIGlobalVariable(name: "TestConst2", scope: !0, file: !1, line: 5, type: !7, isLocal: true, isDefinition: true, declaration: !6)
+!25 = !DIGlobalVariableExpression(var: !26, expr: !DIExpression(DW_OP_constu, 18446744071562551616, DW_OP_stack_value))
+!26 = distinct !DIGlobalVariable(name: "ENUM_B", scope: !0, file: !1, line: 10, type: !12, isLocal: true, isDefinition: true)
+!27 = !{i32 2, !"CodeView", i32 1}
+!28 = !{i32 2, !"Debug Info Version", i32 3}
+!29 = !{i32 1, !"wchar_size", i32 2}
+!30 = !{i32 7, !"PIC Level", i32 2}
+!31 = !{!"clang version 9.0.0 (https://github.com/llvm/llvm-project.git f60f863075c7056f26e701b0405fc5752f0db576)"}
+!32 = distinct !DISubprogram(name: "useConst", linkageName: "?useConst@@YAXH at Z", scope: !1, file: !1, line: 12, type: !33, scopeLine: 12, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !35)
+!33 = !DISubroutineType(types: !34)
+!34 = !{null, !9}
+!35 = !{}
+!36 = !DILocalVariable(arg: 1, scope: !32, file: !1, line: 12, type: !9)
+!37 = !DILocation(line: 12, scope: !32)
+!38 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 13, type: !39, scopeLine: 13, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !35)
+!39 = !DISubroutineType(types: !40)
+!40 = !{!9}
+!41 = !DILocation(line: 14, scope: !38)
+!42 = !DILocation(line: 15, scope: !38)
+!43 = !DILocation(line: 16, scope: !38)
+!44 = !DILocation(line: 17, scope: !38)
+!45 = !DILocation(line: 18, scope: !38)
+!46 = !DILocation(line: 19, scope: !38)
diff --git a/llvm/test/DebugInfo/COFF/global_visibility.ll b/llvm/test/DebugInfo/COFF/global_visibility.ll
index 4a5eff8a6b28..8a3e8307785c 100644
--- a/llvm/test/DebugInfo/COFF/global_visibility.ll
+++ b/llvm/test/DebugInfo/COFF/global_visibility.ll
@@ -3,36 +3,34 @@
; This test verifies global variables are emitted within the correct scope.
;
; -- global_visibility.cpp ----------------------------------------------------
-; int global_int = 0;
-;
-; template <typename T> struct A {
-; static T comdat_int;
-; static T set(T value) {
-; T r = comdat_int;
-; comdat_int = value;
-; return r;
-; };
-; };
-;
-; template <typename T> T A<T>::comdat_int = 42;
-;
-; void foo() {
-; static int local_int = 1;
-; {
-; static int nested_int = 2;
-; local_int = nested_int;
-; }
-; local_int = A<int>::set(42);
-; }
-;
-; void bar() {
-; static int local_int = 3;
-; {
-; static int nested_int = 4;
-; local_int = nested_int;
-; }
-; local_int = A<unsigned>::set(42);
-; }
+; 1
+; 2 int global_int = 0;
+; 3
+; 4 template <typename T> struct A {
+; 5 static T comdat_int;
+; 6 static T set(T value) { T r = comdat_int; comdat_int = value; return r; };
+; 7 };
+; 8
+; 9 template <typename T> T A<T>::comdat_int = 42;
+; 10
+; 11 void foo() {
+; 12 static int local_int = 1;
+; 13 {
+; 14 static int nested_int = 2;
+; 15 local_int = nested_int;
+; 16 }
+; 17 local_int = A<int>::set(42);
+; 18 }
+; 19
+; 20 void bar() {
+; 21 static int local_int = 3;
+; 22 {
+; 23 static int nested_int = 4;
+; 24 local_int = nested_int;
+; 25 }
+; 26 local_int = A<unsigned>::set(42);
+; 27 }
+; 28
; -----------------------------------------------------------------------------
;
; $ clang -S -emit-llvm -g -gcodeview global_visibility.cpp
@@ -56,11 +54,17 @@
; CHECK: DisplayName: foo::local_int
; CHECK: LinkageName: ?local_int@?1??foo@@YAXXZ at 4HA
; CHECK: }
+; CHECK: BlockSym {
+; CHECK: Kind: S_BLOCK32 (0x1103)
+; CHECK: }
; CHECK: DataSym {
; CHECK: Kind: S_LDATA32 (0x110C)
; CHECK: DisplayName: foo::nested_int
; CHECK: LinkageName: ?nested_int@?1??foo@@YAXXZ at 4HA
; CHECK: }
+; CHECK: ScopeEndSym {
+; CHECK: Kind: S_END (0x6)
+; CHECK: }
; CHECK: ProcEnd {
; CHECK: Kind: S_PROC_ID_END (0x114F)
; CHECK: }
@@ -77,11 +81,17 @@
; CHECK: DisplayName: bar::local_int
; CHECK: LinkageName: ?local_int@?1??bar@@YAXXZ at 4HA
; CHECK: }
+; CHECK: BlockSym {
+; CHECK: Kind: S_BLOCK32 (0x1103)
+; CHECK: }
; CHECK: DataSym {
; CHECK: Kind: S_LDATA32 (0x110C)
; CHECK: DisplayName: bar::nested_int
; CHECK: LinkageName: ?nested_int@?1??bar@@YAXXZ at 4HA
; CHECK: }
+; CHECK: ScopeEndSym {
+; CHECK: Kind: S_END (0x6)
+; CHECK: }
; CHECK: ProcEnd {
; CHECK: Kind: S_PROC_ID_END (0x114F)
; CHECK: }
@@ -101,7 +111,7 @@
; CHECK: SubSectionType: Symbols (0xF1)
; CHECK: GlobalData {
; CHECK: Kind: S_GDATA32 (0x110D)
-; CHECK: DisplayName: A<int>::comdat_int
+; CHECK: DisplayName: comdat_int
; CHECK: LinkageName: ?comdat_int@?$A at H@@2HA
; CHECK: }
; CHECK: ]
@@ -112,17 +122,17 @@
; CHECK: SubSectionType: Symbols (0xF1)
; CHECK: GlobalData {
; CHECK: Kind: S_GDATA32 (0x110D)
-; CHECK: DisplayName: A<unsigned int>::comdat_int
+; CHECK: DisplayName: comdat_int
; CHECK: LinkageName: ?comdat_int@?$A at I@@2IA
; CHECK: }
; CHECK: ]
; CHECK: ]
;
-; ModuleID = 'a.cpp'
-source_filename = "a.cpp"
-target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-pc-windows-msvc19.25.28614"
+; ModuleID = 'global_visibility.cpp'
+source_filename = "global_visibility.cpp"
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc19.15.26730"
$"?set@?$A at H@@SAHH at Z" = comdat any
@@ -157,88 +167,88 @@ entry:
%r = alloca i32, align 4
store i32 %value, i32* %value.addr, align 4
call void @llvm.dbg.declare(metadata i32* %value.addr, metadata !50, metadata !DIExpression()), !dbg !51
- call void @llvm.dbg.declare(metadata i32* %r, metadata !52, metadata !DIExpression()), !dbg !53
- %0 = load i32, i32* @"?comdat_int@?$A at H@@2HA", align 4, !dbg !53
- store i32 %0, i32* %r, align 4, !dbg !53
- %1 = load i32, i32* %value.addr, align 4, !dbg !54
- store i32 %1, i32* @"?comdat_int@?$A at H@@2HA", align 4, !dbg !54
- %2 = load i32, i32* %r, align 4, !dbg !55
- ret i32 %2, !dbg !55
+ call void @llvm.dbg.declare(metadata i32* %r, metadata !52, metadata !DIExpression()), !dbg !51
+ %0 = load i32, i32* @"?comdat_int@?$A at H@@2HA", align 4, !dbg !51
+ store i32 %0, i32* %r, align 4, !dbg !51
+ %1 = load i32, i32* %value.addr, align 4, !dbg !51
+ store i32 %1, i32* @"?comdat_int@?$A at H@@2HA", align 4, !dbg !51
+ %2 = load i32, i32* %r, align 4, !dbg !51
+ ret i32 %2, !dbg !51
}
; Function Attrs: noinline optnone uwtable
define dso_local void @"?bar@@YAXXZ"() #0 !dbg !16 {
entry:
- %0 = load i32, i32* @"?nested_int@?1??bar@@YAXXZ at 4HA", align 4, !dbg !56
- store i32 %0, i32* @"?local_int@?1??bar@@YAXXZ at 4HA", align 4, !dbg !56
- %call = call i32 @"?set@?$A at I@@SAII at Z"(i32 42), !dbg !58
- store i32 %call, i32* @"?local_int@?1??bar@@YAXXZ at 4HA", align 4, !dbg !58
- ret void, !dbg !59
+ %0 = load i32, i32* @"?nested_int@?1??bar@@YAXXZ at 4HA", align 4, !dbg !53
+ store i32 %0, i32* @"?local_int@?1??bar@@YAXXZ at 4HA", align 4, !dbg !53
+ %call = call i32 @"?set@?$A at I@@SAII at Z"(i32 42), !dbg !55
+ store i32 %call, i32* @"?local_int@?1??bar@@YAXXZ at 4HA", align 4, !dbg !55
+ ret void, !dbg !56
}
; Function Attrs: noinline nounwind optnone uwtable
-define linkonce_odr dso_local i32 @"?set@?$A at I@@SAII at Z"(i32 %value) #1 comdat align 2 !dbg !60 {
+define linkonce_odr dso_local i32 @"?set@?$A at I@@SAII at Z"(i32 %value) #1 comdat align 2 !dbg !57 {
entry:
%value.addr = alloca i32, align 4
%r = alloca i32, align 4
store i32 %value, i32* %value.addr, align 4
- call void @llvm.dbg.declare(metadata i32* %value.addr, metadata !61, metadata !DIExpression()), !dbg !62
- call void @llvm.dbg.declare(metadata i32* %r, metadata !63, metadata !DIExpression()), !dbg !64
- %0 = load i32, i32* @"?comdat_int@?$A at I@@2IA", align 4, !dbg !64
- store i32 %0, i32* %r, align 4, !dbg !64
- %1 = load i32, i32* %value.addr, align 4, !dbg !65
- store i32 %1, i32* @"?comdat_int@?$A at I@@2IA", align 4, !dbg !65
- %2 = load i32, i32* %r, align 4, !dbg !66
- ret i32 %2, !dbg !66
+ call void @llvm.dbg.declare(metadata i32* %value.addr, metadata !58, metadata !DIExpression()), !dbg !59
+ call void @llvm.dbg.declare(metadata i32* %r, metadata !60, metadata !DIExpression()), !dbg !59
+ %0 = load i32, i32* @"?comdat_int@?$A at I@@2IA", align 4, !dbg !59
+ store i32 %0, i32* %r, align 4, !dbg !59
+ %1 = load i32, i32* %value.addr, align 4, !dbg !59
+ store i32 %1, i32* @"?comdat_int@?$A at I@@2IA", align 4, !dbg !59
+ %2 = load i32, i32* %r, align 4, !dbg !59
+ ret i32 %2, !dbg !59
}
-; Function Attrs: nounwind readnone speculatable willreturn
+; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.declare(metadata, metadata, metadata) #2
-attributes #0 = { noinline optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #1 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #2 = { nounwind readnone speculatable willreturn }
+attributes #0 = { noinline optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #2 = { nounwind readnone speculatable }
!llvm.dbg.cu = !{!2}
!llvm.module.flags = !{!40, !41, !42, !43}
!llvm.ident = !{!44}
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
-!1 = distinct !DIGlobalVariable(name: "global_int", linkageName: "?global_int@@3HA", scope: !2, file: !3, line: 1, type: !11, isLocal: false, isDefinition: true)
-!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 11.0.0 (https://github.com/llvm/llvm-project.git 202f144bffd0be254a829924195e1b8ebabcbb79)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None)
-!3 = !DIFile(filename: "a.cpp", directory: "F:\\llvm-project\\__test", checksumkind: CSK_MD5, checksum: "66a5399777dc9d37656fb00438bca542")
+!1 = distinct !DIGlobalVariable(name: "global_int", linkageName: "?global_int@@3HA", scope: !2, file: !3, line: 2, type: !11, isLocal: false, isDefinition: true)
+!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 8.0.0 (trunk)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None)
+!3 = !DIFile(filename: "global_visibility.cpp", directory: "C:\5Cpath\5Cto\5Cdirectory", checksumkind: CSK_MD5, checksum: "f59b9e5de12391471b1a61888cb68a3e")
!4 = !{}
!5 = !{!0, !6, !12, !14, !17, !19, !29}
!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
-!7 = distinct !DIGlobalVariable(name: "local_int", scope: !8, file: !3, line: 15, type: !11, isLocal: true, isDefinition: true)
-!8 = distinct !DISubprogram(name: "foo", linkageName: "?foo@@YAXXZ", scope: !3, file: !3, line: 14, type: !9, scopeLine: 14, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4)
+!7 = distinct !DIGlobalVariable(name: "local_int", scope: !8, file: !3, line: 12, type: !11, isLocal: true, isDefinition: true)
+!8 = distinct !DISubprogram(name: "foo", linkageName: "?foo@@YAXXZ", scope: !3, file: !3, line: 11, type: !9, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4)
!9 = !DISubroutineType(types: !10)
!10 = !{null}
!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!12 = !DIGlobalVariableExpression(var: !13, expr: !DIExpression())
-!13 = distinct !DIGlobalVariable(name: "nested_int", scope: !8, file: !3, line: 17, type: !11, isLocal: true, isDefinition: true)
+!13 = distinct !DIGlobalVariable(name: "nested_int", scope: !46, file: !3, line: 14, type: !11, isLocal: true, isDefinition: true)
!14 = !DIGlobalVariableExpression(var: !15, expr: !DIExpression())
-!15 = distinct !DIGlobalVariable(name: "local_int", scope: !16, file: !3, line: 24, type: !11, isLocal: true, isDefinition: true)
-!16 = distinct !DISubprogram(name: "bar", linkageName: "?bar@@YAXXZ", scope: !3, file: !3, line: 23, type: !9, scopeLine: 23, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4)
+!15 = distinct !DIGlobalVariable(name: "local_int", scope: !16, file: !3, line: 21, type: !11, isLocal: true, isDefinition: true)
+!16 = distinct !DISubprogram(name: "bar", linkageName: "?bar@@YAXXZ", scope: !3, file: !3, line: 20, type: !9, scopeLine: 20, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4)
!17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression())
-!18 = distinct !DIGlobalVariable(name: "nested_int", scope: !16, file: !3, line: 26, type: !11, isLocal: true, isDefinition: true)
+!18 = distinct !DIGlobalVariable(name: "nested_int", scope: !54, file: !3, line: 23, type: !11, isLocal: true, isDefinition: true)
!19 = !DIGlobalVariableExpression(var: !20, expr: !DIExpression())
-!20 = distinct !DIGlobalVariable(name: "comdat_int", linkageName: "?comdat_int@?$A at H@@2HA", scope: !2, file: !3, line: 12, type: !11, isLocal: false, isDefinition: true, declaration: !21)
-!21 = !DIDerivedType(tag: DW_TAG_member, name: "comdat_int", scope: !22, file: !3, line: 4, baseType: !11, flags: DIFlagStaticMember)
-!22 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A<int>", file: !3, line: 3, size: 8, flags: DIFlagTypePassByValue, elements: !23, templateParams: !27, identifier: ".?AU?$A at H@@")
+!20 = distinct !DIGlobalVariable(name: "comdat_int", linkageName: "?comdat_int@?$A at H@@2HA", scope: !2, file: !3, line: 9, type: !11, isLocal: false, isDefinition: true, declaration: !21)
+!21 = !DIDerivedType(tag: DW_TAG_member, name: "comdat_int", scope: !22, file: !3, line: 5, baseType: !11, flags: DIFlagStaticMember)
+!22 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A<int>", file: !3, line: 4, size: 8, flags: DIFlagTypePassByValue, elements: !23, templateParams: !27, identifier: ".?AU?$A at H@@")
!23 = !{!21, !24}
-!24 = !DISubprogram(name: "set", linkageName: "?set@?$A at H@@SAHH at Z", scope: !22, file: !3, line: 5, type: !25, scopeLine: 5, flags: DIFlagPrototyped | DIFlagStaticMember, spFlags: 0)
+!24 = !DISubprogram(name: "set", linkageName: "?set@?$A at H@@SAHH at Z", scope: !22, file: !3, line: 6, type: !25, scopeLine: 6, flags: DIFlagPrototyped | DIFlagStaticMember, spFlags: 0)
!25 = !DISubroutineType(types: !26)
!26 = !{!11, !11}
!27 = !{!28}
!28 = !DITemplateTypeParameter(name: "T", type: !11)
!29 = !DIGlobalVariableExpression(var: !30, expr: !DIExpression())
-!30 = distinct !DIGlobalVariable(name: "comdat_int", linkageName: "?comdat_int@?$A at I@@2IA", scope: !2, file: !3, line: 12, type: !31, isLocal: false, isDefinition: true, declaration: !32)
+!30 = distinct !DIGlobalVariable(name: "comdat_int", linkageName: "?comdat_int@?$A at I@@2IA", scope: !2, file: !3, line: 9, type: !31, isLocal: false, isDefinition: true, declaration: !32)
!31 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)
-!32 = !DIDerivedType(tag: DW_TAG_member, name: "comdat_int", scope: !33, file: !3, line: 4, baseType: !31, flags: DIFlagStaticMember)
-!33 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A<unsigned int>", file: !3, line: 3, size: 8, flags: DIFlagTypePassByValue, elements: !34, templateParams: !38, identifier: ".?AU?$A at I@@")
+!32 = !DIDerivedType(tag: DW_TAG_member, name: "comdat_int", scope: !33, file: !3, line: 5, baseType: !31, flags: DIFlagStaticMember)
+!33 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A<unsigned int>", file: !3, line: 4, size: 8, flags: DIFlagTypePassByValue, elements: !34, templateParams: !38, identifier: ".?AU?$A at I@@")
!34 = !{!32, !35}
-!35 = !DISubprogram(name: "set", linkageName: "?set@?$A at I@@SAII at Z", scope: !33, file: !3, line: 5, type: !36, scopeLine: 5, flags: DIFlagPrototyped | DIFlagStaticMember, spFlags: 0)
+!35 = !DISubprogram(name: "set", linkageName: "?set@?$A at I@@SAII at Z", scope: !33, file: !3, line: 6, type: !36, scopeLine: 6, flags: DIFlagPrototyped | DIFlagStaticMember, spFlags: 0)
!36 = !DISubroutineType(types: !37)
!37 = !{!31, !31}
!38 = !{!39}
@@ -247,26 +257,20 @@ attributes #2 = { nounwind readnone speculatable willreturn }
!41 = !{i32 2, !"Debug Info Version", i32 3}
!42 = !{i32 1, !"wchar_size", i32 2}
!43 = !{i32 7, !"PIC Level", i32 2}
-!44 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git 202f144bffd0be254a829924195e1b8ebabcbb79)"}
-!45 = !DILocation(line: 18, scope: !46)
-!46 = distinct !DILexicalBlock(scope: !8, file: !3, line: 16)
-!47 = !DILocation(line: 20, scope: !8)
-!48 = !DILocation(line: 21, scope: !8)
-!49 = distinct !DISubprogram(name: "set", linkageName: "?set@?$A at H@@SAHH at Z", scope: !22, file: !3, line: 5, type: !25, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, declaration: !24, retainedNodes: !4)
-!50 = !DILocalVariable(name: "value", arg: 1, scope: !49, file: !3, line: 5, type: !11)
-!51 = !DILocation(line: 5, scope: !49)
+!44 = !{!"clang version 8.0.0 (trunk)"}
+!45 = !DILocation(line: 15, scope: !46)
+!46 = distinct !DILexicalBlock(scope: !8, file: !3, line: 13)
+!47 = !DILocation(line: 17, scope: !8)
+!48 = !DILocation(line: 18, scope: !8)
+!49 = distinct !DISubprogram(name: "set", linkageName: "?set@?$A at H@@SAHH at Z", scope: !22, file: !3, line: 6, type: !25, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, declaration: !24, retainedNodes: !4)
+!50 = !DILocalVariable(name: "value", arg: 1, scope: !49, file: !3, line: 6, type: !11)
+!51 = !DILocation(line: 6, scope: !49)
!52 = !DILocalVariable(name: "r", scope: !49, file: !3, line: 6, type: !11)
-!53 = !DILocation(line: 6, scope: !49)
-!54 = !DILocation(line: 7, scope: !49)
-!55 = !DILocation(line: 8, scope: !49)
-!56 = !DILocation(line: 27, scope: !57)
-!57 = distinct !DILexicalBlock(scope: !16, file: !3, line: 25)
-!58 = !DILocation(line: 29, scope: !16)
-!59 = !DILocation(line: 30, scope: !16)
-!60 = distinct !DISubprogram(name: "set", linkageName: "?set@?$A at I@@SAII at Z", scope: !33, file: !3, line: 5, type: !36, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, declaration: !35, retainedNodes: !4)
-!61 = !DILocalVariable(name: "value", arg: 1, scope: !60, file: !3, line: 5, type: !31)
-!62 = !DILocation(line: 5, scope: !60)
-!63 = !DILocalVariable(name: "r", scope: !60, file: !3, line: 6, type: !31)
-!64 = !DILocation(line: 6, scope: !60)
-!65 = !DILocation(line: 7, scope: !60)
-!66 = !DILocation(line: 8, scope: !60)
+!53 = !DILocation(line: 24, scope: !54)
+!54 = distinct !DILexicalBlock(scope: !16, file: !3, line: 22)
+!55 = !DILocation(line: 26, scope: !16)
+!56 = !DILocation(line: 27, scope: !16)
+!57 = distinct !DISubprogram(name: "set", linkageName: "?set@?$A at I@@SAII at Z", scope: !33, file: !3, line: 6, type: !36, scopeLine: 6, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, declaration: !35, retainedNodes: !4)
+!58 = !DILocalVariable(name: "value", arg: 1, scope: !57, file: !3, line: 6, type: !31)
+!59 = !DILocation(line: 6, scope: !57)
+!60 = !DILocalVariable(name: "r", scope: !57, file: !3, line: 6, type: !31)
diff --git a/llvm/test/DebugInfo/COFF/globals.ll b/llvm/test/DebugInfo/COFF/globals.ll
index 583f108f3f49..3312e81618a9 100644
--- a/llvm/test/DebugInfo/COFF/globals.ll
+++ b/llvm/test/DebugInfo/COFF/globals.ll
@@ -6,44 +6,19 @@
; C++ source to regenerate:
; $ cat a.cpp
; int first;
-;
; template <typename T> struct A { static const int comdat = 3; };
-;
; thread_local const int *middle = &A<void>::comdat;
-;
; namespace foo {
; thread_local int globalTLS = 4;
; static thread_local int staticTLS = 5;
; int justGlobal = 6;
; static int globalStatic = 7;
-; constexpr int constExpr = 8;
-; const int constVal = 9;
-;
-; struct Data {
-; inline static thread_local int DataStaticTLS = 11;
-; int DataGlobal = 12;
-; inline static int DataStatic = 13;
-; constexpr static int DataConstExpr = 14;
-; const int DataConstVal = 15;
-; };
-; } // namespace foo
-;
+; }
; int last;
-;
; int bar() {
-; struct Local {
-; int LocalGlobal = 12;
-; const int LocalConstVal = 15;
-; };
-; foo::Data D;
-; Local L;
-; return foo::globalStatic + foo::globalTLS + foo::staticTLS + foo::justGlobal +
-; foo::globalStatic + foo::constExpr + foo::constVal + D.DataStaticTLS +
-; D.DataGlobal + D.DataStatic + D.DataConstExpr + D.DataConstVal +
-; L.LocalGlobal + L.LocalConstVal;
+; return foo::globalStatic + foo::globalTLS + foo::staticTLS;
; }
-;
-; $ clang-cl a.cpp /c /GS- /Z7 /GR- /std:c++17 /clang:-S /clang:-emit-llvm
+; $ clang-cl a.cpp /c /Z7 /GS- /clang:-S /clang:-emit-llvm
; ASM: .section .debug$S,"dr"
; ASM-NEXT: .p2align 2
@@ -57,7 +32,7 @@
; ASM-NEXT: .p2align 2
; ASM: .short 4371 # Record kind: S_GTHREAD32
-; ASM-NEXT: .long 4117 # Type
+; ASM-NEXT: .long 4100 # Type
; ASM-NEXT: .secrel32 "?middle@@3PEBHEB" # DataOffset
; ASM-NEXT: .secidx "?middle@@3PEBHEB" # Segment
; ASM-NEXT: .asciz "middle" # Name
@@ -84,24 +59,6 @@
; ASM-NEXT: .asciz "last" # Name
; ASM-NEXT: .p2align 2
-; ASM: .short 4359 # Record kind: S_CONSTANT
-; ASM-NEXT: .long 4100 # Type
-; ASM-NEXT: .byte 0x08, 0x00 # Value
-; ASM-NEXT: .asciz "foo::constExpr" # Name
-; ASM-NEXT: .p2align 2
-
-; ASM: .short 4359 # Record kind: S_CONSTANT
-; ASM-NEXT: .long 4100 # Type
-; ASM-NEXT: .byte 0x09, 0x00 # Value
-; ASM-NEXT: .asciz "foo::constVal" # Name
-; ASM-NEXT: .p2align 2
-
-; ASM: .short 4359 # Record kind: S_CONSTANT
-; ASM-NEXT: .long 4100 # Type
-; ASM-NEXT: .byte 0x0e, 0x00 # Value
-; ASM-NEXT: .asciz "foo::Data::DataConstExpr" # Name
-; ASM-NEXT: .p2align 2
-
; ASM: .short 4364 # Record kind: S_LDATA32
; ASM-NEXT: .long 116 # Type
; ASM-NEXT: .secrel32 "?globalStatic at foo@@3HA" # DataOffset
@@ -121,30 +78,10 @@
; ASM-NEXT: .long 4 # Debug section magic
; ASM: .short 4365 # Record kind: S_GDATA32
-; ASM-NEXT: .long 4100 # Type
+; ASM-NEXT: .long 4099 # Type
; ASM-NEXT: .secrel32 "?comdat@?$A at X@@2HB" # DataOffset
; ASM-NEXT: .secidx "?comdat@?$A at X@@2HB" # Segment
-; ASM-NEXT: .asciz "A<void>::comdat" # Name
-
-; ASM: .section .debug$S,"dr",associative,"?DataStaticTLS at Data@foo@@2HA"
-; ASM-NEXT: .p2align 2 # Symbol subsection for ?DataStaticTLS at Data@foo@@2HA
-
-; ASM: .short 4371 # Record kind: S_GTHREAD32
-; ASM-NEXT: .long 116 # Type
-; ASM-NEXT: .secrel32 "?DataStaticTLS at Data@foo@@2HA" # DataOffset
-; ASM-NEXT: .secidx "?DataStaticTLS at Data@foo@@2HA" # Segment
-; ASM-NEXT: .asciz "foo::Data::DataStaticTLS" # Name
-; ASM-NEXT: .p2align 2
-
-; ASM: .section .debug$S,"dr",associative,"?DataStatic at Data@foo@@2HA"
-; ASM-NEXT: .p2align 2 # Symbol subsection for ?DataStatic at Data@foo@@2HA
-
-; ASM: .short 4365 # Record kind: S_GDATA32
-; ASM-NEXT: .long 116 # Type
-; ASM-NEXT: .secrel32 "?DataStatic at Data@foo@@2HA" # DataOffset
-; ASM-NEXT: .secidx "?DataStatic at Data@foo@@2HA" # Segment
-; ASM-NEXT: .asciz "foo::Data::DataStatic" # Name
-; ASM-NEXT: .p2align 2
+; ASM-NEXT: .asciz "comdat" # Name
; OBJ: CodeViewDebugInfo [
; OBJ: Section: .debug$S
@@ -161,7 +98,7 @@
; OBJ-NEXT: GlobalTLS {
; OBJ-NEXT: Kind: S_GTHREAD32 (0x1113)
; OBJ-NEXT: DataOffset: ?middle@@3PEBHEB+0x0
-; OBJ-NEXT: Type: const int* (0x1015)
+; OBJ-NEXT: Type: const int* (0x1004)
; OBJ-NEXT: DisplayName: middle
; OBJ-NEXT: LinkageName: ?middle@@3PEBHEB
; OBJ-NEXT: }
@@ -186,24 +123,6 @@
; OBJ-NEXT: DisplayName: last
; OBJ-NEXT: LinkageName: ?last@@3HA
; OBJ-NEXT: }
-; OBJ-NEXT: ConstantSym {
-; OBJ-NEXT: Kind: S_CONSTANT (0x1107)
-; OBJ-NEXT: Type: const int (0x1004)
-; OBJ-NEXT: Value: 8
-; OBJ-NEXT: Name: foo::constExpr
-; OBJ-NEXT: }
-; OBJ-NEXT: ConstantSym {
-; OBJ-NEXT: Kind: S_CONSTANT (0x1107)
-; OBJ-NEXT: Type: const int (0x1004)
-; OBJ-NEXT: Value: 9
-; OBJ-NEXT: Name: foo::constVal
-; OBJ-NEXT: }
-; OBJ-NEXT: ConstantSym {
-; OBJ-NEXT: Kind: S_CONSTANT (0x1107)
-; OBJ-NEXT: Type: const int (0x1004)
-; OBJ-NEXT: Value: 14
-; OBJ-NEXT: Name: foo::Data::DataConstExpr
-; OBJ-NEXT: }
; OBJ-NEXT: DataSym {
; OBJ-NEXT: Kind: S_LDATA32 (0x110C)
; OBJ-NEXT: DataOffset: ?globalStatic at foo@@3HA+0x0
@@ -222,26 +141,10 @@
; OBJ: GlobalData {
; OBJ-NEXT: Kind: S_GDATA32 (0x110D)
; OBJ-LABEL: DataOffset: ?comdat@?$A at X@@2HB+0x0
-; OBJ-NEXT: Type: const int (0x1004)
-; OBJ-NEXT: DisplayName: A<void>::comdat
+; OBJ-NEXT: Type: const int (0x1003)
+; OBJ-NEXT: DisplayName: comdat
; OBJ-NEXT: LinkageName: ?comdat@?$A at X@@2HB
-; OBJ: GlobalTLS {
-; OBJ-NEXT: Kind: S_GTHREAD32 (0x1113)
-; OBJ-NEXT: DataOffset: ?DataStaticTLS at Data@foo@@2HA+0x0
-; OBJ-NEXT: Type: int (0x74)
-; OBJ-NEXT: DisplayName: foo::Data::DataStaticTLS
-; OBJ-NEXT: LinkageName: ?DataStaticTLS at Data@foo@@2HA
-; OBJ-NEXT: }
-
-; OBJ: GlobalData {
-; OBJ-NEXT: Kind: S_GDATA32 (0x110D)
-; OBJ-NEXT: DataOffset: ?DataStatic at Data@foo@@2HA+0x0
-; OBJ-NEXT: Type: int (0x74)
-; OBJ-NEXT: DisplayName: foo::Data::DataStatic
-; OBJ-NEXT: LinkageName: ?DataStatic at Data@foo@@2HA
-; OBJ-NEXT: }
-
; YAML-LABEL: - Name: '.debug$S'
; YAML: Subsections:
; YAML: - !Symbols
@@ -260,7 +163,7 @@
; YAML-NOT: Segment
; YAML-NEXT: - Kind: S_GTHREAD32
; YAML-NEXT: ThreadLocalDataSym:
-; YAML-NEXT: Type: 4117
+; YAML-NEXT: Type: 4100
; YAML-NEXT: DisplayName: middle
; YAML-NEXT: - Kind: S_GTHREAD32
; YAML-NEXT: ThreadLocalDataSym:
@@ -277,21 +180,6 @@
; YAML-NEXT: DataSym:
; YAML-NEXT: Type: 116
; YAML-NEXT: DisplayName: last
-; YAML-NEXT: - Kind: S_CONSTANT
-; YAML-NEXT: ConstantSym:
-; YAML-NEXT: Type: 4100
-; YAML-NEXT: Value: 8
-; YAML-NEXT: Name: 'foo::constExpr'
-; YAML-NEXT: - Kind: S_CONSTANT
-; YAML-NEXT: ConstantSym:
-; YAML-NEXT: Type: 4100
-; YAML-NEXT: Value: 9
-; YAML-NEXT: Name: 'foo::constVal'
-; YAML-NEXT: - Kind: S_CONSTANT
-; YAML-NEXT: ConstantSym:
-; YAML-NEXT: Type: 4100
-; YAML-NEXT: Value: 14
-; YAML-NEXT: Name: 'foo::Data::DataConstExpr'
; YAML-NEXT: - Kind: S_LDATA32
; YAML-NEXT: DataSym:
; YAML-NEXT: Type: 116
@@ -306,189 +194,72 @@ source_filename = "a.cpp"
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc19.25.28614"
-%"struct.foo::Data" = type { i32, i32 }
-%struct.Local = type { i32, i32 }
-
-$"??0Data at foo@@QEAA at XZ" = comdat any
-
$"?comdat@?$A at X@@2HB" = comdat any
-$"?DataStaticTLS at Data@foo@@2HA" = comdat any
-
-$"?DataStatic at Data@foo@@2HA" = comdat any
-
@"?first@@3HA" = dso_local global i32 0, align 4, !dbg !0
-@"?comdat@?$A at X@@2HB" = linkonce_odr dso_local constant i32 3, comdat, align 4, !dbg !17
-@"?middle@@3PEBHEB" = dso_local thread_local global i32* @"?comdat@?$A at X@@2HB", align 8, !dbg !24
-@"?globalTLS at foo@@3HA" = dso_local thread_local global i32 4, align 4, !dbg !27
-@"?justGlobal at foo@@3HA" = dso_local global i32 6, align 4, !dbg !29
-@"?last@@3HA" = dso_local global i32 0, align 4, !dbg !31
-@"?globalStatic at foo@@3HA" = internal global i32 7, align 4, !dbg !43
-@"?staticTLS at foo@@3HA" = internal thread_local global i32 5, align 4, !dbg !45
-@"?DataStaticTLS at Data@foo@@2HA" = linkonce_odr dso_local thread_local global i32 11, comdat, align 4, !dbg !37
-@"?DataStatic at Data@foo@@2HA" = linkonce_odr dso_local global i32 13, comdat, align 4, !dbg !39
-
-; Function Attrs: noinline nounwind optnone uwtable
-define dso_local i32 @"?bar@@YAHXZ"() #0 !dbg !54 {
-entry:
- %D = alloca %"struct.foo::Data", align 4
- %L = alloca %struct.Local, align 4
- call void @llvm.dbg.declare(metadata %"struct.foo::Data"* %D, metadata !57, metadata !DIExpression()), !dbg !58
- %call = call %"struct.foo::Data"* @"??0Data at foo@@QEAA at XZ"(%"struct.foo::Data"* %D) #2, !dbg !58
- call void @llvm.dbg.declare(metadata %struct.Local* %L, metadata !59, metadata !DIExpression()), !dbg !64
- %call1 = call %struct.Local* @"??0Local@?1??bar@@YAHXZ at QEAA@XZ"(%struct.Local* %L) #2, !dbg !64
- %0 = load i32, i32* @"?globalStatic at foo@@3HA", align 4, !dbg !65
- %1 = load i32, i32* @"?globalTLS at foo@@3HA", align 4, !dbg !65
- %add = add nsw i32 %0, %1, !dbg !65
- %2 = load i32, i32* @"?staticTLS at foo@@3HA", align 4, !dbg !65
- %add2 = add nsw i32 %add, %2, !dbg !65
- %3 = load i32, i32* @"?justGlobal at foo@@3HA", align 4, !dbg !65
- %add3 = add nsw i32 %add2, %3, !dbg !65
- %4 = load i32, i32* @"?globalStatic at foo@@3HA", align 4, !dbg !65
- %add4 = add nsw i32 %add3, %4, !dbg !65
- %add5 = add nsw i32 %add4, 8, !dbg !65
- %add6 = add nsw i32 %add5, 9, !dbg !65
- %5 = load i32, i32* @"?DataStaticTLS at Data@foo@@2HA", align 4, !dbg !65
- %add7 = add nsw i32 %add6, %5, !dbg !65
- %DataGlobal = getelementptr inbounds %"struct.foo::Data", %"struct.foo::Data"* %D, i32 0, i32 0, !dbg !65
- %6 = load i32, i32* %DataGlobal, align 4, !dbg !65
- %add8 = add nsw i32 %add7, %6, !dbg !65
- %7 = load i32, i32* @"?DataStatic at Data@foo@@2HA", align 4, !dbg !65
- %add9 = add nsw i32 %add8, %7, !dbg !65
- %add10 = add nsw i32 %add9, 14, !dbg !65
- %DataConstVal = getelementptr inbounds %"struct.foo::Data", %"struct.foo::Data"* %D, i32 0, i32 1, !dbg !65
- %8 = load i32, i32* %DataConstVal, align 4, !dbg !65
- %add11 = add nsw i32 %add10, %8, !dbg !65
- %LocalGlobal = getelementptr inbounds %struct.Local, %struct.Local* %L, i32 0, i32 0, !dbg !65
- %9 = load i32, i32* %LocalGlobal, align 4, !dbg !65
- %add12 = add nsw i32 %add11, %9, !dbg !65
- %LocalConstVal = getelementptr inbounds %struct.Local, %struct.Local* %L, i32 0, i32 1, !dbg !65
- %10 = load i32, i32* %LocalConstVal, align 4, !dbg !65
- %add13 = add nsw i32 %add12, %10, !dbg !65
- ret i32 %add13, !dbg !65
-}
-
-; Function Attrs: nounwind readnone speculatable willreturn
-declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
-
-; Function Attrs: noinline nounwind optnone uwtable
-define linkonce_odr dso_local %"struct.foo::Data"* @"??0Data at foo@@QEAA at XZ"(%"struct.foo::Data"* returned %this) unnamed_addr #0 comdat align 2 !dbg !66 {
-entry:
- %this.addr = alloca %"struct.foo::Data"*, align 8
- store %"struct.foo::Data"* %this, %"struct.foo::Data"** %this.addr, align 8
- call void @llvm.dbg.declare(metadata %"struct.foo::Data"** %this.addr, metadata !71, metadata !DIExpression()), !dbg !73
- %this1 = load %"struct.foo::Data"*, %"struct.foo::Data"** %this.addr, align 8
- %DataGlobal = getelementptr inbounds %"struct.foo::Data", %"struct.foo::Data"* %this1, i32 0, i32 0, !dbg !74
- store i32 12, i32* %DataGlobal, align 4, !dbg !74
- %DataConstVal = getelementptr inbounds %"struct.foo::Data", %"struct.foo::Data"* %this1, i32 0, i32 1, !dbg !74
- store i32 15, i32* %DataConstVal, align 4, !dbg !74
- ret %"struct.foo::Data"* %this1, !dbg !74
-}
+@"?comdat@?$A at X@@2HB" = linkonce_odr dso_local constant i32 3, comdat, align 4, !dbg !6
+@"?middle@@3PEBHEB" = dso_local thread_local global i32* @"?comdat@?$A at X@@2HB", align 8, !dbg !15
+@"?globalTLS at foo@@3HA" = dso_local thread_local global i32 4, align 4, !dbg !18
+@"?justGlobal at foo@@3HA" = dso_local global i32 6, align 4, !dbg !21
+@"?last@@3HA" = dso_local global i32 0, align 4, !dbg !23
+@"?globalStatic at foo@@3HA" = internal global i32 7, align 4, !dbg !25
+@"?staticTLS at foo@@3HA" = internal thread_local global i32 5, align 4, !dbg !27
; Function Attrs: noinline nounwind optnone uwtable
-define internal %struct.Local* @"??0Local@?1??bar@@YAHXZ at QEAA@XZ"(%struct.Local* returned %this) unnamed_addr #0 align 2 !dbg !75 {
+define dso_local i32 @"?bar@@YAHXZ"() #0 !dbg !36 {
entry:
- %this.addr = alloca %struct.Local*, align 8
- store %struct.Local* %this, %struct.Local** %this.addr, align 8
- call void @llvm.dbg.declare(metadata %struct.Local** %this.addr, metadata !80, metadata !DIExpression()), !dbg !82
- %this1 = load %struct.Local*, %struct.Local** %this.addr, align 8
- %LocalGlobal = getelementptr inbounds %struct.Local, %struct.Local* %this1, i32 0, i32 0, !dbg !83
- store i32 12, i32* %LocalGlobal, align 4, !dbg !83
- %LocalConstVal = getelementptr inbounds %struct.Local, %struct.Local* %this1, i32 0, i32 1, !dbg !83
- store i32 15, i32* %LocalConstVal, align 4, !dbg !83
- ret %struct.Local* %this1, !dbg !83
+ %0 = load i32, i32* @"?globalStatic at foo@@3HA", align 4, !dbg !39
+ %1 = load i32, i32* @"?globalTLS at foo@@3HA", align 4, !dbg !39
+ %add = add nsw i32 %0, %1, !dbg !39
+ %2 = load i32, i32* @"?staticTLS at foo@@3HA", align 4, !dbg !39
+ %add1 = add nsw i32 %add, %2, !dbg !39
+ ret i32 %add1, !dbg !39
}
attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #1 = { nounwind readnone speculatable willreturn }
-attributes #2 = { nounwind }
!llvm.dbg.cu = !{!2}
-!llvm.linker.options = !{!47, !48}
-!llvm.module.flags = !{!49, !50, !51, !52}
-!llvm.ident = !{!53}
+!llvm.linker.options = !{!29, !30}
+!llvm.module.flags = !{!31, !32, !33, !34}
+!llvm.ident = !{!35}
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
-!1 = distinct !DIGlobalVariable(name: "first", linkageName: "?first@@3HA", scope: !2, file: !3, line: 1, type: !10, isLocal: false, isDefinition: true)
-!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 11.0.0 (https://github.com/llvm/llvm-project.git 202f144bffd0be254a829924195e1b8ebabcbb79)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !5, globals: !16, nameTableKind: None)
-!3 = !DIFile(filename: "a.cpp", directory: "F:\\llvm-project\\__test", checksumkind: CSK_MD5, checksum: "ae8137877dbd6fb10cfa1fc9ea4a39ca")
+!1 = distinct !DIGlobalVariable(name: "first", linkageName: "?first@@3HA", scope: !2, file: !3, line: 1, type: !9, isLocal: false, isDefinition: true)
+!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 11.0.0 (https://github.com/llvm/llvm-project.git f5b1301ce8575f6d82e87031a1a5485c33637a93)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None)
+!3 = !DIFile(filename: "a.cpp", directory: "F:\\llvm-project\\__test", checksumkind: CSK_MD5, checksum: "65c2a7701cffb7a2e8d4caf1cc24caa7")
!4 = !{}
-!5 = !{!6}
-!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Data", scope: !7, file: !3, line: 15, size: 64, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !8, identifier: ".?AUData at foo@@")
-!7 = !DINamespace(name: "foo", scope: null)
-!8 = !{!9, !11, !12, !13, !15}
-!9 = !DIDerivedType(tag: DW_TAG_member, name: "DataStaticTLS", scope: !6, file: !3, line: 16, baseType: !10, flags: DIFlagStaticMember, extraData: i32 11)
-!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
-!11 = !DIDerivedType(tag: DW_TAG_member, name: "DataGlobal", scope: !6, file: !3, line: 17, baseType: !10, size: 32)
-!12 = !DIDerivedType(tag: DW_TAG_member, name: "DataStatic", scope: !6, file: !3, line: 18, baseType: !10, flags: DIFlagStaticMember, extraData: i32 13)
-!13 = !DIDerivedType(tag: DW_TAG_member, name: "DataConstExpr", scope: !6, file: !3, line: 19, baseType: !14, flags: DIFlagStaticMember, extraData: i32 14)
-!14 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !10)
-!15 = !DIDerivedType(tag: DW_TAG_member, name: "DataConstVal", scope: !6, file: !3, line: 20, baseType: !14, size: 32, offset: 32)
-!16 = !{!0, !17, !24, !27, !29, !31, !33, !35, !37, !39, !41, !43, !45}
-!17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression())
-!18 = distinct !DIGlobalVariable(name: "comdat", linkageName: "?comdat@?$A at X@@2HB", scope: !2, file: !3, line: 3, type: !14, isLocal: false, isDefinition: true, declaration: !19)
-!19 = !DIDerivedType(tag: DW_TAG_member, name: "comdat", scope: !20, file: !3, line: 3, baseType: !14, flags: DIFlagStaticMember, extraData: i32 3)
-!20 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A<void>", file: !3, line: 3, size: 8, flags: DIFlagTypePassByValue, elements: !21, templateParams: !22, identifier: ".?AU?$A at X@@")
-!21 = !{!19}
-!22 = !{!23}
-!23 = !DITemplateTypeParameter(name: "T", type: null)
-!24 = !DIGlobalVariableExpression(var: !25, expr: !DIExpression())
-!25 = distinct !DIGlobalVariable(name: "middle", linkageName: "?middle@@3PEBHEB", scope: !2, file: !3, line: 5, type: !26, isLocal: false, isDefinition: true)
-!26 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !14, size: 64)
+!5 = !{!0, !6, !15, !18, !21, !23, !25, !27}
+!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
+!7 = distinct !DIGlobalVariable(name: "comdat", linkageName: "?comdat@?$A at X@@2HB", scope: !2, file: !3, line: 2, type: !8, isLocal: false, isDefinition: true, declaration: !10)
+!8 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !9)
+!9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!10 = !DIDerivedType(tag: DW_TAG_member, name: "comdat", scope: !11, file: !3, line: 2, baseType: !8, flags: DIFlagStaticMember, extraData: i32 3)
+!11 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A<void>", file: !3, line: 2, size: 8, flags: DIFlagTypePassByValue, elements: !12, templateParams: !13, identifier: ".?AU?$A at X@@")
+!12 = !{!10}
+!13 = !{!14}
+!14 = !DITemplateTypeParameter(name: "T", type: null)
+!15 = !DIGlobalVariableExpression(var: !16, expr: !DIExpression())
+!16 = distinct !DIGlobalVariable(name: "middle", linkageName: "?middle@@3PEBHEB", scope: !2, file: !3, line: 3, type: !17, isLocal: false, isDefinition: true)
+!17 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 64)
+!18 = !DIGlobalVariableExpression(var: !19, expr: !DIExpression())
+!19 = distinct !DIGlobalVariable(name: "globalTLS", linkageName: "?globalTLS at foo@@3HA", scope: !20, file: !3, line: 5, type: !9, isLocal: false, isDefinition: true)
+!20 = !DINamespace(name: "foo", scope: null)
+!21 = !DIGlobalVariableExpression(var: !22, expr: !DIExpression())
+!22 = distinct !DIGlobalVariable(name: "justGlobal", linkageName: "?justGlobal at foo@@3HA", scope: !20, file: !3, line: 7, type: !9, isLocal: false, isDefinition: true)
+!23 = !DIGlobalVariableExpression(var: !24, expr: !DIExpression())
+!24 = distinct !DIGlobalVariable(name: "last", linkageName: "?last@@3HA", scope: !2, file: !3, line: 10, type: !9, isLocal: false, isDefinition: true)
+!25 = !DIGlobalVariableExpression(var: !26, expr: !DIExpression())
+!26 = distinct !DIGlobalVariable(name: "globalStatic", linkageName: "?globalStatic at foo@@3HA", scope: !20, file: !3, line: 8, type: !9, isLocal: true, isDefinition: true)
!27 = !DIGlobalVariableExpression(var: !28, expr: !DIExpression())
-!28 = distinct !DIGlobalVariable(name: "globalTLS", linkageName: "?globalTLS at foo@@3HA", scope: !7, file: !3, line: 8, type: !10, isLocal: false, isDefinition: true)
-!29 = !DIGlobalVariableExpression(var: !30, expr: !DIExpression())
-!30 = distinct !DIGlobalVariable(name: "justGlobal", linkageName: "?justGlobal at foo@@3HA", scope: !7, file: !3, line: 10, type: !10, isLocal: false, isDefinition: true)
-!31 = !DIGlobalVariableExpression(var: !32, expr: !DIExpression())
-!32 = distinct !DIGlobalVariable(name: "last", linkageName: "?last@@3HA", scope: !2, file: !3, line: 24, type: !10, isLocal: false, isDefinition: true)
-!33 = !DIGlobalVariableExpression(var: !34, expr: !DIExpression(DW_OP_constu, 8, DW_OP_stack_value))
-!34 = distinct !DIGlobalVariable(name: "constExpr", scope: !7, file: !3, line: 12, type: !14, isLocal: true, isDefinition: true)
-!35 = !DIGlobalVariableExpression(var: !36, expr: !DIExpression(DW_OP_constu, 9, DW_OP_stack_value))
-!36 = distinct !DIGlobalVariable(name: "constVal", scope: !7, file: !3, line: 13, type: !14, isLocal: true, isDefinition: true)
-!37 = !DIGlobalVariableExpression(var: !38, expr: !DIExpression())
-!38 = distinct !DIGlobalVariable(name: "DataStaticTLS", linkageName: "?DataStaticTLS at Data@foo@@2HA", scope: !2, file: !3, line: 16, type: !10, isLocal: false, isDefinition: true, declaration: !9)
-!39 = !DIGlobalVariableExpression(var: !40, expr: !DIExpression())
-!40 = distinct !DIGlobalVariable(name: "DataStatic", linkageName: "?DataStatic at Data@foo@@2HA", scope: !2, file: !3, line: 18, type: !10, isLocal: false, isDefinition: true, declaration: !12)
-!41 = !DIGlobalVariableExpression(var: !42, expr: !DIExpression(DW_OP_constu, 14, DW_OP_stack_value))
-!42 = distinct !DIGlobalVariable(name: "DataConstExpr", scope: !2, file: !3, line: 19, type: !14, isLocal: true, isDefinition: true, declaration: !13)
-!43 = !DIGlobalVariableExpression(var: !44, expr: !DIExpression())
-!44 = distinct !DIGlobalVariable(name: "globalStatic", linkageName: "?globalStatic at foo@@3HA", scope: !7, file: !3, line: 11, type: !10, isLocal: true, isDefinition: true)
-!45 = !DIGlobalVariableExpression(var: !46, expr: !DIExpression())
-!46 = distinct !DIGlobalVariable(name: "staticTLS", linkageName: "?staticTLS at foo@@3HA", scope: !7, file: !3, line: 9, type: !10, isLocal: true, isDefinition: true)
-!47 = !{!"/DEFAULTLIB:libcmt.lib"}
-!48 = !{!"/DEFAULTLIB:oldnames.lib"}
-!49 = !{i32 2, !"CodeView", i32 1}
-!50 = !{i32 2, !"Debug Info Version", i32 3}
-!51 = !{i32 1, !"wchar_size", i32 2}
-!52 = !{i32 7, !"PIC Level", i32 2}
-!53 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git 202f144bffd0be254a829924195e1b8ebabcbb79)"}
-!54 = distinct !DISubprogram(name: "bar", linkageName: "?bar@@YAHXZ", scope: !3, file: !3, line: 26, type: !55, scopeLine: 26, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4)
-!55 = !DISubroutineType(types: !56)
-!56 = !{!10}
-!57 = !DILocalVariable(name: "D", scope: !54, file: !3, line: 31, type: !6)
-!58 = !DILocation(line: 31, scope: !54)
-!59 = !DILocalVariable(name: "L", scope: !54, file: !3, line: 32, type: !60)
-!60 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Local", scope: !54, file: !3, line: 27, size: 64, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !61, identifier: ".?AULocal@?1??bar@@YAHXZ@")
-!61 = !{!62, !63}
-!62 = !DIDerivedType(tag: DW_TAG_member, name: "LocalGlobal", scope: !60, file: !3, line: 28, baseType: !10, size: 32)
-!63 = !DIDerivedType(tag: DW_TAG_member, name: "LocalConstVal", scope: !60, file: !3, line: 29, baseType: !14, size: 32, offset: 32)
-!64 = !DILocation(line: 32, scope: !54)
-!65 = !DILocation(line: 33, scope: !54)
-!66 = distinct !DISubprogram(name: "Data", linkageName: "??0Data at foo@@QEAA at XZ", scope: !6, file: !3, line: 15, type: !67, scopeLine: 15, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, declaration: !70, retainedNodes: !4)
-!67 = !DISubroutineType(types: !68)
-!68 = !{null, !69}
-!69 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !6, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
-!70 = !DISubprogram(name: "Data", scope: !6, type: !67, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: 0)
-!71 = !DILocalVariable(name: "this", arg: 1, scope: !66, type: !72, flags: DIFlagArtificial | DIFlagObjectPointer)
-!72 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !6, size: 64)
-!73 = !DILocation(line: 0, scope: !66)
-!74 = !DILocation(line: 15, scope: !66)
-!75 = distinct !DISubprogram(name: "Local", linkageName: "??0Local@?1??bar@@YAHXZ at QEAA@XZ", scope: !60, file: !3, line: 27, type: !76, scopeLine: 27, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !2, declaration: !79, retainedNodes: !4)
-!76 = !DISubroutineType(types: !77)
-!77 = !{null, !78}
-!78 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !60, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
-!79 = !DISubprogram(name: "Local", scope: !60, type: !76, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: 0)
-!80 = !DILocalVariable(name: "this", arg: 1, scope: !75, type: !81, flags: DIFlagArtificial | DIFlagObjectPointer)
-!81 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !60, size: 64)
-!82 = !DILocation(line: 0, scope: !75)
-!83 = !DILocation(line: 27, scope: !75)
+!28 = distinct !DIGlobalVariable(name: "staticTLS", linkageName: "?staticTLS at foo@@3HA", scope: !20, file: !3, line: 6, type: !9, isLocal: true, isDefinition: true)
+!29 = !{!"/DEFAULTLIB:libcmt.lib"}
+!30 = !{!"/DEFAULTLIB:oldnames.lib"}
+!31 = !{i32 2, !"CodeView", i32 1}
+!32 = !{i32 2, !"Debug Info Version", i32 3}
+!33 = !{i32 1, !"wchar_size", i32 2}
+!34 = !{i32 7, !"PIC Level", i32 2}
+!35 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git f5b1301ce8575f6d82e87031a1a5485c33637a93)"}
+!36 = distinct !DISubprogram(name: "bar", linkageName: "?bar@@YAHXZ", scope: !3, file: !3, line: 11, type: !37, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4)
+!37 = !DISubroutineType(types: !38)
+!38 = !{!9}
+!39 = !DILocation(line: 12, scope: !36)
diff --git a/llvm/test/DebugInfo/COFF/types-array-unsized.ll b/llvm/test/DebugInfo/COFF/types-array-unsized.ll
index 020ae15bf008..abfcbbfebd32 100644
--- a/llvm/test/DebugInfo/COFF/types-array-unsized.ll
+++ b/llvm/test/DebugInfo/COFF/types-array-unsized.ll
@@ -4,7 +4,7 @@
; We should emit two array types: one used to describe the static data member,
; and the other used by the S_GDATA32 for the definition.
-; // Build with: clang-cl a.cpp /c /Z7 /clang:-S /clang:-emit-llvm
+; C++ source:
; struct Foo {
; static const char str[];
; };
@@ -12,6 +12,13 @@
; Foo f; // FIXME: only needed to force emit 'Foo'
; CHECK: CodeViewTypes [
+; CHECK: Array ([[ARRAY_COMPLETE:0x.*]]) {
+; CHECK-NEXT: TypeLeafKind: LF_ARRAY (0x1503)
+; CHECK-NEXT: ElementType: const char ({{.*}})
+; CHECK-NEXT: IndexType: unsigned __int64 (0x23)
+; CHECK-NEXT: SizeOf: 5
+; CHECK-NEXT: Name:
+; CHECK-NEXT: }
; CHECK: Array ([[ARRAY_FWD:0x.*]]) {
; CHECK-NEXT: TypeLeafKind: LF_ARRAY (0x1503)
; CHECK-NEXT: ElementType: const char ({{.*}})
@@ -19,7 +26,7 @@
; CHECK-NEXT: SizeOf: 0
; CHECK-NEXT: Name:
; CHECK-NEXT: }
-; CHECK: FieldList (0x1003) {
+; CHECK: FieldList (0x1004) {
; CHECK-NEXT: TypeLeafKind: LF_FIELDLIST (0x1203)
; CHECK-NEXT: StaticDataMember {
; CHECK-NEXT: TypeLeafKind: LF_STMEMBER (0x150E)
@@ -28,47 +35,39 @@
; CHECK-NEXT: Name: str
; CHECK-NEXT: }
; CHECK-NEXT: }
-; CHECK: Array ([[ARRAY_COMPLETE:0x.*]]) {
-; CHECK-NEXT: TypeLeafKind: LF_ARRAY (0x1503)
-; CHECK-NEXT: ElementType: const char ({{.*}})
-; CHECK-NEXT: IndexType: unsigned __int64 (0x23)
-; CHECK-NEXT: SizeOf: 5
-; CHECK-NEXT: Name:
-; CHECK-NEXT: }
; CHECK: ]
; CHECK: GlobalData {
; CHECK-NEXT: Kind: S_GDATA32 (0x110D)
; CHECK-NEXT: DataOffset: ?str at Foo@@2QBDB+0x0
; CHECK-NEXT: Type: [[ARRAY_COMPLETE]]
-; CHECK-NEXT: DisplayName: Foo::str
+; CHECK-NEXT: DisplayName: str
; CHECK-NEXT: LinkageName: ?str at Foo@@2QBDB
; CHECK-NEXT: }
-; ModuleID = 'a.cpp'
-source_filename = "a.cpp"
-target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-pc-windows-msvc19.25.28614"
+; ModuleID = 't.cpp'
+source_filename = "t.cpp"
+target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc19.0.24215"
%struct.Foo = type { i8 }
-@"?str at Foo@@2QBDB" = dso_local constant [5 x i8] c"asdf\00", align 1, !dbg !0
-@"?f@@3UFoo@@A" = dso_local global %struct.Foo zeroinitializer, align 1, !dbg !6
+@"\01?str at Foo@@2QBDB" = constant [5 x i8] c"asdf\00", align 1, !dbg !0
+@"\01?f@@3UFoo@@A" = global %struct.Foo zeroinitializer, align 1, !dbg !6
!llvm.dbg.cu = !{!2}
-!llvm.linker.options = !{!19, !20}
-!llvm.module.flags = !{!21, !22, !23, !24}
-!llvm.ident = !{!25}
+!llvm.module.flags = !{!19, !20, !21, !22}
+!llvm.ident = !{!23}
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
-!1 = distinct !DIGlobalVariable(name: "str", linkageName: "?str at Foo@@2QBDB", scope: !2, file: !3, line: 4, type: !16, isLocal: false, isDefinition: true, declaration: !10)
-!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 11.0.0 (https://github.com/llvm/llvm-project.git 202f144bffd0be254a829924195e1b8ebabcbb79)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None)
-!3 = !DIFile(filename: "a.cpp", directory: "F:\\llvm-project\\__test", checksumkind: CSK_MD5, checksum: "c2b2d28fd8aaa040c4141cea420d0648")
+!1 = distinct !DIGlobalVariable(name: "str", linkageName: "\01?str at Foo@@2QBDB", scope: !2, file: !3, line: 4, type: !16, isLocal: false, isDefinition: true, declaration: !10)
+!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 6.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
+!3 = !DIFile(filename: "t.cpp", directory: "C:\5Csrc\5Cllvm-project\5Cbuild", checksumkind: CSK_MD5, checksum: "15aa843c5a80301928caf03e71f87a54")
!4 = !{}
!5 = !{!0, !6}
!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
-!7 = distinct !DIGlobalVariable(name: "f", linkageName: "?f@@3UFoo@@A", scope: !2, file: !3, line: 5, type: !8, isLocal: false, isDefinition: true)
-!8 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo", file: !3, line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !9, identifier: ".?AUFoo@@")
+!7 = distinct !DIGlobalVariable(name: "f", linkageName: "\01?f@@3UFoo@@A", scope: !2, file: !3, line: 5, type: !8, isLocal: false, isDefinition: true)
+!8 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Foo", file: !3, line: 1, size: 8, elements: !9, identifier: ".?AUFoo@@")
!9 = !{!10}
!10 = !DIDerivedType(tag: DW_TAG_member, name: "str", scope: !8, file: !3, line: 2, baseType: !11, flags: DIFlagStaticMember)
!11 = !DICompositeType(tag: DW_TAG_array_type, baseType: !12, elements: !14)
@@ -79,10 +78,8 @@ target triple = "x86_64-pc-windows-msvc19.25.28614"
!16 = !DICompositeType(tag: DW_TAG_array_type, baseType: !12, size: 40, elements: !17)
!17 = !{!18}
!18 = !DISubrange(count: 5)
-!19 = !{!"/DEFAULTLIB:libcmt.lib"}
-!20 = !{!"/DEFAULTLIB:oldnames.lib"}
-!21 = !{i32 2, !"CodeView", i32 1}
-!22 = !{i32 2, !"Debug Info Version", i32 3}
-!23 = !{i32 1, !"wchar_size", i32 2}
-!24 = !{i32 7, !"PIC Level", i32 2}
-!25 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git 202f144bffd0be254a829924195e1b8ebabcbb79)"}
+!19 = !{i32 2, !"CodeView", i32 1}
+!20 = !{i32 2, !"Debug Info Version", i32 3}
+!21 = !{i32 1, !"wchar_size", i32 2}
+!22 = !{i32 7, !"PIC Level", i32 2}
+!23 = !{!"clang version 6.0.0 "}
More information about the lldb-commits
mailing list