llvm.org GIT mirror llvm / fff44e6
Emit template type and value parameter DIEs for template variables. Summary: Ensure the TemplateParam attribute of the DIGlobalVariable node is translated into the proper DIEs. Resolves https://bugs.llvm.org/show_bug.cgi?id=22119 Reviewers: dblaikie, probinson, aprantl, JDevlieghere, clayborg, whitequark, deadalnix Reviewed By: dblaikie Subscribers: llvm-commits Tags: #debug-info Differential Revision: https://reviews.llvm.org/D52057 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343706 91177308-0d34-0410-b5e6-96231b3b80d8 Matthew Voss 1 year, 9 months ago
16 changed file(s) with 252 addition(s) and 205 deletion(s). Raw diff Collapse all Expand all
582582 DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
583583 unsigned LineNo, DIType *Ty, bool isLocalToUnit,
584584 DIExpression *Expr = nullptr, MDNode *Decl = nullptr,
585 uint32_t AlignInBits = 0);
585 MDTuple *templateParams = nullptr, uint32_t AlignInBits = 0);
586586
587587 /// Identical to createGlobalVariable
588588 /// except that the resulting DbgNode is temporary and meant to be RAUWed.
589589 DIGlobalVariable *createTempGlobalVariableFwdDecl(
590590 DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
591591 unsigned LineNo, DIType *Ty, bool isLocalToUnit, MDNode *Decl = nullptr,
592 uint32_t AlignInBits = 0);
592 MDTuple *templateParams = nullptr, uint32_t AlignInBits = 0);
593593
594594 /// Create a new descriptor for an auto variable. This is a local variable
595595 /// that is not a subprogram parameter.
25332533 IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition) {}
25342534 ~DIGlobalVariable() = default;
25352535
2536 static DIGlobalVariable *getImpl(LLVMContext &Context, DIScope *Scope,
2537 StringRef Name, StringRef LinkageName,
2538 DIFile *File, unsigned Line, DITypeRef Type,
2539 bool IsLocalToUnit, bool IsDefinition,
2540 DIDerivedType *StaticDataMemberDeclaration,
2541 uint32_t AlignInBits, StorageType Storage,
2542 bool ShouldCreate = true) {
2536 static DIGlobalVariable *
2537 getImpl(LLVMContext &Context, DIScope *Scope, StringRef Name,
2538 StringRef LinkageName, DIFile *File, unsigned Line, DITypeRef Type,
2539 bool IsLocalToUnit, bool IsDefinition,
2540 DIDerivedType *StaticDataMemberDeclaration, MDTuple *TemplateParams,
2541 uint32_t AlignInBits, StorageType Storage, bool ShouldCreate = true) {
25432542 return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
25442543 getCanonicalMDString(Context, LinkageName), File, Line, Type,
25452544 IsLocalToUnit, IsDefinition, StaticDataMemberDeclaration,
2546 AlignInBits, Storage, ShouldCreate);
2545 cast_or_null(TemplateParams), AlignInBits, Storage,
2546 ShouldCreate);
25472547 }
25482548 static DIGlobalVariable *
25492549 getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
25502550 MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
25512551 bool IsLocalToUnit, bool IsDefinition,
2552 Metadata *StaticDataMemberDeclaration, uint32_t AlignInBits,
2553 StorageType Storage, bool ShouldCreate = true);
2552 Metadata *StaticDataMemberDeclaration, Metadata *TemplateParams,
2553 uint32_t AlignInBits, StorageType Storage, bool ShouldCreate = true);
25542554
25552555 TempDIGlobalVariable cloneImpl() const {
25562556 return getTemporary(getContext(), getScope(), getName(), getLinkageName(),
25572557 getFile(), getLine(), getType(), isLocalToUnit(),
25582558 isDefinition(), getStaticDataMemberDeclaration(),
2559 getAlignInBits());
2559 getTemplateParams(), getAlignInBits());
25602560 }
25612561
25622562 public:
25652565 DIFile *File, unsigned Line, DITypeRef Type,
25662566 bool IsLocalToUnit, bool IsDefinition,
25672567 DIDerivedType *StaticDataMemberDeclaration,
2568 uint32_t AlignInBits),
2568 MDTuple *TemplateParams, uint32_t AlignInBits),
25692569 (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
2570 IsDefinition, StaticDataMemberDeclaration, AlignInBits))
2570 IsDefinition, StaticDataMemberDeclaration, TemplateParams,
2571 AlignInBits))
25712572 DEFINE_MDNODE_GET(DIGlobalVariable,
25722573 (Metadata * Scope, MDString *Name, MDString *LinkageName,
25732574 Metadata *File, unsigned Line, Metadata *Type,
25742575 bool IsLocalToUnit, bool IsDefinition,
25752576 Metadata *StaticDataMemberDeclaration,
2576 uint32_t AlignInBits),
2577 Metadata *TemplateParams, uint32_t AlignInBits),
25772578 (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
2578 IsDefinition, StaticDataMemberDeclaration, AlignInBits))
2579 IsDefinition, StaticDataMemberDeclaration, TemplateParams,
2580 AlignInBits))
25792581
25802582 TempDIGlobalVariable clone() const { return cloneImpl(); }
25812583
25892591
25902592 MDString *getRawLinkageName() const { return getOperandAs(5); }
25912593 Metadata *getRawStaticDataMemberDeclaration() const { return getOperand(6); }
2594 Metadata *getRawTemplateParams() const { return getOperand(7); }
2595 MDTuple *getTemplateParams() const { return getOperandAs(7); }
25922596
25932597 static bool classof(const Metadata *MD) {
25942598 return MD->getMetadataID() == DIGlobalVariableKind;
10061006 * \param Expr The location of the global relative to the attached
10071007 * GlobalVariable.
10081008 * \param Decl Reference to the corresponding declaration.
1009 * variables.
10091010 * \param AlignInBits Variable alignment(or 0 if no alignment attr was
10101011 * specified)
10111012 */
1012 LLVMMetadataRef
1013 LLVMDIBuilderCreateGlobalVariableExpression(LLVMDIBuilderRef Builder,
1014 LLVMMetadataRef Scope,
1015 const char *Name, size_t NameLen,
1016 const char *Linkage, size_t LinkLen,
1017 LLVMMetadataRef File,
1018 unsigned LineNo,
1019 LLVMMetadataRef Ty,
1020 LLVMBool LocalToUnit,
1021 LLVMMetadataRef Expr,
1022 LLVMMetadataRef Decl,
1023 uint32_t AlignInBits);
1013 LLVMMetadataRef LLVMDIBuilderCreateGlobalVariableExpression(
1014 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
1015 size_t NameLen, const char *Linkage, size_t LinkLen, LLVMMetadataRef File,
1016 unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit,
1017 LLVMMetadataRef Expr, LLVMMetadataRef Decl, uint32_t AlignInBits);
10241018 /**
10251019 * Create a new temporary \c MDNode. Suitable for use in constructing cyclic
10261020 * \c MDNode structures. A temporary \c MDNode is not uniqued, may be RAUW'd,
10661060 * \param AlignInBits Variable alignment(or 0 if no alignment attr was
10671061 * specified)
10681062 */
1069 LLVMMetadataRef
1070 LLVMDIBuilderCreateTempGlobalVariableFwdDecl(LLVMDIBuilderRef Builder,
1071 LLVMMetadataRef Scope,
1072 const char *Name, size_t NameLen,
1073 const char *Linkage, size_t LnkLen,
1074 LLVMMetadataRef File,
1075 unsigned LineNo,
1076 LLVMMetadataRef Ty,
1077 LLVMBool LocalToUnit,
1078 LLVMMetadataRef Decl,
1079 uint32_t AlignInBits);
1063 LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl(
1064 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
1065 size_t NameLen, const char *Linkage, size_t LnkLen, LLVMMetadataRef File,
1066 unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit,
1067 LLVMMetadataRef Decl, uint32_t AlignInBits);
10801068
10811069 /**
10821070 * Insert a new llvm.dbg.declare intrinsic call before the given instruction.
46634663 /// ParseDIGlobalVariable:
46644664 /// ::= !DIGlobalVariable(scope: !0, name: "foo", linkageName: "foo",
46654665 /// file: !1, line: 7, type: !2, isLocal: false,
4666 /// isDefinition: true, declaration: !3, align: 8)
4666 /// isDefinition: true, templateParams: !3,
4667 /// declaration: !4, align: 8)
46674668 bool LLParser::ParseDIGlobalVariable(MDNode *&Result, bool IsDistinct) {
46684669 #define VISIT_MD_FIELDS(OPTIONAL, REQUIRED) \
46694670 REQUIRED(name, MDStringField, (/* AllowEmpty */ false)); \
46744675 OPTIONAL(type, MDField, ); \
46754676 OPTIONAL(isLocal, MDBoolField, ); \
46764677 OPTIONAL(isDefinition, MDBoolField, (true)); \
4678 OPTIONAL(templateParams, MDField, ); \
46774679 OPTIONAL(declaration, MDField, ); \
46784680 OPTIONAL(align, MDUnsignedField, (0, UINT32_MAX));
46794681 PARSE_MD_FIELDS();
46804682 #undef VISIT_MD_FIELDS
46814683
4682 Result = GET_OR_DISTINCT(DIGlobalVariable,
4683 (Context, scope.Val, name.Val, linkageName.Val,
4684 file.Val, line.Val, type.Val, isLocal.Val,
4685 isDefinition.Val, declaration.Val, align.Val));
4684 Result =
4685 GET_OR_DISTINCT(DIGlobalVariable,
4686 (Context, scope.Val, name.Val, linkageName.Val, file.Val,
4687 line.Val, type.Val, isLocal.Val, isDefinition.Val,
4688 declaration.Val, templateParams.Val, align.Val));
46864689 return false;
46874690 }
46884691
15611561 break;
15621562 }
15631563 case bitc::METADATA_GLOBAL_VAR: {
1564 if (Record.size() < 11 || Record.size() > 12)
1564 if (Record.size() < 11 || Record.size() > 13)
15651565 return error("Invalid record");
15661566
15671567 IsDistinct = Record[0] & 1;
15681568 unsigned Version = Record[0] >> 1;
15691569
1570 if (Version == 1) {
1570 if (Version == 2) {
1571 MetadataList.assignValue(
1572 GET_OR_DISTINCT(
1573 DIGlobalVariable,
1574 (Context, getMDOrNull(Record[1]), getMDString(Record[2]),
1575 getMDString(Record[3]), getMDOrNull(Record[4]), Record[5],
1576 getDITypeRefOrNull(Record[6]), Record[7], Record[8],
1577 getMDOrNull(Record[9]), getMDOrNull(Record[10]), Record[11])),
1578 NextMetadataNo);
1579
1580 NextMetadataNo++;
1581 } else if (Version == 1) {
1582 // No upgrade necessary. A null field will be introduced to indicate
1583 // that no parameter information is available.
15711584 MetadataList.assignValue(
15721585 GET_OR_DISTINCT(DIGlobalVariable,
15731586 (Context, getMDOrNull(Record[1]),
15741587 getMDString(Record[2]), getMDString(Record[3]),
15751588 getMDOrNull(Record[4]), Record[5],
15761589 getDITypeRefOrNull(Record[6]), Record[7], Record[8],
1577 getMDOrNull(Record[10]), Record[11])),
1590 getMDOrNull(Record[10]), nullptr, Record[11])),
15781591 NextMetadataNo);
1592
15791593 NextMetadataNo++;
15801594 } else if (Version == 0) {
15811595 // Upgrade old metadata, which stored a global variable reference or a
16061620 (Context, getMDOrNull(Record[1]), getMDString(Record[2]),
16071621 getMDString(Record[3]), getMDOrNull(Record[4]), Record[5],
16081622 getDITypeRefOrNull(Record[6]), Record[7], Record[8],
1609 getMDOrNull(Record[10]), AlignInBits));
1623 getMDOrNull(Record[10]), nullptr, AlignInBits));
16101624
16111625 DIGlobalVariableExpression *DGVE = nullptr;
16121626 if (Attach || Expr)
17441744 void ModuleBitcodeWriter::writeDIGlobalVariable(
17451745 const DIGlobalVariable *N, SmallVectorImpl &Record,
17461746 unsigned Abbrev) {
1747 const uint64_t Version = 1 << 1;
1747 const uint64_t Version = 2 << 1;
17481748 Record.push_back((uint64_t)N->isDistinct() | Version);
17491749 Record.push_back(VE.getMetadataOrNullID(N->getScope()));
17501750 Record.push_back(VE.getMetadataOrNullID(N->getRawName()));
17541754 Record.push_back(VE.getMetadataOrNullID(N->getType()));
17551755 Record.push_back(N->isLocalToUnit());
17561756 Record.push_back(N->isDefinition());
1757 Record.push_back(/* expr */ 0);
17581757 Record.push_back(VE.getMetadataOrNullID(N->getStaticDataMemberDeclaration()));
1758 Record.push_back(VE.getMetadataOrNullID(N->getTemplateParams()));
17591759 Record.push_back(N->getAlignInBits());
17601760
17611761 Stream.EmitRecord(bitc::METADATA_GLOBAL_VAR, Record, Abbrev);
158158 if (uint32_t AlignInBytes = GV->getAlignInBytes())
159159 addUInt(*VariableDIE, dwarf::DW_AT_alignment, dwarf::DW_FORM_udata,
160160 AlignInBytes);
161
162 if (MDTuple *TP = GV->getTemplateParams())
163 addTemplateParams(*VariableDIE, DINodeArray(TP));
161164
162165 // Add location.
163166 bool addToAccelTable = false;
20582058 Printer.printBool("isLocal", N->isLocalToUnit());
20592059 Printer.printBool("isDefinition", N->isDefinition());
20602060 Printer.printMetadata("declaration", N->getRawStaticDataMemberDeclaration());
2061 Printer.printMetadata("templateParams", N->getRawTemplateParams());
20612062 Printer.printInt("align", N->getAlignInBits());
20622063 Out << ")";
20632064 }
638638 DIGlobalVariableExpression *DIBuilder::createGlobalVariableExpression(
639639 DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
640640 unsigned LineNumber, DIType *Ty, bool isLocalToUnit, DIExpression *Expr,
641 MDNode *Decl, uint32_t AlignInBits) {
641 MDNode *Decl, MDTuple *templateParams, uint32_t AlignInBits) {
642642 checkGlobalVariableScope(Context);
643643
644644 auto *GV = DIGlobalVariable::getDistinct(
645645 VMContext, cast_or_null(Context), Name, LinkageName, F,
646646 LineNumber, Ty, isLocalToUnit, true, cast_or_null(Decl),
647 AlignInBits);
647 templateParams, AlignInBits);
648648 if (!Expr)
649649 Expr = createExpression();
650650 auto *N = DIGlobalVariableExpression::get(VMContext, GV, Expr);
655655 DIGlobalVariable *DIBuilder::createTempGlobalVariableFwdDecl(
656656 DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *F,
657657 unsigned LineNumber, DIType *Ty, bool isLocalToUnit, MDNode *Decl,
658 uint32_t AlignInBits) {
658 MDTuple *templateParams, uint32_t AlignInBits) {
659659 checkGlobalVariableScope(Context);
660660
661661 return DIGlobalVariable::getTemporary(
662662 VMContext, cast_or_null(Context), Name, LinkageName, F,
663663 LineNumber, Ty, isLocalToUnit, false,
664 cast_or_null(Decl), AlignInBits)
664 cast_or_null(Decl), templateParams, AlignInBits)
665665 .release();
666666 }
667667
12191219 return wrap(unwrap(Builder)->createConstantValueExpression(Value));
12201220 }
12211221
1222 LLVMMetadataRef
1223 LLVMDIBuilderCreateGlobalVariableExpression(LLVMDIBuilderRef Builder,
1224 LLVMMetadataRef Scope,
1225 const char *Name, size_t NameLen,
1226 const char *Linkage, size_t LinkLen,
1227 LLVMMetadataRef File,
1228 unsigned LineNo,
1229 LLVMMetadataRef Ty,
1230 LLVMBool LocalToUnit,
1231 LLVMMetadataRef Expr,
1232 LLVMMetadataRef Decl,
1233 uint32_t AlignInBits) {
1222 LLVMMetadataRef LLVMDIBuilderCreateGlobalVariableExpression(
1223 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
1224 size_t NameLen, const char *Linkage, size_t LinkLen, LLVMMetadataRef File,
1225 unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit,
1226 LLVMMetadataRef Expr, LLVMMetadataRef Decl, uint32_t AlignInBits) {
12341227 return wrap(unwrap(Builder)->createGlobalVariableExpression(
1235 unwrapDI(Scope), {Name, NameLen}, {Linkage, LinkLen},
1236 unwrapDI(File), LineNo, unwrapDI(Ty),
1237 LocalToUnit, unwrap(Expr),
1238 unwrapDI(Decl), AlignInBits));
1228 unwrapDI(Scope), {Name, NameLen}, {Linkage, LinkLen},
1229 unwrapDI(File), LineNo, unwrapDI(Ty), LocalToUnit,
1230 unwrap(Expr), unwrapDI(Decl),
1231 nullptr, AlignInBits));
12391232 }
12401233
12411234 LLVMMetadataRef LLVMTemporaryMDNode(LLVMContextRef Ctx, LLVMMetadataRef *Data,
12551248 MDNode::deleteTemporary(Node);
12561249 }
12571250
1258 LLVMMetadataRef
1259 LLVMDIBuilderCreateTempGlobalVariableFwdDecl(LLVMDIBuilderRef Builder,
1260 LLVMMetadataRef Scope,
1261 const char *Name, size_t NameLen,
1262 const char *Linkage, size_t LnkLen,
1263 LLVMMetadataRef File,
1264 unsigned LineNo,
1265 LLVMMetadataRef Ty,
1266 LLVMBool LocalToUnit,
1267 LLVMMetadataRef Decl,
1268 uint32_t AlignInBits) {
1251 LLVMMetadataRef LLVMDIBuilderCreateTempGlobalVariableFwdDecl(
1252 LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
1253 size_t NameLen, const char *Linkage, size_t LnkLen, LLVMMetadataRef File,
1254 unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit,
1255 LLVMMetadataRef Decl, uint32_t AlignInBits) {
12691256 return wrap(unwrap(Builder)->createTempGlobalVariableFwdDecl(
1270 unwrapDI(Scope), {Name, NameLen}, {Linkage, LnkLen},
1271 unwrapDI(File), LineNo, unwrapDI(Ty),
1272 LocalToUnit, unwrapDI(Decl), AlignInBits));
1273 }
1274
1275 LLVMValueRef LLVMDIBuilderInsertDeclareBefore(
1276 LLVMDIBuilderRef Builder, LLVMValueRef Storage, LLVMMetadataRef VarInfo,
1277 LLVMMetadataRef Expr, LLVMMetadataRef DL, LLVMValueRef Instr) {
1257 unwrapDI(Scope), {Name, NameLen}, {Linkage, LnkLen},
1258 unwrapDI(File), LineNo, unwrapDI(Ty), LocalToUnit,
1259 unwrapDI(Decl), nullptr, AlignInBits));
1260 }
1261
1262 LLVMValueRef
1263 LLVMDIBuilderInsertDeclareBefore(LLVMDIBuilderRef Builder, LLVMValueRef Storage,
1264 LLVMMetadataRef VarInfo, LLVMMetadataRef Expr,
1265 LLVMMetadataRef DL, LLVMValueRef Instr) {
12781266 return wrap(unwrap(Builder)->insertDeclare(
12791267 unwrap(Storage), unwrap(VarInfo),
12801268 unwrap(Expr), unwrap(DL),
652652 MDString *LinkageName, Metadata *File, unsigned Line,
653653 Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
654654 Metadata *StaticDataMemberDeclaration,
655 uint32_t AlignInBits, StorageType Storage,
656 bool ShouldCreate) {
655 Metadata *TemplateParams, uint32_t AlignInBits,
656 StorageType Storage, bool ShouldCreate) {
657657 assert(isCanonical(Name) && "Expected canonical MDString");
658658 assert(isCanonical(LinkageName) && "Expected canonical MDString");
659 DEFINE_GETIMPL_LOOKUP(DIGlobalVariable,
660 (Scope, Name, LinkageName, File, Line, Type,
661 IsLocalToUnit, IsDefinition,
662 StaticDataMemberDeclaration, AlignInBits));
663 Metadata *Ops[] = {
664 Scope, Name, File, Type, Name, LinkageName, StaticDataMemberDeclaration};
659 DEFINE_GETIMPL_LOOKUP(DIGlobalVariable, (Scope, Name, LinkageName, File, Line,
660 Type, IsLocalToUnit, IsDefinition,
661 StaticDataMemberDeclaration,
662 TemplateParams, AlignInBits));
663 Metadata *Ops[] = {Scope,
664 Name,
665 File,
666 Type,
667 Name,
668 LinkageName,
669 StaticDataMemberDeclaration,
670 TemplateParams};
665671 DEFINE_GETIMPL_STORE(DIGlobalVariable,
666 (Line, IsLocalToUnit, IsDefinition, AlignInBits),
667 Ops);
672 (Line, IsLocalToUnit, IsDefinition, AlignInBits), Ops);
668673 }
669674
670675 DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, Metadata *Scope,
869869 bool IsLocalToUnit;
870870 bool IsDefinition;
871871 Metadata *StaticDataMemberDeclaration;
872 Metadata *TemplateParams;
872873 uint32_t AlignInBits;
873874
874875 MDNodeKeyImpl(Metadata *Scope, MDString *Name, MDString *LinkageName,
875876 Metadata *File, unsigned Line, Metadata *Type,
876877 bool IsLocalToUnit, bool IsDefinition,
877 Metadata *StaticDataMemberDeclaration, uint32_t AlignInBits)
878 Metadata *StaticDataMemberDeclaration, Metadata *TemplateParams,
879 uint32_t AlignInBits)
878880 : Scope(Scope), Name(Name), LinkageName(LinkageName), File(File),
879881 Line(Line), Type(Type), IsLocalToUnit(IsLocalToUnit),
880882 IsDefinition(IsDefinition),
881883 StaticDataMemberDeclaration(StaticDataMemberDeclaration),
882 AlignInBits(AlignInBits) {}
884 TemplateParams(TemplateParams), AlignInBits(AlignInBits) {}
883885 MDNodeKeyImpl(const DIGlobalVariable *N)
884886 : Scope(N->getRawScope()), Name(N->getRawName()),
885887 LinkageName(N->getRawLinkageName()), File(N->getRawFile()),
886888 Line(N->getLine()), Type(N->getRawType()),
887889 IsLocalToUnit(N->isLocalToUnit()), IsDefinition(N->isDefinition()),
888890 StaticDataMemberDeclaration(N->getRawStaticDataMemberDeclaration()),
891 TemplateParams(N->getRawTemplateParams()),
889892 AlignInBits(N->getAlignInBits()) {}
890893
891894 bool isKeyOf(const DIGlobalVariable *RHS) const {
896899 IsDefinition == RHS->isDefinition() &&
897900 StaticDataMemberDeclaration ==
898901 RHS->getRawStaticDataMemberDeclaration() &&
902 TemplateParams == RHS->getRawTemplateParams() &&
899903 AlignInBits == RHS->getAlignInBits();
900904 }
901905
22
33 @foo = global i32 0
44
5 ; CHECK: !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8}
6 !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8}
5 ; CHECK: !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !10, !11, !12}
6 !named = !{!0, !1, !2, !3, !4, !5, !6, !7, !8, !9, !10, !11, !12}
77
88 !0 = !DIFile(filename: "scope.h", directory: "/path/to/dir")
99 !1 = distinct !{}
2222 ; CHECK: !8 = !DIGlobalVariable(name: "mem", scope: !0, type: !9, isLocal: false, isDefinition: true, declaration: !7)
2323 !8 = !DIGlobalVariable(name: "mem", scope: !0, declaration: !7, type: !9)
2424 !9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
25
26 ; CHECK: !12 = !DIGlobalVariable(name: "bar", linkageName: "bar", scope: !0, file: !2, line: 8, type: !3, isLocal: true, isDefinition: false, templateParams: !11, align: 32)
27 !10 = !DITemplateTypeParameter(name: "Ty", type: !3)
28 !11 = distinct !{!10}
29 !12 = !DIGlobalVariable(name: "bar", linkageName: "bar", scope: !0, file: !2, line: 8, type: !3, isLocal: true, isDefinition: false, templateParams: !11, align: 32)
22 ; RUN: llc -mtriple=x86_64-linux -O0 -filetype=obj < %s | llvm-dwarfdump -v -debug-info - | FileCheck %s
33
44 ; IR generated with `clang++ -g -emit-llvm -S` from the following code:
5 ; template class y, decltype(nullptr) n, int ...z> int func() { return 3; }
5 ; template class y, decltype(nullptr) n, int ...z> int func() {
6 ; var = 5;
7 ; return var;
8 ; }
69 ; template struct y_impl { struct nested { }; };
710 ; int glbl = func<3, &glbl, y_impl, nullptr, 1, 2>();
811 ; y_impl::nested n;
1114 ; CHECK-NEXT: DW_AT_name{{.*}} = "int"
1215
1316 ; CHECK: DW_TAG_structure_type
14 ; CHECK-NEXT: DW_AT_name{{.*}}"y_impl"
17 ; CHECK: DW_AT_name{{.*}}"y_impl"
18 ; CHECK-NOT: {{TAG|NULL}}
19 ; CHECK: DW_TAG_template_type_parameter
20
21 ; CHECK: DW_TAG_variable
22 ; CHECK-NEXT: DW_AT_name{{.*}}"var"
1523 ; CHECK-NOT: NULL
1624 ; CHECK: DW_TAG_template_type_parameter
25 ; CHECK-NEXT: DW_AT_type{{.*}}=> {[[INT]]}
26 ; CHECK-NEXT: DW_AT_name{{.*}}= "T"
27
1728
1829 ; CHECK: DW_AT_name{{.*}}"func<3, &glbl, y_impl, nullptr, 1, 2>"
1930 ; CHECK-NOT: NULL
5869 ; CHECK-NEXT: DW_AT_name{{.*}}= "decltype(nullptr)"
5970
6071 source_filename = "test/DebugInfo/X86/template.ll"
61
6272 %"struct.y_impl::nested" = type { i8 }
6373
64 @glbl = global i32 0, align 4, !dbg !0
65 @n = global %"struct.y_impl::nested" zeroinitializer, align 1, !dbg !4
66 @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_template.cpp, i8* null }]
74 @glbl = dso_local global i32 0, align 4, !dbg !0
75 @_Z3varIiE = linkonce_odr dso_local global i32 0, align 4, !dbg !13
76 @n = dso_local global %"struct.y_impl::nested" zeroinitializer, align 1, !dbg !6
77 @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_upstream_test.cpp, i8* null }]
6778
68 define internal void @__cxx_global_var_init() section ".text.startup" !dbg !17 {
79 ; Function Attrs: noinline uwtable
80 define internal void @__cxx_global_var_init() #0 section ".text.startup" !dbg !21 {
6981 entry:
70 %call = call i32 @_Z4funcILi3EXadL_Z4glblEE6y_implLDn0EJLi1ELi2EEEiv(), !dbg !20
71 store i32 %call, i32* @glbl, align 4, !dbg !20
72 ret void, !dbg !20
82 %call = call i32 @_Z4funcILi3EXadL_Z4glblEE6y_implLDn0EJLi1ELi2EEEiv(), !dbg !24
83 store i32 %call, i32* @glbl, align 4, !dbg !24
84 ret void, !dbg !24
7385 }
7486
75 ; Function Attrs: nounwind uwtable
76 define linkonce_odr i32 @_Z4funcILi3EXadL_Z4glblEE6y_implLDn0EJLi1ELi2EEEiv() #0 !dbg !21 {
87 ; Function Attrs: noinline nounwind optnone uwtable
88 define linkonce_odr dso_local i32 @_Z4funcILi3EXadL_Z4glblEE6y_implLDn0EJLi1ELi2EEEiv() #1 !dbg !25 {
7789 entry:
78 ret i32 3, !dbg !35
90 store i32 5, i32* @_Z3varIiE, align 4, !dbg !39
91 %0 = load i32, i32* @_Z3varIiE, align 4, !dbg !40
92 ret i32 %0, !dbg !41
7993 }
8094
81 define internal void @_GLOBAL__sub_I_template.cpp() section ".text.startup" {
95 ; Function Attrs: noinline uwtable
96 define internal void @_GLOBAL__sub_I_upstream_test.cpp() #0 section ".text.startup" !dbg !42 {
8297 entry:
83 call void @__cxx_global_var_init(), !dbg !36
98 call void @__cxx_global_var_init(), !dbg !44
8499 ret void
85100 }
86101
87 attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
102 attributes #0 = { nounwind uwtable }
103 attributes #1 = { nounwind uwtable noinline optnone }
88104
89 !llvm.dbg.cu = !{!11}
90 !llvm.module.flags = !{!14, !15}
91 !llvm.ident = !{!16}
105 !llvm.dbg.cu = !{!2}
106 !llvm.module.flags = !{!17, !18, !19}
107 !llvm.ident = !{!20}
92108
93109 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
94 !1 = !DIGlobalVariable(name: "glbl", scope: null, file: !2, line: 3, type: !3, isLocal: false, isDefinition: true)
95 !2 = !DIFile(filename: "template.cpp", directory: "/tmp/dbginfo")
96 !3 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
97 !4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())
98 !5 = !DIGlobalVariable(name: "n", scope: null, file: !2, line: 4, type: !6, isLocal: false, isDefinition: true)
99 !6 = !DICompositeType(tag: DW_TAG_structure_type, name: "nested", scope: !7, file: !2, line: 2, size: 8, align: 8, elements: !8, identifier: "_ZTSN6y_implIiE6nestedE")
100 !7 = !DICompositeType(tag: DW_TAG_structure_type, name: "y_impl", file: !2, line: 2, size: 8, align: 8, elements: !8, templateParams: !9, identifier: "_ZTS6y_implIiE")
101 !8 = !{}
102 !9 = !{!10}
103 !10 = !DITemplateTypeParameter(type: !3)
104 !11 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !2, producer: "clang version 3.6.0 (trunk 224394) (llvm/trunk 224384)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !8, retainedTypes: !12, globals: !13, imports: !8)
105 !12 = !{!7, !6}
106 !13 = !{!0, !4}
107 !14 = !{i32 2, !"Dwarf Version", i32 4}
108 !15 = !{i32 2, !"Debug Info Version", i32 3}
109 !16 = !{!"clang version 3.6.0 (trunk 224394) (llvm/trunk 224384)"}
110 !17 = distinct !DISubprogram(name: "__cxx_global_var_init", scope: !2, file: !2, line: 3, type: !18, isLocal: true, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !11, retainedNodes: !8)
111 !18 = !DISubroutineType(types: !19)
112 !19 = !{null}
113 !20 = !DILocation(line: 3, column: 12, scope: !17)
114 !21 = distinct !DISubprogram(name: "func<3, &glbl, y_impl, nullptr, 1, 2>", linkageName: "_Z4funcILi3EXadL_Z4glblEE6y_implLDn0EJLi1ELi2EEEiv", scope: !2, file: !2, line: 1, type: !22, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !11, templateParams: !24, retainedNodes: !8)
110 !1 = distinct !DIGlobalVariable(name: "glbl", scope: !2, file: !3, line: 7, type: !12, isLocal: false, isDefinition: true)
111 !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 7.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
112 !3 = !DIFile(filename: "upstream_test.cpp", directory: "/home/mvoss/src/92562")
113 !4 = !{}
114 !5 = !{!0, !6, !13}
115 !6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
116 !7 = distinct !DIGlobalVariable(name: "n", scope: !2, file: !3, line: 8, type: !8, isLocal: false, isDefinition: true)!8 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "nested", scope: !9, file: !3, line: 6, size: 8, flags: DIFlagTypePassByValue, elements: !4, identifier: "_ZTSN6y_implIiE6nestedE")
117 !9 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "y_impl", file: !3, line: 6, size: 8, flags: DIFlagTypePassByValue, elements: !4, templateParams: !10, identifier: "_ZTS6y_implIiE")
118 !10 = !{!11}
119 !11 = !DITemplateTypeParameter(type: !12)
120 !12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
121 !13 = !DIGlobalVariableExpression(var: !14, expr: !DIExpression())
122 !14 = distinct !DIGlobalVariable(name: "var", linkageName: "_Z3varIiE", scope: !2, file: !3, line: 1, type: !12, isLocal: false, isDefinition: true, templateParams: !15)
123 !15 = !{!16}
124 !16 = !DITemplateTypeParameter(name: "T", type: !12)
125 !17 = !{i32 2, !"Dwarf Version", i32 4}
126 !18 = !{i32 2, !"Debug Info Version", i32 3}
127 !19 = !{i32 1, !"wchar_size", i32 4}
128 !20 = !{!"clang version 7.0.0 "}
129 !21 = distinct !DISubprogram(name: "__cxx_global_var_init", scope: !3, file: !3, line: 7, type: !22, isLocal: true, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes: !4)
115130 !22 = !DISubroutineType(types: !23)
116 !23 = !{!3}
117 !24 = !{!25, !26, !28, !29, !31}
118 !25 = !DITemplateValueParameter(name: "x", type: !3, value: i32 3)
119 !26 = !DITemplateValueParameter(type: !27, value: i32* @glbl)
120 !27 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !3, size: 64, align: 64)
121 !28 = !DITemplateValueParameter(tag: DW_TAG_GNU_template_template_param, name: "y", value: !"y_impl")
122 !29 = !DITemplateValueParameter(name: "n", type: !30, value: i8 0)
123 !30 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
124 !31 = !DITemplateValueParameter(tag: DW_TAG_GNU_template_parameter_pack, name: "z", value: !32)
125 !32 = !{!33, !34}
126 !33 = !DITemplateValueParameter(type: !3, value: i32 1)
127 !34 = !DITemplateValueParameter(type: !3, value: i32 2)
128 !35 = !DILocation(line: 1, column: 96, scope: !21)
129 !36 = !DILocation(line: 0, scope: !37)
130 !37 = distinct !DISubprogram(linkageName: "_GLOBAL__sub_I_template.cpp", scope: !2, file: !2, type: !38, isLocal: true, isDefinition: true, flags: DIFlagArtificial, isOptimized: false, unit: !11, retainedNodes: !8)
131 !38 = !DISubroutineType(types: !8)
132
131 !23 = !{null}
132 !24 = !DILocation(line: 7, column: 12, scope: !21)
133 !25 = distinct !DISubprogram(name: "func<3, &glbl, y_impl, nullptr, 1, 2>", linkageName: "_Z4funcILi3EXadL_Z4glblEE6y_implLDn0EJLi1ELi2EEEiv", scope: !3, file: !3, line: 2, type: !26, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !2, templateParams: !28, retainedNodes: !4)
134 !26 = !DISubroutineType(types: !27)
135 !27 = !{!12}
136 !28 = !{!29, !30, !32, !33, !35}
137 !29 = !DITemplateValueParameter(name: "x", type: !12, value: i32 3)
138 !30 = !DITemplateValueParameter(type: !31, value: i32* @glbl)
139 !31 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64)
140 !32 = !DITemplateValueParameter(tag: DW_TAG_GNU_template_template_param, name: "y", value: !"y_impl")
141 !33 = !DITemplateValueParameter(name: "n", type: !34, value: i8 0)
142 !34 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "decltype(nullptr)")
143 !35 = !DITemplateValueParameter(tag: DW_TAG_GNU_template_parameter_pack, name: "z", value: !36)
144 !36 = !{!37, !38}
145 !37 = !DITemplateValueParameter(type: !12, value: i32 1)
146 !38 = !DITemplateValueParameter(type: !12, value: i32 2)
147 !39 = !DILocation(line: 3, column: 12, scope: !25)
148 !40 = !DILocation(line: 4, column: 10, scope: !25)
149 !41 = !DILocation(line: 4, column: 3, scope: !25)
150 !42 = distinct !DISubprogram(linkageName: "_GLOBAL__sub_I_upstream_test.cpp", scope: !3, file: !3, type: !43, isLocal: true, isDefinition: true, flags: DIFlagArtificial, isOptimized: false, unit: !2, retainedNodes: !4)
151 !43 = !DISubroutineType(types: !4)
152 !44 = !DILocation(line: 0, scope: !42)
6060
6161 LLVMMetadataRef ClassTy = declare_objc_class(DIB, File);
6262 LLVMMetadataRef GlobalClassValueExpr =
63 LLVMDIBuilderCreateConstantValueExpression(DIB, 0);
64 LLVMDIBuilderCreateGlobalVariableExpression(DIB, Module, "globalClass", 11,
65 "", 0, File, 1, ClassTy,
66 true, GlobalClassValueExpr,
67 NULL, 0);
63 LLVMDIBuilderCreateConstantValueExpression(DIB, 0);
64 LLVMDIBuilderCreateGlobalVariableExpression(
65 DIB, Module, "globalClass", 11, "", 0, File, 1, ClassTy, true,
66 GlobalClassValueExpr, NULL, 0);
6867
6968 LLVMMetadataRef Int64Ty =
70 LLVMDIBuilderCreateBasicType(DIB, "Int64", 5, 64, 0, LLVMDIFlagZero);
69 LLVMDIBuilderCreateBasicType(DIB, "Int64", 5, 64, 0, LLVMDIFlagZero);
7170 LLVMMetadataRef Int64TypeDef =
7271 LLVMDIBuilderCreateTypedef(DIB, Int64Ty, "int64_t", 7, File, 42, File);
7372
7473 LLVMMetadataRef GlobalVarValueExpr =
75 LLVMDIBuilderCreateConstantValueExpression(DIB, 0);
76 LLVMDIBuilderCreateGlobalVariableExpression(DIB, Module, "global", 6,
77 "", 0, File, 1, Int64TypeDef,
78 true, GlobalVarValueExpr,
79 NULL, 0);
74 LLVMDIBuilderCreateConstantValueExpression(DIB, 0);
75 LLVMDIBuilderCreateGlobalVariableExpression(
76 DIB, Module, "global", 6, "", 0, File, 1, Int64TypeDef, true,
77 GlobalVarValueExpr, NULL, 0);
8078
8179 LLVMMetadataRef NameSpace =
82 LLVMDIBuilderCreateNameSpace(DIB, Module, "NameSpace", 9, false);
80 LLVMDIBuilderCreateNameSpace(DIB, Module, "NameSpace", 9, false);
8381
8482 LLVMMetadataRef StructDbgElts[] = {Int64Ty, Int64Ty, Int64Ty};
8583 LLVMMetadataRef StructDbgTy =
20132013 DIType *Type = getDerivedType();
20142014 bool IsLocalToUnit = false;
20152015 bool IsDefinition = true;
2016 MDTuple *templateParams = getTuple();
20162017 DIDerivedType *StaticDataMemberDeclaration =
20172018 cast(getDerivedType());
2019
20182020 uint32_t AlignInBits = 8;
20192021
2020 auto *N = DIGlobalVariable::get(Context, Scope, Name, LinkageName, File, Line,
2021 Type, IsLocalToUnit, IsDefinition,
2022 StaticDataMemberDeclaration, AlignInBits);
2022 auto *N = DIGlobalVariable::get(
2023 Context, Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
2024 IsDefinition, StaticDataMemberDeclaration, templateParams, AlignInBits);
2025
20232026 EXPECT_EQ(dwarf::DW_TAG_variable, N->getTag());
20242027 EXPECT_EQ(Scope, N->getScope());
20252028 EXPECT_EQ(Name, N->getName());
20302033 EXPECT_EQ(IsLocalToUnit, N->isLocalToUnit());
20312034 EXPECT_EQ(IsDefinition, N->isDefinition());
20322035 EXPECT_EQ(StaticDataMemberDeclaration, N->getStaticDataMemberDeclaration());
2036 EXPECT_EQ(templateParams, N->getTemplateParams());
20332037 EXPECT_EQ(AlignInBits, N->getAlignInBits());
20342038 EXPECT_EQ(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
20352039 Line, Type, IsLocalToUnit, IsDefinition,
2036 StaticDataMemberDeclaration, AlignInBits));
2037
2038 EXPECT_NE(N,
2039 DIGlobalVariable::get(Context, getSubprogram(), Name, LinkageName,
2040 File, Line, Type, IsLocalToUnit, IsDefinition,
2041 StaticDataMemberDeclaration, AlignInBits));
2040 StaticDataMemberDeclaration,
2041 templateParams, AlignInBits));
2042
2043 EXPECT_NE(N, DIGlobalVariable::get(
2044 Context, getSubprogram(), Name, LinkageName, File, Line,
2045 Type, IsLocalToUnit, IsDefinition,
2046 StaticDataMemberDeclaration, templateParams, AlignInBits));
20422047 EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, "other", LinkageName, File,
20432048 Line, Type, IsLocalToUnit, IsDefinition,
2044 StaticDataMemberDeclaration, AlignInBits));
2049 StaticDataMemberDeclaration,
2050 templateParams, AlignInBits));
20452051 EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, "other", File, Line,
20462052 Type, IsLocalToUnit, IsDefinition,
2047 StaticDataMemberDeclaration, AlignInBits));
2048 EXPECT_NE(N,
2049 DIGlobalVariable::get(Context, Scope, Name, LinkageName, getFile(),
2050 Line, Type, IsLocalToUnit, IsDefinition,
2051 StaticDataMemberDeclaration, AlignInBits));
2052 EXPECT_NE(N,
2053 DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
2054 Line + 1, Type, IsLocalToUnit, IsDefinition,
2055 StaticDataMemberDeclaration, AlignInBits));
2056 EXPECT_NE(N,
2057 DIGlobalVariable::get(Context, Scope, Name, LinkageName, File, Line,
2058 getDerivedType(), IsLocalToUnit, IsDefinition,
2059 StaticDataMemberDeclaration, AlignInBits));
2053 StaticDataMemberDeclaration,
2054 templateParams, AlignInBits));
2055 EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName,
2056 getFile(), Line, Type, IsLocalToUnit,
2057 IsDefinition, StaticDataMemberDeclaration,
2058 templateParams, AlignInBits));
2059 EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
2060 Line + 1, Type, IsLocalToUnit,
2061 IsDefinition, StaticDataMemberDeclaration,
2062 templateParams, AlignInBits));
2063 EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
2064 Line, getDerivedType(), IsLocalToUnit,
2065 IsDefinition, StaticDataMemberDeclaration,
2066 templateParams, AlignInBits));
20602067 EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
20612068 Line, Type, !IsLocalToUnit, IsDefinition,
2062 StaticDataMemberDeclaration, AlignInBits));
2069 StaticDataMemberDeclaration,
2070 templateParams, AlignInBits));
20632071 EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
20642072 Line, Type, IsLocalToUnit, !IsDefinition,
2065 StaticDataMemberDeclaration, AlignInBits));
2073 StaticDataMemberDeclaration,
2074 templateParams, AlignInBits));
20662075 EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
20672076 Line, Type, IsLocalToUnit, IsDefinition,
20682077 cast(getDerivedType()),
2078 templateParams, AlignInBits));
2079 EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
2080 Line, Type, IsLocalToUnit, IsDefinition,
2081 StaticDataMemberDeclaration, nullptr,
20692082 AlignInBits));
20702083 EXPECT_NE(N, DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
20712084 Line, Type, IsLocalToUnit, IsDefinition,
20722085 StaticDataMemberDeclaration,
2073 (AlignInBits << 1)));
2086 templateParams, (AlignInBits << 1)));
20742087
20752088 TempDIGlobalVariable Temp = N->clone();
20762089 EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
20872100 DIType *Type = getDerivedType();
20882101 bool IsLocalToUnit = false;
20892102 bool IsDefinition = true;
2103 MDTuple *templateParams = getTuple();
20902104 auto *Expr = DIExpression::get(Context, {1, 2});
20912105 auto *Expr2 = DIExpression::get(Context, {1, 2, 3});
20922106 DIDerivedType *StaticDataMemberDeclaration =
20932107 cast(getDerivedType());
20942108 uint32_t AlignInBits = 8;
20952109
2096 auto *Var = DIGlobalVariable::get(Context, Scope, Name, LinkageName, File,
2097 Line, Type, IsLocalToUnit, IsDefinition,
2098 StaticDataMemberDeclaration, AlignInBits);
2099 auto *Var2 = DIGlobalVariable::get(Context, Scope, "other", LinkageName, File,
2100 Line, Type, IsLocalToUnit, IsDefinition,
2101 StaticDataMemberDeclaration, AlignInBits);
2110 auto *Var = DIGlobalVariable::get(
2111 Context, Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
2112 IsDefinition, StaticDataMemberDeclaration, templateParams, AlignInBits);
2113 auto *Var2 = DIGlobalVariable::get(
2114 Context, Scope, "other", LinkageName, File, Line, Type, IsLocalToUnit,
2115 IsDefinition, StaticDataMemberDeclaration, templateParams, AlignInBits);
21022116 auto *N = DIGlobalVariableExpression::get(Context, Var, Expr);
21032117
21042118 EXPECT_EQ(Var, N->getVariable());