llvm.org GIT mirror llvm / 01dd3d9
Formatting with clang-format patch r280700 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280716 91177308-0d34-0410-b5e6-96231b3b80d8 Leny Kholodov 4 years ago
11 changed file(s) with 147 addition(s) and 160 deletion(s). Raw diff Collapse all Expand all
7575 LLVMMetadataRef CompositeType, int IsLocalToUnit, int IsDefinition,
7676 unsigned ScopeLine, unsigned Flags, int IsOptimized) {
7777 DIBuilder *D = unwrap(Dref);
78 return wrap(D->createFunction(unwrap(Scope), Name, LinkageName,
79 File ? unwrap(File) : nullptr, Line,
80 unwrap(CompositeType),
81 IsLocalToUnit, IsDefinition, ScopeLine,
82 static_cast(Flags),
83 IsOptimized));
78 return wrap(D->createFunction(
79 unwrap(Scope), Name, LinkageName,
80 File ? unwrap(File) : nullptr, Line,
81 unwrap(CompositeType), IsLocalToUnit, IsDefinition,
82 ScopeLine, static_cast(Flags), IsOptimized));
8483 }
8584
8685 LLVMMetadataRef
8988 unsigned Line, LLVMMetadataRef Ty,
9089 int AlwaysPreserve, unsigned Flags) {
9190 DIBuilder *D = unwrap(Dref);
92 return wrap(D->createAutoVariable(unwrap(Scope), Name,
93 unwrap(File), Line,
94 unwrap(Ty), AlwaysPreserve,
95 static_cast(Flags)));
91 return wrap(D->createAutoVariable(
92 unwrap(Scope), Name, unwrap(File), Line,
93 unwrap(Ty), AlwaysPreserve, static_cast(Flags)));
9694 }
9795
9896 LLVMMetadataRef LLVMDIBuilderCreateParameterVariable(
144144 /// \param SizeInBits Size.
145145 /// \param AlignInBits Alignment. (optional)
146146 /// \param Class Type for which this pointer points to members of.
147 DIDerivedType *createMemberPointerType(DIType *PointeeTy, DIType *Class,
148 uint64_t SizeInBits,
149 uint64_t AlignInBits = 0,
150 DINode::DIFlags Flags = DINode::FlagZero);
147 DIDerivedType *
148 createMemberPointerType(DIType *PointeeTy, DIType *Class,
149 uint64_t SizeInBits, uint64_t AlignInBits = 0,
150 DINode::DIFlags Flags = DINode::FlagZero);
151151
152152 /// Create debugging information entry for a c++
153153 /// style reference or rvalue reference type.
192192 DIFile *File, unsigned LineNo,
193193 uint64_t SizeInBits, uint64_t AlignInBits,
194194 uint64_t OffsetInBits,
195 DINode::DIFlags Flags,
196 DIType *Ty);
195 DINode::DIFlags Flags, DIType *Ty);
197196
198197 /// Create debugging information entry for a bit field member.
199198 /// \param Scope Member scope.
272271 /// for more info.
273272 /// \param TemplateParms Template type parameters.
274273 /// \param UniqueIdentifier A unique identifier for the class.
275 DICompositeType *createClassType(DIScope *Scope, StringRef Name,
276 DIFile *File, unsigned LineNumber,
277 uint64_t SizeInBits, uint64_t AlignInBits,
278 uint64_t OffsetInBits,
279 DINode::DIFlags Flags,
280 DIType *DerivedFrom, DINodeArray Elements,
281 DIType *VTableHolder = nullptr,
282 MDNode *TemplateParms = nullptr,
283 StringRef UniqueIdentifier = "");
274 DICompositeType *createClassType(
275 DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
276 uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
277 DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements,
278 DIType *VTableHolder = nullptr, MDNode *TemplateParms = nullptr,
279 StringRef UniqueIdentifier = "");
284280
285281 /// Create debugging information entry for a struct.
286282 /// \param Scope Scope in which this struct is defined.
395391 /// \param Flags E.g.: LValueReference.
396392 /// These flags are used to emit dwarf attributes.
397393 /// \param CC Calling convention, e.g. dwarf::DW_CC_normal
398 DISubroutineType *createSubroutineType(DITypeRefArray ParameterTypes,
399 DINode::DIFlags Flags = DINode::FlagZero,
400 unsigned CC = 0);
394 DISubroutineType *
395 createSubroutineType(DITypeRefArray ParameterTypes,
396 DINode::DIFlags Flags = DINode::FlagZero,
397 unsigned CC = 0);
401398
402399 /// Create an external type reference.
403400 /// \param Tag Dwarf TAG.
480477 ///
481478 /// If \c AlwaysPreserve, this variable will be referenced from its
482479 /// containing subprogram, and will survive some optimizations.
483 DILocalVariable *createAutoVariable(DIScope *Scope, StringRef Name,
484 DIFile *File, unsigned LineNo,
485 DIType *Ty,
486 bool AlwaysPreserve = false,
487 DINode::DIFlags Flags = DINode::FlagZero);
480 DILocalVariable *
481 createAutoVariable(DIScope *Scope, StringRef Name, DIFile *File,
482 unsigned LineNo, DIType *Ty, bool AlwaysPreserve = false,
483 DINode::DIFlags Flags = DINode::FlagZero);
488484
489485 /// Create a new descriptor for a parameter variable.
490486 ///
497493 ///
498494 /// If \c AlwaysPreserve, this variable will be referenced from its
499495 /// containing subprogram, and will survive some optimizations.
500 DILocalVariable *createParameterVariable(DIScope *Scope, StringRef Name,
501 unsigned ArgNo, DIFile *File,
502 unsigned LineNo, DIType *Ty,
503 bool AlwaysPreserve = false,
504 DINode::DIFlags Flags = DINode::FlagZero);
496 DILocalVariable *
497 createParameterVariable(DIScope *Scope, StringRef Name, unsigned ArgNo,
498 DIFile *File, unsigned LineNo, DIType *Ty,
499 bool AlwaysPreserve = false,
500 DINode::DIFlags Flags = DINode::FlagZero);
505501
506502 /// Create a new descriptor for the specified
507503 /// variable which has a complex address expression for its address.
548544 DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
549545 unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
550546 bool isDefinition, unsigned ScopeLine,
551 DINode::DIFlags Flags = DINode::FlagZero,
552 bool isOptimized = false, DITemplateParameterArray TParams = nullptr,
547 DINode::DIFlags Flags = DINode::FlagZero, bool isOptimized = false,
548 DITemplateParameterArray TParams = nullptr,
553549 DISubprogram *Decl = nullptr);
554550
555551 /// Create a new descriptor for the specified C++ method.
574570 /// This flags are used to emit dwarf attributes.
575571 /// \param isOptimized True if optimization is ON.
576572 /// \param TParams Function template parameters.
577 DISubprogram *
578 createMethod(DIScope *Scope, StringRef Name, StringRef LinkageName,
579 DIFile *File, unsigned LineNo, DISubroutineType *Ty,
580 bool isLocalToUnit, bool isDefinition, unsigned Virtuality = 0,
581 unsigned VTableIndex = 0, int ThisAdjustment = 0,
582 DIType *VTableHolder = nullptr,
583 DINode::DIFlags Flags = DINode::FlagZero,
584 bool isOptimized = false,
585 DITemplateParameterArray TParams = nullptr);
573 DISubprogram *createMethod(
574 DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
575 unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
576 bool isDefinition, unsigned Virtuality = 0, unsigned VTableIndex = 0,
577 int ThisAdjustment = 0, DIType *VTableHolder = nullptr,
578 DINode::DIFlags Flags = DINode::FlagZero, bool isOptimized = false,
579 DITemplateParameterArray TParams = nullptr);
586580
587581 /// This creates new descriptor for a namespace with the specified
588582 /// parent scope.
1313 #ifndef LLVM_IR_DEBUGINFOMETADATA_H
1414 #define LLVM_IR_DEBUGINFOMETADATA_H
1515
16 #include "llvm/ADT/BitmaskEnum.h"
1617 #include "llvm/IR/Metadata.h"
1718 #include "llvm/Support/Dwarf.h"
18 #include "llvm/ADT/BitmaskEnum.h"
1919
2020 // Helper macros for defining get() overrides.
2121 #define DEFINE_MDNODE_GET_UNPACK_IMPL(...) __VA_ARGS__
189189 /// Split \c Flags into \c SplitFlags, a vector of its components. Returns
190190 /// any remaining (unrecognized) bits.
191191 static DIFlags splitFlags(DIFlags Flags,
192 SmallVectorImpl &SplitFlags);
192 SmallVectorImpl &SplitFlags);
193193
194194 static bool classof(const Metadata *MD) {
195195 switch (MD->getMetadataID()) {
713713 DEFINE_MDNODE_GET(DIDerivedType,
714714 (unsigned Tag, StringRef Name, DIFile *File, unsigned Line,
715715 DIScopeRef Scope, DITypeRef BaseType, uint64_t SizeInBits,
716 uint64_t AlignInBits, uint64_t OffsetInBits,
717 DIFlags Flags, Metadata *ExtraData = nullptr),
716 uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags,
717 Metadata *ExtraData = nullptr),
718718 (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
719719 AlignInBits, OffsetInBits, Flags, ExtraData))
720720
824824 DEFINE_MDNODE_GET(DICompositeType,
825825 (unsigned Tag, StringRef Name, DIFile *File, unsigned Line,
826826 DIScopeRef Scope, DITypeRef BaseType, uint64_t SizeInBits,
827 uint64_t AlignInBits, uint64_t OffsetInBits,
828 DIFlags Flags, DINodeArray Elements, unsigned RuntimeLang,
827 uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags,
828 DINodeArray Elements, unsigned RuntimeLang,
829829 DITypeRef VTableHolder,
830830 DITemplateParameterArray TemplateParams = nullptr,
831831 StringRef Identifier = ""),
14201420 ///
14211421 /// Return true if this subprogram is a C++11 reference-qualified non-static
14221422 /// member function (void foo() &).
1423 bool isLValueReference() const {
1424 return getFlags() & FlagLValueReference;
1425 }
1423 bool isLValueReference() const { return getFlags() & FlagLValueReference; }
14261424
14271425 /// \brief Check if this is rvalue-reference-qualified.
14281426 ///
14291427 /// Return true if this subprogram is a C++11 rvalue-reference-qualified
14301428 /// non-static member function (void foo() &&).
1431 bool isRValueReference() const {
1432 return getFlags() & FlagRValueReference;
1433 }
1429 bool isRValueReference() const { return getFlags() & FlagRValueReference; }
14341430
14351431 /// \brief Check if this is marked as noreturn.
14361432 ///
14371433 /// Return true if this subprogram is C++11 noreturn or C11 _Noreturn
1438 bool isNoReturn() const {
1439 return getFlags() & FlagNoReturn;
1440 }
1434 bool isNoReturn() const { return getFlags() & FlagNoReturn; }
14411435
14421436 DIScopeRef getScope() const { return DIScopeRef(getRawScope()); }
14431437
19901984 public:
19911985 DEFINE_MDNODE_GET(DILocalVariable,
19921986 (DILocalScope * Scope, StringRef Name, DIFile *File,
1993 unsigned Line, DITypeRef Type, unsigned Arg, DIFlags Flags),
1987 unsigned Line, DITypeRef Type, unsigned Arg,
1988 DIFlags Flags),
19941989 (Scope, Name, File, Line, Type, Arg, Flags))
19951990 DEFINE_MDNODE_GET(DILocalVariable,
19961991 (Metadata * Scope, MDString *Name, Metadata *File,
1997 unsigned Line, Metadata *Type, unsigned Arg, DIFlags Flags),
1992 unsigned Line, Metadata *Type, unsigned Arg,
1993 DIFlags Flags),
19981994 (Scope, Name, File, Line, Type, Arg, Flags))
19991995
20001996 TempDILocalVariable clone() const { return cloneImpl(); }
24152415 IsDistinct = Record[0];
24162416 DINode::DIFlags Flags = static_cast(Record[10]);
24172417 MetadataList.assignValue(
2418 GET_OR_DISTINCT(
2419 DIDerivedType,
2420 (Context, Record[1], getMDString(Record[2]),
2421 getMDOrNull(Record[3]), Record[4], getDITypeRefOrNull(Record[5]),
2422 getDITypeRefOrNull(Record[6]), Record[7], Record[8], Record[9],
2423 Flags, getDITypeRefOrNull(Record[11]))),
2418 GET_OR_DISTINCT(DIDerivedType,
2419 (Context, Record[1], getMDString(Record[2]),
2420 getMDOrNull(Record[3]), Record[4],
2421 getDITypeRefOrNull(Record[5]),
2422 getDITypeRefOrNull(Record[6]), Record[7], Record[8],
2423 Record[9], Flags, getDITypeRefOrNull(Record[11]))),
24242424 NextMetadataNo++);
24252425 break;
24262426 }
25522552 bool HasThisAdj = Record.size() >= 20;
25532553 DISubprogram *SP = GET_OR_DISTINCT(
25542554 DISubprogram, (Context,
2555 getDITypeRefOrNull(Record[1]), // scope
2556 getMDString(Record[2]), // name
2557 getMDString(Record[3]), // linkageName
2558 getMDOrNull(Record[4]), // file
2559 Record[5], // line
2560 getMDOrNull(Record[6]), // type
2561 Record[7], // isLocal
2562 Record[8], // isDefinition
2563 Record[9], // scopeLine
2564 getDITypeRefOrNull(Record[10]), // containingType
2565 Record[11], // virtuality
2566 Record[12], // virtualIndex
2567 HasThisAdj ? Record[19] : 0, // thisAdjustment
2568 static_cast(
2569 Record[13] // flags
2570 ),
2555 getDITypeRefOrNull(Record[1]), // scope
2556 getMDString(Record[2]), // name
2557 getMDString(Record[3]), // linkageName
2558 getMDOrNull(Record[4]), // file
2559 Record[5], // line
2560 getMDOrNull(Record[6]), // type
2561 Record[7], // isLocal
2562 Record[8], // isDefinition
2563 Record[9], // scopeLine
2564 getDITypeRefOrNull(Record[10]), // containingType
2565 Record[11], // virtuality
2566 Record[12], // virtualIndex
2567 HasThisAdj ? Record[19] : 0, // thisAdjustment
2568 static_cast(Record[13] // flags
2569 ),
25712570 Record[14], // isOptimized
25722571 HasUnit ? CUorFn : nullptr, // unit
25732572 getMDOrNull(Record[15 + Offset]), // templateParams
286286 IntegerType::get(VMContext, 64), StorageOffsetInBits)));
287287 }
288288
289 DIDerivedType *DIBuilder::createStaticMemberType(DIScope *Scope, StringRef Name,
290 DIFile *File,
291 unsigned LineNumber,
292 DIType *Ty, DINode::DIFlags Flags,
293 llvm::Constant *Val) {
289 DIDerivedType *
290 DIBuilder::createStaticMemberType(DIScope *Scope, StringRef Name, DIFile *File,
291 unsigned LineNumber, DIType *Ty,
292 DINode::DIFlags Flags, llvm::Constant *Val) {
294293 Flags |= DINode::FlagStaticMember;
295294 return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
296295 LineNumber, getNonCompileUnitScope(Scope), Ty, 0, 0,
297296 0, Flags, getConstantOrNull(Val));
298297 }
299298
300 DIDerivedType *DIBuilder::createObjCIVar(StringRef Name, DIFile *File,
301 unsigned LineNumber,
302 uint64_t SizeInBits,
303 uint64_t AlignInBits,
304 uint64_t OffsetInBits, DINode::DIFlags Flags,
305 DIType *Ty, MDNode *PropertyNode) {
299 DIDerivedType *
300 DIBuilder::createObjCIVar(StringRef Name, DIFile *File, unsigned LineNumber,
301 uint64_t SizeInBits, uint64_t AlignInBits,
302 uint64_t OffsetInBits, DINode::DIFlags Flags,
303 DIType *Ty, MDNode *PropertyNode) {
306304 return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
307305 LineNumber, getNonCompileUnitScope(File), Ty,
308306 SizeInBits, AlignInBits, OffsetInBits, Flags,
399397 }
400398
401399 DISubroutineType *DIBuilder::createSubroutineType(DITypeRefArray ParameterTypes,
402 DINode::DIFlags Flags, unsigned CC) {
400 DINode::DIFlags Flags,
401 unsigned CC) {
403402 return DISubroutineType::get(VMContext, Flags, CC, ParameterTypes);
404403 }
405404
628627 DISubprogram *DIBuilder::createFunction(
629628 DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
630629 unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
631 bool isDefinition, unsigned ScopeLine, DINode::DIFlags Flags, bool isOptimized,
632 DITemplateParameterArray TParams, DISubprogram *Decl) {
630 bool isDefinition, unsigned ScopeLine, DINode::DIFlags Flags,
631 bool isOptimized, DITemplateParameterArray TParams, DISubprogram *Decl) {
633632 auto *Node = getSubprogram(
634633 /* IsDistinct = */ isDefinition, VMContext,
635634 getNonCompileUnitScope(Context), Name, LinkageName, File, LineNo, Ty,
646645 DISubprogram *DIBuilder::createTempFunctionFwdDecl(
647646 DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
648647 unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
649 bool isDefinition, unsigned ScopeLine, DINode::DIFlags Flags, bool isOptimized,
650 DITemplateParameterArray TParams, DISubprogram *Decl) {
648 bool isDefinition, unsigned ScopeLine, DINode::DIFlags Flags,
649 bool isOptimized, DITemplateParameterArray TParams, DISubprogram *Decl) {
651650 return DISubprogram::getTemporary(
652651 VMContext, getNonCompileUnitScope(Context), Name, LinkageName,
653652 File, LineNo, Ty, isLocalToUnit, isDefinition, ScopeLine, nullptr,
656655 .release();
657656 }
658657
659 DISubprogram *
660 DIBuilder::createMethod(DIScope *Context, StringRef Name, StringRef LinkageName,
661 DIFile *F, unsigned LineNo, DISubroutineType *Ty,
662 bool isLocalToUnit, bool isDefinition, unsigned VK,
663 unsigned VIndex, int ThisAdjustment,
664 DIType *VTableHolder, DINode::DIFlags Flags, bool isOptimized,
665 DITemplateParameterArray TParams) {
658 DISubprogram *DIBuilder::createMethod(DIScope *Context, StringRef Name,
659 StringRef LinkageName, DIFile *F,
660 unsigned LineNo, DISubroutineType *Ty,
661 bool isLocalToUnit, bool isDefinition,
662 unsigned VK, unsigned VIndex,
663 int ThisAdjustment, DIType *VTableHolder,
664 DINode::DIFlags Flags, bool isOptimized,
665 DITemplateParameterArray TParams) {
666666 assert(getNonCompileUnitScope(Context) &&
667667 "Methods should have both a Context and a context that isn't "
668668 "the compile unit.");
8282 }
8383
8484 DINode::DIFlags DINode::splitFlags(DIFlags Flags,
85 SmallVectorImpl &SplitFlags) {
85 SmallVectorImpl &SplitFlags) {
8686 // Accessibility and member pointer flags need to be specially handled, since
8787 // they're packed together.
8888 if (DIFlags A = Flags & FlagAccessibility) {
332332 return Context.pImpl->DITypeMap->lookup(&Identifier);
333333 }
334334
335 DISubroutineType *DISubroutineType::getImpl(LLVMContext &Context,
336 DIFlags Flags, uint8_t CC,
337 Metadata *TypeArray,
335 DISubroutineType *DISubroutineType::getImpl(LLVMContext &Context, DIFlags Flags,
336 uint8_t CC, Metadata *TypeArray,
338337 StorageType Storage,
339338 bool ShouldCreate) {
340339 DEFINE_GETIMPL_LOOKUP(DISubroutineType, (Flags, CC, TypeArray));
7070 CHECK_SPLIT(DINode::FlagProtected, {DINode::FlagProtected}, DINode::FlagZero);
7171 CHECK_SPLIT(DINode::FlagPrivate, {DINode::FlagPrivate}, DINode::FlagZero);
7272 CHECK_SPLIT(DINode::FlagVector, {DINode::FlagVector}, DINode::FlagZero);
73 CHECK_SPLIT(DINode::FlagRValueReference, {DINode::FlagRValueReference}, DINode::FlagZero);
73 CHECK_SPLIT(DINode::FlagRValueReference, {DINode::FlagRValueReference},
74 DINode::FlagZero);
7475 DINode::DIFlags Flags[] = {DINode::FlagFwdDecl, DINode::FlagVector};
75 CHECK_SPLIT(DINode::FlagFwdDecl | DINode::FlagVector, Flags, DINode::FlagZero);
76 CHECK_SPLIT(DINode::FlagFwdDecl | DINode::FlagVector, Flags,
77 DINode::FlagZero);
7678 CHECK_SPLIT(DINode::FlagZero, {}, DINode::FlagZero);
7779 #undef CHECK_SPLIT
7880 }
4343
4444 // Check that we get it back, even if we change a field.
4545 EXPECT_EQ(&CT, DICompositeType::getODRTypeIfExists(Context, UUID));
46 EXPECT_EQ(
47 &CT, DICompositeType::getODRType(Context, UUID, dwarf::DW_TAG_class_type,
48 nullptr, nullptr, 0, nullptr, nullptr, 0,
49 0, 0, DINode::FlagZero, nullptr, 0,
50 nullptr, nullptr));
5146 EXPECT_EQ(&CT, DICompositeType::getODRType(
52 Context, UUID, dwarf::DW_TAG_class_type,
53 MDString::get(Context, "name"), nullptr, 0, nullptr,
54 nullptr, 0, 0, 0, DINode::FlagZero, nullptr, 0,
47 Context, UUID, dwarf::DW_TAG_class_type, nullptr, nullptr,
48 0, nullptr, nullptr, 0, 0, 0, DINode::FlagZero, nullptr, 0,
5549 nullptr, nullptr));
50 EXPECT_EQ(&CT,
51 DICompositeType::getODRType(
52 Context, UUID, dwarf::DW_TAG_class_type,
53 MDString::get(Context, "name"), nullptr, 0, nullptr, nullptr, 0,
54 0, 0, DINode::FlagZero, nullptr, 0, nullptr, nullptr));
5655
5756 // Check that it's discarded with the type map.
5857 Context.disableDebugTypeODRUniquing();
8382
8483 // Update with a definition. This time we should see a change.
8584 EXPECT_EQ(&CT, DICompositeType::buildODRType(
86 Context, UUID, dwarf::DW_TAG_structure_type, nullptr, nullptr, 0, nullptr,
87 nullptr, 0, 0, 0, DINode::FlagZero, nullptr, 0, nullptr, nullptr));
85 Context, UUID, dwarf::DW_TAG_structure_type, nullptr,
86 nullptr, 0, nullptr, nullptr, 0, 0, 0, DINode::FlagZero,
87 nullptr, 0, nullptr, nullptr));
8888 EXPECT_EQ(dwarf::DW_TAG_structure_type, CT.getTag());
8989
9090 // Further updates should be ignored.
9393 nullptr, 0, 0, 0, DINode::FlagFwdDecl, nullptr, 0, nullptr, nullptr));
9494 EXPECT_EQ(dwarf::DW_TAG_structure_type, CT.getTag());
9595 EXPECT_EQ(&CT, DICompositeType::buildODRType(
96 Context, UUID, dwarf::DW_TAG_class_type, nullptr, nullptr, 0, nullptr,
97 nullptr, 0, 0, 0, DINode::FlagZero, nullptr, 0, nullptr, nullptr));
96 Context, UUID, dwarf::DW_TAG_class_type, nullptr, nullptr,
97 0, nullptr, nullptr, 0, 0, 0, DINode::FlagZero, nullptr, 0,
98 nullptr, nullptr));
9899 EXPECT_EQ(dwarf::DW_TAG_structure_type, CT.getTag());
99100 }
100101
342342 auto CU = DIB.createCompileUnit(dwarf::DW_LANG_Cobol74, "F.CBL", "/",
343343 "llvm-cobol74", true, "", 0);
344344 auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
345 auto SP =
346 DIB.createFunction(CU, "foo", "", File, 1, Type, false, true, 1,
347 DINode::FlagZero, true);
345 auto SP = DIB.createFunction(CU, "foo", "", File, 1, Type, false, true, 1,
346 DINode::FlagZero, true);
348347 F->setSubprogram(SP);
349348 AllocaInst *I = Builder.CreateAlloca(Builder.getInt8Ty());
350 auto BarSP =
351 DIB.createFunction(CU, "bar", "", File, 1, Type, false, true, 1,
352 DINode::FlagZero, true);
349 auto BarSP = DIB.createFunction(CU, "bar", "", File, 1, Type, false, true, 1,
350 DINode::FlagZero, true);
353351 auto BadScope = DIB.createLexicalBlockFile(BarSP, File, 0);
354352 I->setDebugLoc(DebugLoc::get(2, 0, BadScope));
355353 DIB.finalize();
7979
8080 MDTuple *getTuple() { return MDTuple::getDistinct(Context, None); }
8181 DISubroutineType *getSubroutineType() {
82 return DISubroutineType::getDistinct(Context, DINode::FlagZero,
83 0, getNode(nullptr));
82 return DISubroutineType::getDistinct(Context, DINode::FlagZero, 0,
83 getNode(nullptr));
8484 }
8585 DISubprogram *getSubprogram() {
8686 return DISubprogram::getDistinct(Context, nullptr, "", "", nullptr, 0,
87 nullptr, false, false, 0, nullptr,
88 0, 0, 0, DINode::FlagZero, false, nullptr);
87 nullptr, false, false, 0, nullptr, 0, 0, 0,
88 DINode::FlagZero, false, nullptr);
8989 }
9090 DIFile *getFile() {
9191 return DIFile::getDistinct(Context, "file.c", "/path/to/dir");
100100 return DIBasicType::get(Context, dwarf::DW_TAG_unspecified_type, Name);
101101 }
102102 DIType *getDerivedType() {
103 return DIDerivedType::getDistinct(Context, dwarf::DW_TAG_pointer_type, "",
104 nullptr, 0, nullptr,
105 getBasicType("basictype"),
106 1, 2, 0, DINode::FlagZero);
103 return DIDerivedType::getDistinct(
104 Context, dwarf::DW_TAG_pointer_type, "", nullptr, 0, nullptr,
105 getBasicType("basictype"), 1, 2, 0, DINode::FlagZero);
107106 }
108107 Constant *getConstant() {
109108 return ConstantInt::get(Type::getInt32Ty(Context), Counter++);
10291028 Metadata *TypesOps[] = {nullptr};
10301029 Metadata *Types = MDTuple::get(Context, TypesOps);
10311030
1032 DIType *D = DISubroutineType::getDistinct(Context, DINode::FlagZero,
1033 0, Types);
1031 DIType *D =
1032 DISubroutineType::getDistinct(Context, DINode::FlagZero, 0, Types);
10341033 EXPECT_EQ(DINode::FlagZero, D->getFlags());
10351034 D->setFlags(DINode::FlagRValueReference);
10361035 EXPECT_EQ(DINode::FlagRValueReference, D->getFlags());
10371036 D->setFlags(DINode::FlagZero);
10381037 EXPECT_EQ(DINode::FlagZero, D->getFlags());
10391038
1040 TempDIType T = DISubroutineType::getTemporary(Context, DINode::FlagZero,
1041 0, Types);
1039 TempDIType T =
1040 DISubroutineType::getTemporary(Context, DINode::FlagZero, 0, Types);
10421041 EXPECT_EQ(DINode::FlagZero, T->getFlags());
10431042 T->setFlags(DINode::FlagRValueReference);
10441043 EXPECT_EQ(DINode::FlagRValueReference, T->getFlags());
10561055 DINode::DIFlags Flags5 = static_cast(5);
10571056 DINode::DIFlags Flags4 = static_cast(4);
10581057
1059 auto *N = DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type, "something",
1060 File, 1, Scope, BaseType, 2, 3, 4,
1061 Flags5, ExtraData);
1058 auto *N =
1059 DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type, "something", File,
1060 1, Scope, BaseType, 2, 3, 4, Flags5, ExtraData);
10621061 EXPECT_EQ(dwarf::DW_TAG_pointer_type, N->getTag());
10631062 EXPECT_EQ("something", N->getName());
10641063 EXPECT_EQ(File, N->getFile());
10781077 "something", File, 1, Scope, BaseType, 2, 3,
10791078 4, Flags5, ExtraData));
10801079 EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type, "else",
1081 File, 1, Scope, BaseType, 2, 3, 4,
1082 Flags5, ExtraData));
1080 File, 1, Scope, BaseType, 2, 3, 4, Flags5,
1081 ExtraData));
10831082 EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
10841083 "something", getFile(), 1, Scope, BaseType, 2,
10851084 3, 4, Flags5, ExtraData));
11191118 MDTuple *ExtraData = getTuple();
11201119 DINode::DIFlags Flags = static_cast(5);
11211120
1122 auto *N = DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type, "something",
1123 File, 1, Scope, BaseType, UINT64_MAX,
1124 UINT64_MAX - 1, UINT64_MAX - 2, Flags, ExtraData);
1121 auto *N = DIDerivedType::get(
1122 Context, dwarf::DW_TAG_pointer_type, "something", File, 1, Scope,
1123 BaseType, UINT64_MAX, UINT64_MAX - 1, UINT64_MAX - 2, Flags, ExtraData);
11251124 EXPECT_EQ(UINT64_MAX, N->getSizeInBits());
11261125 EXPECT_EQ(UINT64_MAX - 1, N->getAlignInBits());
11271126 EXPECT_EQ(UINT64_MAX - 2, N->getOffsetInBits());
234234 DBuilder.createCompileUnit(dwarf::DW_LANG_C99, "filename.c",
235235 "/file/dir", "CloneFunc", false, "", 0);
236236
237 auto *Subprogram = DBuilder.createFunction(
238 CU, "f", "f", File, 4, FuncType, true, true, 3, DINode::FlagZero, false);
237 auto *Subprogram =
238 DBuilder.createFunction(CU, "f", "f", File, 4, FuncType, true, true, 3,
239 DINode::FlagZero, false);
239240 OldFunc->setSubprogram(Subprogram);
240241
241242 // Function body
420421 DBuilder.createCompileUnit(dwarf::DW_LANG_C99, "filename.c",
421422 "/file/dir", "CloneModule", false, "", 0);
422423 // Function DI
423 auto *Subprogram = DBuilder.createFunction(CU, "f", "f", File, 4, DFuncType,
424 true, true, 3, DINode::FlagZero,
425 false);
424 auto *Subprogram =
425 DBuilder.createFunction(CU, "f", "f", File, 4, DFuncType, true, true, 3,
426 DINode::FlagZero, false);
426427 F->setSubprogram(Subprogram);
427428
428429 auto *Entry = BasicBlock::Create(C, "", F);