mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-06 23:31:48 +00:00
DebugInfo: use strongly typed enum for debug info flags
Use ADT/BitmaskEnum for DINode::DIFlags for the following purposes: Get rid of unsigned int for flags to avoid problems on platforms with sizeof(int) < 4 Flags are now strongly typed Patch by: Victor Leschuk <vleschuk@gmail.com> Differential Revision: https://reviews.llvm.org/D23766 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280700 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4b1b5a450d
commit
d9478f8605
include/llvm/IR
lib
AsmParser
Bitcode/Reader
IR
unittests
@ -148,7 +148,7 @@ namespace llvm {
|
|||||||
DIDerivedType *createMemberPointerType(DIType *PointeeTy, DIType *Class,
|
DIDerivedType *createMemberPointerType(DIType *PointeeTy, DIType *Class,
|
||||||
uint64_t SizeInBits,
|
uint64_t SizeInBits,
|
||||||
uint64_t AlignInBits = 0,
|
uint64_t AlignInBits = 0,
|
||||||
unsigned Flags = 0);
|
DINode::DIFlags Flags = DINode::FlagZero);
|
||||||
|
|
||||||
/// Create debugging information entry for a c++
|
/// Create debugging information entry for a c++
|
||||||
/// style reference or rvalue reference type.
|
/// style reference or rvalue reference type.
|
||||||
@ -176,7 +176,8 @@ namespace llvm {
|
|||||||
/// \param Flags Flags to describe inheritance attribute,
|
/// \param Flags Flags to describe inheritance attribute,
|
||||||
/// e.g. private
|
/// e.g. private
|
||||||
DIDerivedType *createInheritance(DIType *Ty, DIType *BaseTy,
|
DIDerivedType *createInheritance(DIType *Ty, DIType *BaseTy,
|
||||||
uint64_t BaseOffset, unsigned Flags);
|
uint64_t BaseOffset,
|
||||||
|
DINode::DIFlags Flags);
|
||||||
|
|
||||||
/// Create debugging information entry for a member.
|
/// Create debugging information entry for a member.
|
||||||
/// \param Scope Member scope.
|
/// \param Scope Member scope.
|
||||||
@ -191,7 +192,8 @@ namespace llvm {
|
|||||||
DIDerivedType *createMemberType(DIScope *Scope, StringRef Name,
|
DIDerivedType *createMemberType(DIScope *Scope, StringRef Name,
|
||||||
DIFile *File, unsigned LineNo,
|
DIFile *File, unsigned LineNo,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||||
uint64_t OffsetInBits, unsigned Flags,
|
uint64_t OffsetInBits,
|
||||||
|
DINode::DIFlags Flags,
|
||||||
DIType *Ty);
|
DIType *Ty);
|
||||||
|
|
||||||
/// Create debugging information entry for a bit field member.
|
/// Create debugging information entry for a bit field member.
|
||||||
@ -208,7 +210,7 @@ namespace llvm {
|
|||||||
DIDerivedType *createBitFieldMemberType(
|
DIDerivedType *createBitFieldMemberType(
|
||||||
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
|
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||||
uint64_t StorageOffsetInBits, unsigned Flags, DIType *Ty);
|
uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty);
|
||||||
|
|
||||||
/// Create debugging information entry for a
|
/// Create debugging information entry for a
|
||||||
/// C++ static data member.
|
/// C++ static data member.
|
||||||
@ -221,7 +223,7 @@ namespace llvm {
|
|||||||
/// \param Val Const initializer of the member.
|
/// \param Val Const initializer of the member.
|
||||||
DIDerivedType *createStaticMemberType(DIScope *Scope, StringRef Name,
|
DIDerivedType *createStaticMemberType(DIScope *Scope, StringRef Name,
|
||||||
DIFile *File, unsigned LineNo,
|
DIFile *File, unsigned LineNo,
|
||||||
DIType *Ty, unsigned Flags,
|
DIType *Ty, DINode::DIFlags Flags,
|
||||||
llvm::Constant *Val);
|
llvm::Constant *Val);
|
||||||
|
|
||||||
/// Create debugging information entry for Objective-C
|
/// Create debugging information entry for Objective-C
|
||||||
@ -237,7 +239,7 @@ namespace llvm {
|
|||||||
/// \param PropertyNode Property associated with this ivar.
|
/// \param PropertyNode Property associated with this ivar.
|
||||||
DIDerivedType *createObjCIVar(StringRef Name, DIFile *File, unsigned LineNo,
|
DIDerivedType *createObjCIVar(StringRef Name, DIFile *File, unsigned LineNo,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||||
uint64_t OffsetInBits, unsigned Flags,
|
uint64_t OffsetInBits, DINode::DIFlags Flags,
|
||||||
DIType *Ty, MDNode *PropertyNode);
|
DIType *Ty, MDNode *PropertyNode);
|
||||||
|
|
||||||
/// Create debugging information entry for Objective-C
|
/// Create debugging information entry for Objective-C
|
||||||
@ -274,7 +276,8 @@ namespace llvm {
|
|||||||
DICompositeType *createClassType(DIScope *Scope, StringRef Name,
|
DICompositeType *createClassType(DIScope *Scope, StringRef Name,
|
||||||
DIFile *File, unsigned LineNumber,
|
DIFile *File, unsigned LineNumber,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||||
uint64_t OffsetInBits, unsigned Flags,
|
uint64_t OffsetInBits,
|
||||||
|
DINode::DIFlags Flags,
|
||||||
DIType *DerivedFrom, DINodeArray Elements,
|
DIType *DerivedFrom, DINodeArray Elements,
|
||||||
DIType *VTableHolder = nullptr,
|
DIType *VTableHolder = nullptr,
|
||||||
MDNode *TemplateParms = nullptr,
|
MDNode *TemplateParms = nullptr,
|
||||||
@ -293,7 +296,7 @@ namespace llvm {
|
|||||||
/// \param UniqueIdentifier A unique identifier for the struct.
|
/// \param UniqueIdentifier A unique identifier for the struct.
|
||||||
DICompositeType *createStructType(
|
DICompositeType *createStructType(
|
||||||
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
|
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
|
uint64_t SizeInBits, uint64_t AlignInBits, DINode::DIFlags Flags,
|
||||||
DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0,
|
DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0,
|
||||||
DIType *VTableHolder = nullptr, StringRef UniqueIdentifier = "");
|
DIType *VTableHolder = nullptr, StringRef UniqueIdentifier = "");
|
||||||
|
|
||||||
@ -311,7 +314,8 @@ namespace llvm {
|
|||||||
DICompositeType *createUnionType(DIScope *Scope, StringRef Name,
|
DICompositeType *createUnionType(DIScope *Scope, StringRef Name,
|
||||||
DIFile *File, unsigned LineNumber,
|
DIFile *File, unsigned LineNumber,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||||
unsigned Flags, DINodeArray Elements,
|
DINode::DIFlags Flags,
|
||||||
|
DINodeArray Elements,
|
||||||
unsigned RunTimeLang = 0,
|
unsigned RunTimeLang = 0,
|
||||||
StringRef UniqueIdentifier = "");
|
StringRef UniqueIdentifier = "");
|
||||||
|
|
||||||
@ -393,7 +397,8 @@ namespace llvm {
|
|||||||
/// These flags are used to emit dwarf attributes.
|
/// These flags are used to emit dwarf attributes.
|
||||||
/// \param CC Calling convention, e.g. dwarf::DW_CC_normal
|
/// \param CC Calling convention, e.g. dwarf::DW_CC_normal
|
||||||
DISubroutineType *createSubroutineType(DITypeRefArray ParameterTypes,
|
DISubroutineType *createSubroutineType(DITypeRefArray ParameterTypes,
|
||||||
unsigned Flags = 0, unsigned CC = 0);
|
DINode::DIFlags Flags = DINode::FlagZero,
|
||||||
|
unsigned CC = 0);
|
||||||
|
|
||||||
/// Create an external type reference.
|
/// Create an external type reference.
|
||||||
/// \param Tag Dwarf TAG.
|
/// \param Tag Dwarf TAG.
|
||||||
@ -421,7 +426,7 @@ namespace llvm {
|
|||||||
DICompositeType *createReplaceableCompositeType(
|
DICompositeType *createReplaceableCompositeType(
|
||||||
unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
|
unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
|
||||||
unsigned RuntimeLang = 0, uint64_t SizeInBits = 0,
|
unsigned RuntimeLang = 0, uint64_t SizeInBits = 0,
|
||||||
uint64_t AlignInBits = 0, unsigned Flags = DINode::FlagFwdDecl,
|
uint64_t AlignInBits = 0, DINode::DIFlags Flags = DINode::FlagFwdDecl,
|
||||||
StringRef UniqueIdentifier = "");
|
StringRef UniqueIdentifier = "");
|
||||||
|
|
||||||
/// Retain DIScope* in a module even if it is not referenced
|
/// Retain DIScope* in a module even if it is not referenced
|
||||||
@ -480,7 +485,7 @@ namespace llvm {
|
|||||||
DIFile *File, unsigned LineNo,
|
DIFile *File, unsigned LineNo,
|
||||||
DIType *Ty,
|
DIType *Ty,
|
||||||
bool AlwaysPreserve = false,
|
bool AlwaysPreserve = false,
|
||||||
unsigned Flags = 0);
|
DINode::DIFlags Flags = DINode::FlagZero);
|
||||||
|
|
||||||
/// Create a new descriptor for a parameter variable.
|
/// Create a new descriptor for a parameter variable.
|
||||||
///
|
///
|
||||||
@ -497,7 +502,7 @@ namespace llvm {
|
|||||||
unsigned ArgNo, DIFile *File,
|
unsigned ArgNo, DIFile *File,
|
||||||
unsigned LineNo, DIType *Ty,
|
unsigned LineNo, DIType *Ty,
|
||||||
bool AlwaysPreserve = false,
|
bool AlwaysPreserve = false,
|
||||||
unsigned Flags = 0);
|
DINode::DIFlags Flags = DINode::FlagZero);
|
||||||
|
|
||||||
/// Create a new descriptor for the specified
|
/// Create a new descriptor for the specified
|
||||||
/// variable which has a complex address expression for its address.
|
/// variable which has a complex address expression for its address.
|
||||||
@ -532,7 +537,8 @@ namespace llvm {
|
|||||||
StringRef LinkageName, DIFile *File,
|
StringRef LinkageName, DIFile *File,
|
||||||
unsigned LineNo, DISubroutineType *Ty,
|
unsigned LineNo, DISubroutineType *Ty,
|
||||||
bool isLocalToUnit, bool isDefinition,
|
bool isLocalToUnit, bool isDefinition,
|
||||||
unsigned ScopeLine, unsigned Flags = 0,
|
unsigned ScopeLine,
|
||||||
|
DINode::DIFlags Flags = DINode::FlagZero,
|
||||||
bool isOptimized = false,
|
bool isOptimized = false,
|
||||||
DITemplateParameterArray TParams = nullptr,
|
DITemplateParameterArray TParams = nullptr,
|
||||||
DISubprogram *Decl = nullptr);
|
DISubprogram *Decl = nullptr);
|
||||||
@ -542,7 +548,8 @@ namespace llvm {
|
|||||||
DISubprogram *createTempFunctionFwdDecl(
|
DISubprogram *createTempFunctionFwdDecl(
|
||||||
DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
|
DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
|
||||||
unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
|
unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
|
||||||
bool isDefinition, unsigned ScopeLine, unsigned Flags = 0,
|
bool isDefinition, unsigned ScopeLine,
|
||||||
|
DINode::DIFlags Flags = DINode::FlagZero,
|
||||||
bool isOptimized = false, DITemplateParameterArray TParams = nullptr,
|
bool isOptimized = false, DITemplateParameterArray TParams = nullptr,
|
||||||
DISubprogram *Decl = nullptr);
|
DISubprogram *Decl = nullptr);
|
||||||
|
|
||||||
@ -573,7 +580,8 @@ namespace llvm {
|
|||||||
DIFile *File, unsigned LineNo, DISubroutineType *Ty,
|
DIFile *File, unsigned LineNo, DISubroutineType *Ty,
|
||||||
bool isLocalToUnit, bool isDefinition, unsigned Virtuality = 0,
|
bool isLocalToUnit, bool isDefinition, unsigned Virtuality = 0,
|
||||||
unsigned VTableIndex = 0, int ThisAdjustment = 0,
|
unsigned VTableIndex = 0, int ThisAdjustment = 0,
|
||||||
DIType *VTableHolder = nullptr, unsigned Flags = 0,
|
DIType *VTableHolder = nullptr,
|
||||||
|
DINode::DIFlags Flags = DINode::FlagZero,
|
||||||
bool isOptimized = false,
|
bool isOptimized = false,
|
||||||
DITemplateParameterArray TParams = nullptr);
|
DITemplateParameterArray TParams = nullptr);
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#error "Missing macro definition of HANDLE_DI_FLAG"
|
#error "Missing macro definition of HANDLE_DI_FLAG"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
HANDLE_DI_FLAG(0, Zero) // Use it as zero value. For example: void foo(DIFlags Flags = FlagZero).
|
||||||
HANDLE_DI_FLAG(1, Private)
|
HANDLE_DI_FLAG(1, Private)
|
||||||
HANDLE_DI_FLAG(2, Protected)
|
HANDLE_DI_FLAG(2, Protected)
|
||||||
HANDLE_DI_FLAG(3, Public)
|
HANDLE_DI_FLAG(3, Public)
|
||||||
@ -40,4 +41,11 @@ HANDLE_DI_FLAG((1 << 18), IntroducedVirtual)
|
|||||||
HANDLE_DI_FLAG((1 << 19), BitField)
|
HANDLE_DI_FLAG((1 << 19), BitField)
|
||||||
HANDLE_DI_FLAG((1 << 20), NoReturn)
|
HANDLE_DI_FLAG((1 << 20), NoReturn)
|
||||||
|
|
||||||
|
#ifdef DI_FLAG_LARGEST_NEEDED
|
||||||
|
// intended to be used with ADT/BitmaskEnum.h
|
||||||
|
// NOTE: always must be equal to largest flag, check this when adding new flag
|
||||||
|
HANDLE_DI_FLAG((1 << 20), Largest)
|
||||||
|
#undef DI_FLAG_LARGEST_NEEDED
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef HANDLE_DI_FLAG
|
#undef HANDLE_DI_FLAG
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "llvm/IR/Metadata.h"
|
#include "llvm/IR/Metadata.h"
|
||||||
#include "llvm/Support/Dwarf.h"
|
#include "llvm/Support/Dwarf.h"
|
||||||
|
#include "llvm/ADT/BitmaskEnum.h"
|
||||||
|
|
||||||
// Helper macros for defining get() overrides.
|
// Helper macros for defining get() overrides.
|
||||||
#define DEFINE_MDNODE_GET_UNPACK_IMPL(...) __VA_ARGS__
|
#define DEFINE_MDNODE_GET_UNPACK_IMPL(...) __VA_ARGS__
|
||||||
@ -171,23 +172,25 @@ public:
|
|||||||
///
|
///
|
||||||
/// The three accessibility flags are mutually exclusive and rolled together
|
/// The three accessibility flags are mutually exclusive and rolled together
|
||||||
/// in the first two bits.
|
/// in the first two bits.
|
||||||
enum DIFlags {
|
enum DIFlags : uint32_t {
|
||||||
#define HANDLE_DI_FLAG(ID, NAME) Flag##NAME = ID,
|
#define HANDLE_DI_FLAG(ID, NAME) Flag##NAME = ID,
|
||||||
|
#define DI_FLAG_LARGEST_NEEDED
|
||||||
#include "llvm/IR/DebugInfoFlags.def"
|
#include "llvm/IR/DebugInfoFlags.def"
|
||||||
FlagAccessibility = FlagPrivate | FlagProtected | FlagPublic,
|
FlagAccessibility = FlagPrivate | FlagProtected | FlagPublic,
|
||||||
FlagPtrToMemberRep = FlagSingleInheritance | FlagMultipleInheritance |
|
FlagPtrToMemberRep = FlagSingleInheritance | FlagMultipleInheritance |
|
||||||
FlagVirtualInheritance,
|
FlagVirtualInheritance,
|
||||||
|
LLVM_MARK_AS_BITMASK_ENUM(FlagLargest)
|
||||||
};
|
};
|
||||||
|
|
||||||
static unsigned getFlag(StringRef Flag);
|
static DIFlags getFlag(StringRef Flag);
|
||||||
static const char *getFlagString(unsigned Flag);
|
static const char *getFlagString(DIFlags Flag);
|
||||||
|
|
||||||
/// \brief Split up a flags bitfield.
|
/// \brief Split up a flags bitfield.
|
||||||
///
|
///
|
||||||
/// Split \c Flags into \c SplitFlags, a vector of its components. Returns
|
/// Split \c Flags into \c SplitFlags, a vector of its components. Returns
|
||||||
/// any remaining (unrecognized) bits.
|
/// any remaining (unrecognized) bits.
|
||||||
static unsigned splitFlags(unsigned Flags,
|
static DIFlags splitFlags(DIFlags Flags,
|
||||||
SmallVectorImpl<unsigned> &SplitFlags);
|
SmallVectorImpl<DIFlags> &SplitFlags);
|
||||||
|
|
||||||
static bool classof(const Metadata *MD) {
|
static bool classof(const Metadata *MD) {
|
||||||
switch (MD->getMetadataID()) {
|
switch (MD->getMetadataID()) {
|
||||||
@ -508,7 +511,7 @@ StringRef DIScope::getDirectory() const {
|
|||||||
/// TODO: Split up flags.
|
/// TODO: Split up flags.
|
||||||
class DIType : public DIScope {
|
class DIType : public DIScope {
|
||||||
unsigned Line;
|
unsigned Line;
|
||||||
unsigned Flags;
|
DIFlags Flags;
|
||||||
uint64_t SizeInBits;
|
uint64_t SizeInBits;
|
||||||
uint64_t AlignInBits;
|
uint64_t AlignInBits;
|
||||||
uint64_t OffsetInBits;
|
uint64_t OffsetInBits;
|
||||||
@ -516,14 +519,14 @@ class DIType : public DIScope {
|
|||||||
protected:
|
protected:
|
||||||
DIType(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag,
|
DIType(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag,
|
||||||
unsigned Line, uint64_t SizeInBits, uint64_t AlignInBits,
|
unsigned Line, uint64_t SizeInBits, uint64_t AlignInBits,
|
||||||
uint64_t OffsetInBits, unsigned Flags, ArrayRef<Metadata *> Ops)
|
uint64_t OffsetInBits, DIFlags Flags, ArrayRef<Metadata *> Ops)
|
||||||
: DIScope(C, ID, Storage, Tag, Ops) {
|
: DIScope(C, ID, Storage, Tag, Ops) {
|
||||||
init(Line, SizeInBits, AlignInBits, OffsetInBits, Flags);
|
init(Line, SizeInBits, AlignInBits, OffsetInBits, Flags);
|
||||||
}
|
}
|
||||||
~DIType() = default;
|
~DIType() = default;
|
||||||
|
|
||||||
void init(unsigned Line, uint64_t SizeInBits, uint64_t AlignInBits,
|
void init(unsigned Line, uint64_t SizeInBits, uint64_t AlignInBits,
|
||||||
uint64_t OffsetInBits, unsigned Flags) {
|
uint64_t OffsetInBits, DIFlags Flags) {
|
||||||
this->Line = Line;
|
this->Line = Line;
|
||||||
this->Flags = Flags;
|
this->Flags = Flags;
|
||||||
this->SizeInBits = SizeInBits;
|
this->SizeInBits = SizeInBits;
|
||||||
@ -533,7 +536,7 @@ protected:
|
|||||||
|
|
||||||
/// Change fields in place.
|
/// Change fields in place.
|
||||||
void mutate(unsigned Tag, unsigned Line, uint64_t SizeInBits,
|
void mutate(unsigned Tag, unsigned Line, uint64_t SizeInBits,
|
||||||
uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags) {
|
uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags) {
|
||||||
assert(isDistinct() && "Only distinct nodes can mutate");
|
assert(isDistinct() && "Only distinct nodes can mutate");
|
||||||
setTag(Tag);
|
setTag(Tag);
|
||||||
init(Line, SizeInBits, AlignInBits, OffsetInBits, Flags);
|
init(Line, SizeInBits, AlignInBits, OffsetInBits, Flags);
|
||||||
@ -548,7 +551,7 @@ public:
|
|||||||
uint64_t getSizeInBits() const { return SizeInBits; }
|
uint64_t getSizeInBits() const { return SizeInBits; }
|
||||||
uint64_t getAlignInBits() const { return AlignInBits; }
|
uint64_t getAlignInBits() const { return AlignInBits; }
|
||||||
uint64_t getOffsetInBits() const { return OffsetInBits; }
|
uint64_t getOffsetInBits() const { return OffsetInBits; }
|
||||||
unsigned getFlags() const { return Flags; }
|
DIFlags getFlags() const { return Flags; }
|
||||||
|
|
||||||
DIScopeRef getScope() const { return DIScopeRef(getRawScope()); }
|
DIScopeRef getScope() const { return DIScopeRef(getRawScope()); }
|
||||||
StringRef getName() const { return getStringOperand(2); }
|
StringRef getName() const { return getStringOperand(2); }
|
||||||
@ -557,7 +560,7 @@ public:
|
|||||||
Metadata *getRawScope() const { return getOperand(1); }
|
Metadata *getRawScope() const { return getOperand(1); }
|
||||||
MDString *getRawName() const { return getOperandAs<MDString>(2); }
|
MDString *getRawName() const { return getOperandAs<MDString>(2); }
|
||||||
|
|
||||||
void setFlags(unsigned NewFlags) {
|
void setFlags(DIFlags NewFlags) {
|
||||||
assert(!isUniqued() && "Cannot set flags on uniqued nodes");
|
assert(!isUniqued() && "Cannot set flags on uniqued nodes");
|
||||||
Flags = NewFlags;
|
Flags = NewFlags;
|
||||||
}
|
}
|
||||||
@ -614,7 +617,7 @@ class DIBasicType : public DIType {
|
|||||||
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Encoding,
|
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Encoding,
|
||||||
ArrayRef<Metadata *> Ops)
|
ArrayRef<Metadata *> Ops)
|
||||||
: DIType(C, DIBasicTypeKind, Storage, Tag, 0, SizeInBits, AlignInBits, 0,
|
: DIType(C, DIBasicTypeKind, Storage, Tag, 0, SizeInBits, AlignInBits, 0,
|
||||||
0, Ops),
|
FlagZero, Ops),
|
||||||
Encoding(Encoding) {}
|
Encoding(Encoding) {}
|
||||||
~DIBasicType() = default;
|
~DIBasicType() = default;
|
||||||
|
|
||||||
@ -668,7 +671,7 @@ class DIDerivedType : public DIType {
|
|||||||
|
|
||||||
DIDerivedType(LLVMContext &C, StorageType Storage, unsigned Tag,
|
DIDerivedType(LLVMContext &C, StorageType Storage, unsigned Tag,
|
||||||
unsigned Line, uint64_t SizeInBits, uint64_t AlignInBits,
|
unsigned Line, uint64_t SizeInBits, uint64_t AlignInBits,
|
||||||
uint64_t OffsetInBits, unsigned Flags, ArrayRef<Metadata *> Ops)
|
uint64_t OffsetInBits, DIFlags Flags, ArrayRef<Metadata *> Ops)
|
||||||
: DIType(C, DIDerivedTypeKind, Storage, Tag, Line, SizeInBits,
|
: DIType(C, DIDerivedTypeKind, Storage, Tag, Line, SizeInBits,
|
||||||
AlignInBits, OffsetInBits, Flags, Ops) {}
|
AlignInBits, OffsetInBits, Flags, Ops) {}
|
||||||
~DIDerivedType() = default;
|
~DIDerivedType() = default;
|
||||||
@ -677,7 +680,7 @@ class DIDerivedType : public DIType {
|
|||||||
StringRef Name, DIFile *File, unsigned Line,
|
StringRef Name, DIFile *File, unsigned Line,
|
||||||
DIScopeRef Scope, DITypeRef BaseType,
|
DIScopeRef Scope, DITypeRef BaseType,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||||
uint64_t OffsetInBits, unsigned Flags,
|
uint64_t OffsetInBits, DIFlags Flags,
|
||||||
Metadata *ExtraData, StorageType Storage,
|
Metadata *ExtraData, StorageType Storage,
|
||||||
bool ShouldCreate = true) {
|
bool ShouldCreate = true) {
|
||||||
return getImpl(Context, Tag, getCanonicalMDString(Context, Name), File,
|
return getImpl(Context, Tag, getCanonicalMDString(Context, Name), File,
|
||||||
@ -688,7 +691,7 @@ class DIDerivedType : public DIType {
|
|||||||
MDString *Name, Metadata *File, unsigned Line,
|
MDString *Name, Metadata *File, unsigned Line,
|
||||||
Metadata *Scope, Metadata *BaseType,
|
Metadata *Scope, Metadata *BaseType,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||||
uint64_t OffsetInBits, unsigned Flags,
|
uint64_t OffsetInBits, DIFlags Flags,
|
||||||
Metadata *ExtraData, StorageType Storage,
|
Metadata *ExtraData, StorageType Storage,
|
||||||
bool ShouldCreate = true);
|
bool ShouldCreate = true);
|
||||||
|
|
||||||
@ -704,7 +707,7 @@ public:
|
|||||||
(unsigned Tag, MDString *Name, Metadata *File,
|
(unsigned Tag, MDString *Name, Metadata *File,
|
||||||
unsigned Line, Metadata *Scope, Metadata *BaseType,
|
unsigned Line, Metadata *Scope, Metadata *BaseType,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||||
uint64_t OffsetInBits, unsigned Flags,
|
uint64_t OffsetInBits, DIFlags Flags,
|
||||||
Metadata *ExtraData = nullptr),
|
Metadata *ExtraData = nullptr),
|
||||||
(Tag, Name, File, Line, Scope, BaseType, SizeInBits,
|
(Tag, Name, File, Line, Scope, BaseType, SizeInBits,
|
||||||
AlignInBits, OffsetInBits, Flags, ExtraData))
|
AlignInBits, OffsetInBits, Flags, ExtraData))
|
||||||
@ -712,7 +715,7 @@ public:
|
|||||||
(unsigned Tag, StringRef Name, DIFile *File, unsigned Line,
|
(unsigned Tag, StringRef Name, DIFile *File, unsigned Line,
|
||||||
DIScopeRef Scope, DITypeRef BaseType, uint64_t SizeInBits,
|
DIScopeRef Scope, DITypeRef BaseType, uint64_t SizeInBits,
|
||||||
uint64_t AlignInBits, uint64_t OffsetInBits,
|
uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||||
unsigned Flags, Metadata *ExtraData = nullptr),
|
DIFlags Flags, Metadata *ExtraData = nullptr),
|
||||||
(Tag, Name, File, Line, Scope, BaseType, SizeInBits,
|
(Tag, Name, File, Line, Scope, BaseType, SizeInBits,
|
||||||
AlignInBits, OffsetInBits, Flags, ExtraData))
|
AlignInBits, OffsetInBits, Flags, ExtraData))
|
||||||
|
|
||||||
@ -772,7 +775,7 @@ class DICompositeType : public DIType {
|
|||||||
|
|
||||||
DICompositeType(LLVMContext &C, StorageType Storage, unsigned Tag,
|
DICompositeType(LLVMContext &C, StorageType Storage, unsigned Tag,
|
||||||
unsigned Line, unsigned RuntimeLang, uint64_t SizeInBits,
|
unsigned Line, unsigned RuntimeLang, uint64_t SizeInBits,
|
||||||
uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
|
uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags,
|
||||||
ArrayRef<Metadata *> Ops)
|
ArrayRef<Metadata *> Ops)
|
||||||
: DIType(C, DICompositeTypeKind, Storage, Tag, Line, SizeInBits,
|
: DIType(C, DICompositeTypeKind, Storage, Tag, Line, SizeInBits,
|
||||||
AlignInBits, OffsetInBits, Flags, Ops),
|
AlignInBits, OffsetInBits, Flags, Ops),
|
||||||
@ -782,7 +785,7 @@ class DICompositeType : public DIType {
|
|||||||
/// Change fields in place.
|
/// Change fields in place.
|
||||||
void mutate(unsigned Tag, unsigned Line, unsigned RuntimeLang,
|
void mutate(unsigned Tag, unsigned Line, unsigned RuntimeLang,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||||
unsigned Flags) {
|
DIFlags Flags) {
|
||||||
assert(isDistinct() && "Only distinct nodes can mutate");
|
assert(isDistinct() && "Only distinct nodes can mutate");
|
||||||
assert(getRawIdentifier() && "Only ODR-uniqued nodes should mutate");
|
assert(getRawIdentifier() && "Only ODR-uniqued nodes should mutate");
|
||||||
this->RuntimeLang = RuntimeLang;
|
this->RuntimeLang = RuntimeLang;
|
||||||
@ -793,7 +796,7 @@ class DICompositeType : public DIType {
|
|||||||
getImpl(LLVMContext &Context, unsigned Tag, StringRef Name, Metadata *File,
|
getImpl(LLVMContext &Context, unsigned Tag, StringRef Name, Metadata *File,
|
||||||
unsigned Line, DIScopeRef Scope, DITypeRef BaseType,
|
unsigned Line, DIScopeRef Scope, DITypeRef BaseType,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||||
uint64_t Flags, DINodeArray Elements, unsigned RuntimeLang,
|
DIFlags Flags, DINodeArray Elements, unsigned RuntimeLang,
|
||||||
DITypeRef VTableHolder, DITemplateParameterArray TemplateParams,
|
DITypeRef VTableHolder, DITemplateParameterArray TemplateParams,
|
||||||
StringRef Identifier, StorageType Storage, bool ShouldCreate = true) {
|
StringRef Identifier, StorageType Storage, bool ShouldCreate = true) {
|
||||||
return getImpl(
|
return getImpl(
|
||||||
@ -806,7 +809,7 @@ class DICompositeType : public DIType {
|
|||||||
getImpl(LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
|
getImpl(LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
|
||||||
unsigned Line, Metadata *Scope, Metadata *BaseType,
|
unsigned Line, Metadata *Scope, Metadata *BaseType,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||||
unsigned Flags, Metadata *Elements, unsigned RuntimeLang,
|
DIFlags Flags, Metadata *Elements, unsigned RuntimeLang,
|
||||||
Metadata *VTableHolder, Metadata *TemplateParams,
|
Metadata *VTableHolder, Metadata *TemplateParams,
|
||||||
MDString *Identifier, StorageType Storage, bool ShouldCreate = true);
|
MDString *Identifier, StorageType Storage, bool ShouldCreate = true);
|
||||||
|
|
||||||
@ -823,7 +826,7 @@ public:
|
|||||||
(unsigned Tag, StringRef Name, DIFile *File, unsigned Line,
|
(unsigned Tag, StringRef Name, DIFile *File, unsigned Line,
|
||||||
DIScopeRef Scope, DITypeRef BaseType, uint64_t SizeInBits,
|
DIScopeRef Scope, DITypeRef BaseType, uint64_t SizeInBits,
|
||||||
uint64_t AlignInBits, uint64_t OffsetInBits,
|
uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||||
unsigned Flags, DINodeArray Elements, unsigned RuntimeLang,
|
DIFlags Flags, DINodeArray Elements, unsigned RuntimeLang,
|
||||||
DITypeRef VTableHolder,
|
DITypeRef VTableHolder,
|
||||||
DITemplateParameterArray TemplateParams = nullptr,
|
DITemplateParameterArray TemplateParams = nullptr,
|
||||||
StringRef Identifier = ""),
|
StringRef Identifier = ""),
|
||||||
@ -834,7 +837,7 @@ public:
|
|||||||
(unsigned Tag, MDString *Name, Metadata *File,
|
(unsigned Tag, MDString *Name, Metadata *File,
|
||||||
unsigned Line, Metadata *Scope, Metadata *BaseType,
|
unsigned Line, Metadata *Scope, Metadata *BaseType,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||||
uint64_t OffsetInBits, unsigned Flags, Metadata *Elements,
|
uint64_t OffsetInBits, DIFlags Flags, Metadata *Elements,
|
||||||
unsigned RuntimeLang, Metadata *VTableHolder,
|
unsigned RuntimeLang, Metadata *VTableHolder,
|
||||||
Metadata *TemplateParams = nullptr,
|
Metadata *TemplateParams = nullptr,
|
||||||
MDString *Identifier = nullptr),
|
MDString *Identifier = nullptr),
|
||||||
@ -855,7 +858,7 @@ public:
|
|||||||
getODRType(LLVMContext &Context, MDString &Identifier, unsigned Tag,
|
getODRType(LLVMContext &Context, MDString &Identifier, unsigned Tag,
|
||||||
MDString *Name, Metadata *File, unsigned Line, Metadata *Scope,
|
MDString *Name, Metadata *File, unsigned Line, Metadata *Scope,
|
||||||
Metadata *BaseType, uint64_t SizeInBits, uint64_t AlignInBits,
|
Metadata *BaseType, uint64_t SizeInBits, uint64_t AlignInBits,
|
||||||
uint64_t OffsetInBits, unsigned Flags, Metadata *Elements,
|
uint64_t OffsetInBits, DIFlags Flags, Metadata *Elements,
|
||||||
unsigned RuntimeLang, Metadata *VTableHolder,
|
unsigned RuntimeLang, Metadata *VTableHolder,
|
||||||
Metadata *TemplateParams);
|
Metadata *TemplateParams);
|
||||||
static DICompositeType *getODRTypeIfExists(LLVMContext &Context,
|
static DICompositeType *getODRTypeIfExists(LLVMContext &Context,
|
||||||
@ -874,7 +877,7 @@ public:
|
|||||||
buildODRType(LLVMContext &Context, MDString &Identifier, unsigned Tag,
|
buildODRType(LLVMContext &Context, MDString &Identifier, unsigned Tag,
|
||||||
MDString *Name, Metadata *File, unsigned Line, Metadata *Scope,
|
MDString *Name, Metadata *File, unsigned Line, Metadata *Scope,
|
||||||
Metadata *BaseType, uint64_t SizeInBits, uint64_t AlignInBits,
|
Metadata *BaseType, uint64_t SizeInBits, uint64_t AlignInBits,
|
||||||
uint64_t OffsetInBits, unsigned Flags, Metadata *Elements,
|
uint64_t OffsetInBits, DIFlags Flags, Metadata *Elements,
|
||||||
unsigned RuntimeLang, Metadata *VTableHolder,
|
unsigned RuntimeLang, Metadata *VTableHolder,
|
||||||
Metadata *TemplateParams);
|
Metadata *TemplateParams);
|
||||||
|
|
||||||
@ -933,20 +936,20 @@ class DISubroutineType : public DIType {
|
|||||||
/// type dwarf::CallingConvention.
|
/// type dwarf::CallingConvention.
|
||||||
uint8_t CC;
|
uint8_t CC;
|
||||||
|
|
||||||
DISubroutineType(LLVMContext &C, StorageType Storage, unsigned Flags,
|
DISubroutineType(LLVMContext &C, StorageType Storage, DIFlags Flags,
|
||||||
uint8_t CC, ArrayRef<Metadata *> Ops)
|
uint8_t CC, ArrayRef<Metadata *> Ops)
|
||||||
: DIType(C, DISubroutineTypeKind, Storage, dwarf::DW_TAG_subroutine_type,
|
: DIType(C, DISubroutineTypeKind, Storage, dwarf::DW_TAG_subroutine_type,
|
||||||
0, 0, 0, 0, Flags, Ops),
|
0, 0, 0, 0, Flags, Ops),
|
||||||
CC(CC) {}
|
CC(CC) {}
|
||||||
~DISubroutineType() = default;
|
~DISubroutineType() = default;
|
||||||
|
|
||||||
static DISubroutineType *getImpl(LLVMContext &Context, unsigned Flags,
|
static DISubroutineType *getImpl(LLVMContext &Context, DIFlags Flags,
|
||||||
uint8_t CC, DITypeRefArray TypeArray,
|
uint8_t CC, DITypeRefArray TypeArray,
|
||||||
StorageType Storage,
|
StorageType Storage,
|
||||||
bool ShouldCreate = true) {
|
bool ShouldCreate = true) {
|
||||||
return getImpl(Context, Flags, CC, TypeArray.get(), Storage, ShouldCreate);
|
return getImpl(Context, Flags, CC, TypeArray.get(), Storage, ShouldCreate);
|
||||||
}
|
}
|
||||||
static DISubroutineType *getImpl(LLVMContext &Context, unsigned Flags,
|
static DISubroutineType *getImpl(LLVMContext &Context, DIFlags Flags,
|
||||||
uint8_t CC, Metadata *TypeArray,
|
uint8_t CC, Metadata *TypeArray,
|
||||||
StorageType Storage,
|
StorageType Storage,
|
||||||
bool ShouldCreate = true);
|
bool ShouldCreate = true);
|
||||||
@ -957,10 +960,10 @@ class DISubroutineType : public DIType {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
DEFINE_MDNODE_GET(DISubroutineType,
|
DEFINE_MDNODE_GET(DISubroutineType,
|
||||||
(unsigned Flags, uint8_t CC, DITypeRefArray TypeArray),
|
(DIFlags Flags, uint8_t CC, DITypeRefArray TypeArray),
|
||||||
(Flags, CC, TypeArray))
|
(Flags, CC, TypeArray))
|
||||||
DEFINE_MDNODE_GET(DISubroutineType,
|
DEFINE_MDNODE_GET(DISubroutineType,
|
||||||
(unsigned Flags, uint8_t CC, Metadata *TypeArray),
|
(DIFlags Flags, uint8_t CC, Metadata *TypeArray),
|
||||||
(Flags, CC, TypeArray))
|
(Flags, CC, TypeArray))
|
||||||
|
|
||||||
TempDISubroutineType clone() const { return cloneImpl(); }
|
TempDISubroutineType clone() const { return cloneImpl(); }
|
||||||
@ -1299,8 +1302,6 @@ class DISubprogram : public DILocalScope {
|
|||||||
// in 2 bits (none/pure/pure_virtual).
|
// in 2 bits (none/pure/pure_virtual).
|
||||||
unsigned Virtuality : 2;
|
unsigned Virtuality : 2;
|
||||||
|
|
||||||
unsigned Flags : 27;
|
|
||||||
|
|
||||||
// These are boolean flags so one bit is enough.
|
// These are boolean flags so one bit is enough.
|
||||||
// MSVC starts a new container field every time the base
|
// MSVC starts a new container field every time the base
|
||||||
// type changes so we can't use 'bool' to ensure these bits
|
// type changes so we can't use 'bool' to ensure these bits
|
||||||
@ -1309,19 +1310,22 @@ class DISubprogram : public DILocalScope {
|
|||||||
unsigned IsDefinition : 1;
|
unsigned IsDefinition : 1;
|
||||||
unsigned IsOptimized : 1;
|
unsigned IsOptimized : 1;
|
||||||
|
|
||||||
|
unsigned Padding : 3;
|
||||||
|
|
||||||
|
DIFlags Flags;
|
||||||
|
|
||||||
DISubprogram(LLVMContext &C, StorageType Storage, unsigned Line,
|
DISubprogram(LLVMContext &C, StorageType Storage, unsigned Line,
|
||||||
unsigned ScopeLine, unsigned Virtuality, unsigned VirtualIndex,
|
unsigned ScopeLine, unsigned Virtuality, unsigned VirtualIndex,
|
||||||
int ThisAdjustment, unsigned Flags, bool IsLocalToUnit,
|
int ThisAdjustment, DIFlags Flags, bool IsLocalToUnit,
|
||||||
bool IsDefinition, bool IsOptimized, ArrayRef<Metadata *> Ops)
|
bool IsDefinition, bool IsOptimized, ArrayRef<Metadata *> Ops)
|
||||||
: DILocalScope(C, DISubprogramKind, Storage, dwarf::DW_TAG_subprogram,
|
: DILocalScope(C, DISubprogramKind, Storage, dwarf::DW_TAG_subprogram,
|
||||||
Ops),
|
Ops),
|
||||||
Line(Line), ScopeLine(ScopeLine), VirtualIndex(VirtualIndex),
|
Line(Line), ScopeLine(ScopeLine), VirtualIndex(VirtualIndex),
|
||||||
ThisAdjustment(ThisAdjustment), Virtuality(Virtuality), Flags(Flags),
|
ThisAdjustment(ThisAdjustment), Virtuality(Virtuality),
|
||||||
IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition),
|
IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition),
|
||||||
IsOptimized(IsOptimized) {
|
IsOptimized(IsOptimized), Flags(Flags) {
|
||||||
static_assert(dwarf::DW_VIRTUALITY_max < 4, "Virtuality out of range");
|
static_assert(dwarf::DW_VIRTUALITY_max < 4, "Virtuality out of range");
|
||||||
assert(Virtuality < 4 && "Virtuality out of range");
|
assert(Virtuality < 4 && "Virtuality out of range");
|
||||||
assert((Flags < (1 << 27)) && "Flags out of range");
|
|
||||||
}
|
}
|
||||||
~DISubprogram() = default;
|
~DISubprogram() = default;
|
||||||
|
|
||||||
@ -1330,7 +1334,7 @@ class DISubprogram : public DILocalScope {
|
|||||||
StringRef LinkageName, DIFile *File, unsigned Line,
|
StringRef LinkageName, DIFile *File, unsigned Line,
|
||||||
DISubroutineType *Type, bool IsLocalToUnit, bool IsDefinition,
|
DISubroutineType *Type, bool IsLocalToUnit, bool IsDefinition,
|
||||||
unsigned ScopeLine, DITypeRef ContainingType, unsigned Virtuality,
|
unsigned ScopeLine, DITypeRef ContainingType, unsigned Virtuality,
|
||||||
unsigned VirtualIndex, int ThisAdjustment, unsigned Flags,
|
unsigned VirtualIndex, int ThisAdjustment, DIFlags Flags,
|
||||||
bool IsOptimized, DICompileUnit *Unit,
|
bool IsOptimized, DICompileUnit *Unit,
|
||||||
DITemplateParameterArray TemplateParams, DISubprogram *Declaration,
|
DITemplateParameterArray TemplateParams, DISubprogram *Declaration,
|
||||||
DILocalVariableArray Variables, StorageType Storage,
|
DILocalVariableArray Variables, StorageType Storage,
|
||||||
@ -1347,7 +1351,7 @@ class DISubprogram : public DILocalScope {
|
|||||||
MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
|
MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
|
||||||
bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
|
bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
|
||||||
Metadata *ContainingType, unsigned Virtuality, unsigned VirtualIndex,
|
Metadata *ContainingType, unsigned Virtuality, unsigned VirtualIndex,
|
||||||
int ThisAdjustment, unsigned Flags, bool IsOptimized, Metadata *Unit,
|
int ThisAdjustment, DIFlags Flags, bool IsOptimized, Metadata *Unit,
|
||||||
Metadata *TemplateParams, Metadata *Declaration, Metadata *Variables,
|
Metadata *TemplateParams, Metadata *Declaration, Metadata *Variables,
|
||||||
StorageType Storage, bool ShouldCreate = true);
|
StorageType Storage, bool ShouldCreate = true);
|
||||||
|
|
||||||
@ -1366,7 +1370,7 @@ public:
|
|||||||
DIFile *File, unsigned Line, DISubroutineType *Type,
|
DIFile *File, unsigned Line, DISubroutineType *Type,
|
||||||
bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
|
bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
|
||||||
DITypeRef ContainingType, unsigned Virtuality,
|
DITypeRef ContainingType, unsigned Virtuality,
|
||||||
unsigned VirtualIndex, int ThisAdjustment, unsigned Flags,
|
unsigned VirtualIndex, int ThisAdjustment, DIFlags Flags,
|
||||||
bool IsOptimized, DICompileUnit *Unit,
|
bool IsOptimized, DICompileUnit *Unit,
|
||||||
DITemplateParameterArray TemplateParams = nullptr,
|
DITemplateParameterArray TemplateParams = nullptr,
|
||||||
DISubprogram *Declaration = nullptr,
|
DISubprogram *Declaration = nullptr,
|
||||||
@ -1380,7 +1384,7 @@ public:
|
|||||||
(Metadata * Scope, MDString *Name, MDString *LinkageName, Metadata *File,
|
(Metadata * Scope, MDString *Name, MDString *LinkageName, Metadata *File,
|
||||||
unsigned Line, Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
|
unsigned Line, Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
|
||||||
unsigned ScopeLine, Metadata *ContainingType, unsigned Virtuality,
|
unsigned ScopeLine, Metadata *ContainingType, unsigned Virtuality,
|
||||||
unsigned VirtualIndex, int ThisAdjustment, unsigned Flags,
|
unsigned VirtualIndex, int ThisAdjustment, DIFlags Flags,
|
||||||
bool IsOptimized, Metadata *Unit, Metadata *TemplateParams = nullptr,
|
bool IsOptimized, Metadata *Unit, Metadata *TemplateParams = nullptr,
|
||||||
Metadata *Declaration = nullptr, Metadata *Variables = nullptr),
|
Metadata *Declaration = nullptr, Metadata *Variables = nullptr),
|
||||||
(Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition,
|
(Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition,
|
||||||
@ -1395,12 +1399,12 @@ public:
|
|||||||
unsigned getVirtualIndex() const { return VirtualIndex; }
|
unsigned getVirtualIndex() const { return VirtualIndex; }
|
||||||
int getThisAdjustment() const { return ThisAdjustment; }
|
int getThisAdjustment() const { return ThisAdjustment; }
|
||||||
unsigned getScopeLine() const { return ScopeLine; }
|
unsigned getScopeLine() const { return ScopeLine; }
|
||||||
unsigned getFlags() const { return Flags; }
|
DIFlags getFlags() const { return Flags; }
|
||||||
bool isLocalToUnit() const { return IsLocalToUnit; }
|
bool isLocalToUnit() const { return IsLocalToUnit; }
|
||||||
bool isDefinition() const { return IsDefinition; }
|
bool isDefinition() const { return IsDefinition; }
|
||||||
bool isOptimized() const { return IsOptimized; }
|
bool isOptimized() const { return IsOptimized; }
|
||||||
|
|
||||||
unsigned isArtificial() const { return getFlags() & FlagArtificial; }
|
bool isArtificial() const { return getFlags() & FlagArtificial; }
|
||||||
bool isPrivate() const {
|
bool isPrivate() const {
|
||||||
return (getFlags() & FlagAccessibility) == FlagPrivate;
|
return (getFlags() & FlagAccessibility) == FlagPrivate;
|
||||||
}
|
}
|
||||||
@ -1417,7 +1421,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// Return true if this subprogram is a C++11 reference-qualified non-static
|
/// Return true if this subprogram is a C++11 reference-qualified non-static
|
||||||
/// member function (void foo() &).
|
/// member function (void foo() &).
|
||||||
unsigned isLValueReference() const {
|
bool isLValueReference() const {
|
||||||
return getFlags() & FlagLValueReference;
|
return getFlags() & FlagLValueReference;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1425,14 +1429,14 @@ public:
|
|||||||
///
|
///
|
||||||
/// Return true if this subprogram is a C++11 rvalue-reference-qualified
|
/// Return true if this subprogram is a C++11 rvalue-reference-qualified
|
||||||
/// non-static member function (void foo() &&).
|
/// non-static member function (void foo() &&).
|
||||||
unsigned isRValueReference() const {
|
bool isRValueReference() const {
|
||||||
return getFlags() & FlagRValueReference;
|
return getFlags() & FlagRValueReference;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Check if this is marked as noreturn.
|
/// \brief Check if this is marked as noreturn.
|
||||||
///
|
///
|
||||||
/// Return true if this subprogram is C++11 noreturn or C11 _Noreturn
|
/// Return true if this subprogram is C++11 noreturn or C11 _Noreturn
|
||||||
unsigned isNoReturn() const {
|
bool isNoReturn() const {
|
||||||
return getFlags() & FlagNoReturn;
|
return getFlags() & FlagNoReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1955,20 +1959,19 @@ class DILocalVariable : public DIVariable {
|
|||||||
friend class MDNode;
|
friend class MDNode;
|
||||||
|
|
||||||
unsigned Arg : 16;
|
unsigned Arg : 16;
|
||||||
unsigned Flags : 16;
|
DIFlags Flags;
|
||||||
|
|
||||||
DILocalVariable(LLVMContext &C, StorageType Storage, unsigned Line,
|
DILocalVariable(LLVMContext &C, StorageType Storage, unsigned Line,
|
||||||
unsigned Arg, unsigned Flags, ArrayRef<Metadata *> Ops)
|
unsigned Arg, DIFlags Flags, ArrayRef<Metadata *> Ops)
|
||||||
: DIVariable(C, DILocalVariableKind, Storage, Line, Ops), Arg(Arg),
|
: DIVariable(C, DILocalVariableKind, Storage, Line, Ops), Arg(Arg),
|
||||||
Flags(Flags) {
|
Flags(Flags) {
|
||||||
assert(Flags < (1 << 16) && "DILocalVariable: Flags out of range");
|
|
||||||
assert(Arg < (1 << 16) && "DILocalVariable: Arg out of range");
|
assert(Arg < (1 << 16) && "DILocalVariable: Arg out of range");
|
||||||
}
|
}
|
||||||
~DILocalVariable() = default;
|
~DILocalVariable() = default;
|
||||||
|
|
||||||
static DILocalVariable *getImpl(LLVMContext &Context, DIScope *Scope,
|
static DILocalVariable *getImpl(LLVMContext &Context, DIScope *Scope,
|
||||||
StringRef Name, DIFile *File, unsigned Line,
|
StringRef Name, DIFile *File, unsigned Line,
|
||||||
DITypeRef Type, unsigned Arg, unsigned Flags,
|
DITypeRef Type, unsigned Arg, DIFlags Flags,
|
||||||
StorageType Storage,
|
StorageType Storage,
|
||||||
bool ShouldCreate = true) {
|
bool ShouldCreate = true) {
|
||||||
return getImpl(Context, Scope, getCanonicalMDString(Context, Name), File,
|
return getImpl(Context, Scope, getCanonicalMDString(Context, Name), File,
|
||||||
@ -1976,7 +1979,7 @@ class DILocalVariable : public DIVariable {
|
|||||||
}
|
}
|
||||||
static DILocalVariable *getImpl(LLVMContext &Context, Metadata *Scope,
|
static DILocalVariable *getImpl(LLVMContext &Context, Metadata *Scope,
|
||||||
MDString *Name, Metadata *File, unsigned Line,
|
MDString *Name, Metadata *File, unsigned Line,
|
||||||
Metadata *Type, unsigned Arg, unsigned Flags,
|
Metadata *Type, unsigned Arg, DIFlags Flags,
|
||||||
StorageType Storage,
|
StorageType Storage,
|
||||||
bool ShouldCreate = true);
|
bool ShouldCreate = true);
|
||||||
|
|
||||||
@ -1988,13 +1991,11 @@ class DILocalVariable : public DIVariable {
|
|||||||
public:
|
public:
|
||||||
DEFINE_MDNODE_GET(DILocalVariable,
|
DEFINE_MDNODE_GET(DILocalVariable,
|
||||||
(DILocalScope * Scope, StringRef Name, DIFile *File,
|
(DILocalScope * Scope, StringRef Name, DIFile *File,
|
||||||
unsigned Line, DITypeRef Type, unsigned Arg,
|
unsigned Line, DITypeRef Type, unsigned Arg, DIFlags Flags),
|
||||||
unsigned Flags),
|
|
||||||
(Scope, Name, File, Line, Type, Arg, Flags))
|
(Scope, Name, File, Line, Type, Arg, Flags))
|
||||||
DEFINE_MDNODE_GET(DILocalVariable,
|
DEFINE_MDNODE_GET(DILocalVariable,
|
||||||
(Metadata * Scope, MDString *Name, Metadata *File,
|
(Metadata * Scope, MDString *Name, Metadata *File,
|
||||||
unsigned Line, Metadata *Type, unsigned Arg,
|
unsigned Line, Metadata *Type, unsigned Arg, DIFlags Flags),
|
||||||
unsigned Flags),
|
|
||||||
(Scope, Name, File, Line, Type, Arg, Flags))
|
(Scope, Name, File, Line, Type, Arg, Flags))
|
||||||
|
|
||||||
TempDILocalVariable clone() const { return cloneImpl(); }
|
TempDILocalVariable clone() const { return cloneImpl(); }
|
||||||
@ -2008,7 +2009,7 @@ public:
|
|||||||
|
|
||||||
bool isParameter() const { return Arg; }
|
bool isParameter() const { return Arg; }
|
||||||
unsigned getArg() const { return Arg; }
|
unsigned getArg() const { return Arg; }
|
||||||
unsigned getFlags() const { return Flags; }
|
DIFlags getFlags() const { return Flags; }
|
||||||
|
|
||||||
bool isArtificial() const { return getFlags() & FlagArtificial; }
|
bool isArtificial() const { return getFlags() & FlagArtificial; }
|
||||||
bool isObjectPointer() const { return getFlags() & FlagObjectPointer; }
|
bool isObjectPointer() const { return getFlags() & FlagObjectPointer; }
|
||||||
|
@ -1271,7 +1271,7 @@ bool LLParser::ParseStringConstant(std::string &Result) {
|
|||||||
|
|
||||||
/// ParseUInt32
|
/// ParseUInt32
|
||||||
/// ::= uint32
|
/// ::= uint32
|
||||||
bool LLParser::ParseUInt32(unsigned &Val) {
|
bool LLParser::ParseUInt32(uint32_t &Val) {
|
||||||
if (Lex.getKind() != lltok::APSInt || Lex.getAPSIntVal().isSigned())
|
if (Lex.getKind() != lltok::APSInt || Lex.getAPSIntVal().isSigned())
|
||||||
return TokError("expected integer");
|
return TokError("expected integer");
|
||||||
uint64_t Val64 = Lex.getAPSIntVal().getLimitedValue(0xFFFFFFFFULL+1);
|
uint64_t Val64 = Lex.getAPSIntVal().getLimitedValue(0xFFFFFFFFULL+1);
|
||||||
@ -3407,8 +3407,8 @@ struct EmissionKindField : public MDUnsignedField {
|
|||||||
EmissionKindField() : MDUnsignedField(0, DICompileUnit::LastEmissionKind) {}
|
EmissionKindField() : MDUnsignedField(0, DICompileUnit::LastEmissionKind) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DIFlagField : public MDUnsignedField {
|
struct DIFlagField : public MDFieldImpl<DINode::DIFlags> {
|
||||||
DIFlagField() : MDUnsignedField(0, UINT32_MAX) {}
|
DIFlagField() : MDFieldImpl(DINode::FlagZero) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MDSignedField : public MDFieldImpl<int64_t> {
|
struct MDSignedField : public MDFieldImpl<int64_t> {
|
||||||
@ -3610,12 +3610,15 @@ bool LLParser::ParseMDField(LocTy Loc, StringRef Name,
|
|||||||
/// ::= DIFlagVector '|' DIFlagFwdDecl '|' uint32 '|' DIFlagPublic
|
/// ::= DIFlagVector '|' DIFlagFwdDecl '|' uint32 '|' DIFlagPublic
|
||||||
template <>
|
template <>
|
||||||
bool LLParser::ParseMDField(LocTy Loc, StringRef Name, DIFlagField &Result) {
|
bool LLParser::ParseMDField(LocTy Loc, StringRef Name, DIFlagField &Result) {
|
||||||
assert(Result.Max == UINT32_MAX && "Expected only 32-bits");
|
|
||||||
|
|
||||||
// Parser for a single flag.
|
// Parser for a single flag.
|
||||||
auto parseFlag = [&](unsigned &Val) {
|
auto parseFlag = [&](DINode::DIFlags &Val) {
|
||||||
if (Lex.getKind() == lltok::APSInt && !Lex.getAPSIntVal().isSigned())
|
if (Lex.getKind() == lltok::APSInt && !Lex.getAPSIntVal().isSigned()) {
|
||||||
return ParseUInt32(Val);
|
uint32_t TempVal = static_cast<uint32_t>(Val);
|
||||||
|
bool Res = ParseUInt32(TempVal);
|
||||||
|
Val = static_cast<DINode::DIFlags>(TempVal);
|
||||||
|
return Res;
|
||||||
|
}
|
||||||
|
|
||||||
if (Lex.getKind() != lltok::DIFlag)
|
if (Lex.getKind() != lltok::DIFlag)
|
||||||
return TokError("expected debug info flag");
|
return TokError("expected debug info flag");
|
||||||
@ -3629,9 +3632,9 @@ bool LLParser::ParseMDField(LocTy Loc, StringRef Name, DIFlagField &Result) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Parse the flags and combine them together.
|
// Parse the flags and combine them together.
|
||||||
unsigned Combined = 0;
|
DINode::DIFlags Combined = DINode::FlagZero;
|
||||||
do {
|
do {
|
||||||
unsigned Val;
|
DINode::DIFlags Val;
|
||||||
if (parseFlag(Val))
|
if (parseFlag(Val))
|
||||||
return true;
|
return true;
|
||||||
Combined |= Val;
|
Combined |= Val;
|
||||||
|
@ -2414,13 +2414,14 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
|
|||||||
return error("Invalid record");
|
return error("Invalid record");
|
||||||
|
|
||||||
IsDistinct = Record[0];
|
IsDistinct = Record[0];
|
||||||
|
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(Record[10]);
|
||||||
MetadataList.assignValue(
|
MetadataList.assignValue(
|
||||||
GET_OR_DISTINCT(
|
GET_OR_DISTINCT(
|
||||||
DIDerivedType,
|
DIDerivedType,
|
||||||
(Context, Record[1], getMDString(Record[2]),
|
(Context, Record[1], getMDString(Record[2]),
|
||||||
getMDOrNull(Record[3]), Record[4], getDITypeRefOrNull(Record[5]),
|
getMDOrNull(Record[3]), Record[4], getDITypeRefOrNull(Record[5]),
|
||||||
getDITypeRefOrNull(Record[6]), Record[7], Record[8], Record[9],
|
getDITypeRefOrNull(Record[6]), Record[7], Record[8], Record[9],
|
||||||
Record[10], getDITypeRefOrNull(Record[11]))),
|
Flags, getDITypeRefOrNull(Record[11]))),
|
||||||
NextMetadataNo++);
|
NextMetadataNo++);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2441,7 +2442,7 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
|
|||||||
uint64_t SizeInBits = Record[7];
|
uint64_t SizeInBits = Record[7];
|
||||||
uint64_t AlignInBits = Record[8];
|
uint64_t AlignInBits = Record[8];
|
||||||
uint64_t OffsetInBits = Record[9];
|
uint64_t OffsetInBits = Record[9];
|
||||||
unsigned Flags = Record[10];
|
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(Record[10]);
|
||||||
Metadata *Elements = getMDOrNull(Record[11]);
|
Metadata *Elements = getMDOrNull(Record[11]);
|
||||||
unsigned RuntimeLang = Record[12];
|
unsigned RuntimeLang = Record[12];
|
||||||
Metadata *VTableHolder = getDITypeRefOrNull(Record[13]);
|
Metadata *VTableHolder = getDITypeRefOrNull(Record[13]);
|
||||||
@ -2474,12 +2475,13 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
|
|||||||
unsigned CC = (Record.size() > 3) ? Record[3] : 0;
|
unsigned CC = (Record.size() > 3) ? Record[3] : 0;
|
||||||
|
|
||||||
IsDistinct = Record[0] & 0x1;
|
IsDistinct = Record[0] & 0x1;
|
||||||
|
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(Record[1]);
|
||||||
Metadata *Types = getMDOrNull(Record[2]);
|
Metadata *Types = getMDOrNull(Record[2]);
|
||||||
if (LLVM_UNLIKELY(IsOldTypeRefArray))
|
if (LLVM_UNLIKELY(IsOldTypeRefArray))
|
||||||
Types = MetadataList.upgradeTypeRefArray(Types);
|
Types = MetadataList.upgradeTypeRefArray(Types);
|
||||||
|
|
||||||
MetadataList.assignValue(
|
MetadataList.assignValue(
|
||||||
GET_OR_DISTINCT(DISubroutineType, (Context, Record[1], CC, Types)),
|
GET_OR_DISTINCT(DISubroutineType, (Context, Flags, CC, Types)),
|
||||||
NextMetadataNo++);
|
NextMetadataNo++);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2564,7 +2566,9 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
|
|||||||
Record[11], // virtuality
|
Record[11], // virtuality
|
||||||
Record[12], // virtualIndex
|
Record[12], // virtualIndex
|
||||||
HasThisAdj ? Record[19] : 0, // thisAdjustment
|
HasThisAdj ? Record[19] : 0, // thisAdjustment
|
||||||
Record[13], // flags
|
static_cast<DINode::DIFlags>(
|
||||||
|
Record[13] // flags
|
||||||
|
),
|
||||||
Record[14], // isOptimized
|
Record[14], // isOptimized
|
||||||
HasUnit ? CUorFn : nullptr, // unit
|
HasUnit ? CUorFn : nullptr, // unit
|
||||||
getMDOrNull(Record[15 + Offset]), // templateParams
|
getMDOrNull(Record[15 + Offset]), // templateParams
|
||||||
@ -2695,13 +2699,14 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
|
|||||||
// DW_TAG_arg_variable.
|
// DW_TAG_arg_variable.
|
||||||
IsDistinct = Record[0];
|
IsDistinct = Record[0];
|
||||||
bool HasTag = Record.size() > 8;
|
bool HasTag = Record.size() > 8;
|
||||||
|
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(Record[7 + HasTag]);
|
||||||
MetadataList.assignValue(
|
MetadataList.assignValue(
|
||||||
GET_OR_DISTINCT(DILocalVariable,
|
GET_OR_DISTINCT(DILocalVariable,
|
||||||
(Context, getMDOrNull(Record[1 + HasTag]),
|
(Context, getMDOrNull(Record[1 + HasTag]),
|
||||||
getMDString(Record[2 + HasTag]),
|
getMDString(Record[2 + HasTag]),
|
||||||
getMDOrNull(Record[3 + HasTag]), Record[4 + HasTag],
|
getMDOrNull(Record[3 + HasTag]), Record[4 + HasTag],
|
||||||
getDITypeRefOrNull(Record[5 + HasTag]),
|
getDITypeRefOrNull(Record[5 + HasTag]),
|
||||||
Record[6 + HasTag], Record[7 + HasTag])),
|
Record[6 + HasTag], Flags)),
|
||||||
NextMetadataNo++);
|
NextMetadataNo++);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1408,7 +1408,7 @@ struct MDFieldPrinter {
|
|||||||
template <class IntTy>
|
template <class IntTy>
|
||||||
void printInt(StringRef Name, IntTy Int, bool ShouldSkipZero = true);
|
void printInt(StringRef Name, IntTy Int, bool ShouldSkipZero = true);
|
||||||
void printBool(StringRef Name, bool Value, Optional<bool> Default = None);
|
void printBool(StringRef Name, bool Value, Optional<bool> Default = None);
|
||||||
void printDIFlags(StringRef Name, unsigned Flags);
|
void printDIFlags(StringRef Name, DINode::DIFlags Flags);
|
||||||
template <class IntTy, class Stringifier>
|
template <class IntTy, class Stringifier>
|
||||||
void printDwarfEnum(StringRef Name, IntTy Value, Stringifier toString,
|
void printDwarfEnum(StringRef Name, IntTy Value, Stringifier toString,
|
||||||
bool ShouldSkipZero = true);
|
bool ShouldSkipZero = true);
|
||||||
@ -1477,17 +1477,17 @@ void MDFieldPrinter::printBool(StringRef Name, bool Value,
|
|||||||
Out << FS << Name << ": " << (Value ? "true" : "false");
|
Out << FS << Name << ": " << (Value ? "true" : "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MDFieldPrinter::printDIFlags(StringRef Name, unsigned Flags) {
|
void MDFieldPrinter::printDIFlags(StringRef Name, DINode::DIFlags Flags) {
|
||||||
if (!Flags)
|
if (!Flags)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Out << FS << Name << ": ";
|
Out << FS << Name << ": ";
|
||||||
|
|
||||||
SmallVector<unsigned, 8> SplitFlags;
|
SmallVector<DINode::DIFlags, 8> SplitFlags;
|
||||||
unsigned Extra = DINode::splitFlags(Flags, SplitFlags);
|
auto Extra = DINode::splitFlags(Flags, SplitFlags);
|
||||||
|
|
||||||
FieldSeparator FlagsFS(" | ");
|
FieldSeparator FlagsFS(" | ");
|
||||||
for (unsigned F : SplitFlags) {
|
for (auto F : SplitFlags) {
|
||||||
const char *StringF = DINode::getFlagString(F);
|
const char *StringF = DINode::getFlagString(F);
|
||||||
assert(StringF && "Expected valid flag");
|
assert(StringF && "Expected valid flag");
|
||||||
Out << FlagsFS << StringF;
|
Out << FlagsFS << StringF;
|
||||||
|
@ -204,7 +204,7 @@ DIBasicType *DIBuilder::createBasicType(StringRef Name, uint64_t SizeInBits,
|
|||||||
|
|
||||||
DIDerivedType *DIBuilder::createQualifiedType(unsigned Tag, DIType *FromTy) {
|
DIDerivedType *DIBuilder::createQualifiedType(unsigned Tag, DIType *FromTy) {
|
||||||
return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, FromTy, 0,
|
return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, FromTy, 0,
|
||||||
0, 0, 0);
|
0, 0, DINode::FlagZero);
|
||||||
}
|
}
|
||||||
|
|
||||||
DIDerivedType *DIBuilder::createPointerType(DIType *PointeeTy,
|
DIDerivedType *DIBuilder::createPointerType(DIType *PointeeTy,
|
||||||
@ -214,14 +214,14 @@ DIDerivedType *DIBuilder::createPointerType(DIType *PointeeTy,
|
|||||||
// FIXME: Why is there a name here?
|
// FIXME: Why is there a name here?
|
||||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_pointer_type, Name,
|
return DIDerivedType::get(VMContext, dwarf::DW_TAG_pointer_type, Name,
|
||||||
nullptr, 0, nullptr, PointeeTy, SizeInBits,
|
nullptr, 0, nullptr, PointeeTy, SizeInBits,
|
||||||
AlignInBits, 0, 0);
|
AlignInBits, 0, DINode::FlagZero);
|
||||||
}
|
}
|
||||||
|
|
||||||
DIDerivedType *DIBuilder::createMemberPointerType(DIType *PointeeTy,
|
DIDerivedType *DIBuilder::createMemberPointerType(DIType *PointeeTy,
|
||||||
DIType *Base,
|
DIType *Base,
|
||||||
uint64_t SizeInBits,
|
uint64_t SizeInBits,
|
||||||
uint64_t AlignInBits,
|
uint64_t AlignInBits,
|
||||||
unsigned Flags) {
|
DINode::DIFlags Flags) {
|
||||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_ptr_to_member_type, "",
|
return DIDerivedType::get(VMContext, dwarf::DW_TAG_ptr_to_member_type, "",
|
||||||
nullptr, 0, nullptr, PointeeTy, SizeInBits,
|
nullptr, 0, nullptr, PointeeTy, SizeInBits,
|
||||||
AlignInBits, 0, Flags, Base);
|
AlignInBits, 0, Flags, Base);
|
||||||
@ -232,7 +232,7 @@ DIDerivedType *DIBuilder::createReferenceType(unsigned Tag, DIType *RTy,
|
|||||||
uint64_t AlignInBits) {
|
uint64_t AlignInBits) {
|
||||||
assert(RTy && "Unable to create reference type");
|
assert(RTy && "Unable to create reference type");
|
||||||
return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, RTy,
|
return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, RTy,
|
||||||
SizeInBits, AlignInBits, 0, 0);
|
SizeInBits, AlignInBits, 0, DINode::FlagZero);
|
||||||
}
|
}
|
||||||
|
|
||||||
DIDerivedType *DIBuilder::createTypedef(DIType *Ty, StringRef Name,
|
DIDerivedType *DIBuilder::createTypedef(DIType *Ty, StringRef Name,
|
||||||
@ -240,19 +240,19 @@ DIDerivedType *DIBuilder::createTypedef(DIType *Ty, StringRef Name,
|
|||||||
DIScope *Context) {
|
DIScope *Context) {
|
||||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_typedef, Name, File,
|
return DIDerivedType::get(VMContext, dwarf::DW_TAG_typedef, Name, File,
|
||||||
LineNo, getNonCompileUnitScope(Context), Ty, 0, 0,
|
LineNo, getNonCompileUnitScope(Context), Ty, 0, 0,
|
||||||
0, 0);
|
0, DINode::FlagZero);
|
||||||
}
|
}
|
||||||
|
|
||||||
DIDerivedType *DIBuilder::createFriend(DIType *Ty, DIType *FriendTy) {
|
DIDerivedType *DIBuilder::createFriend(DIType *Ty, DIType *FriendTy) {
|
||||||
assert(Ty && "Invalid type!");
|
assert(Ty && "Invalid type!");
|
||||||
assert(FriendTy && "Invalid friend type!");
|
assert(FriendTy && "Invalid friend type!");
|
||||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_friend, "", nullptr, 0, Ty,
|
return DIDerivedType::get(VMContext, dwarf::DW_TAG_friend, "", nullptr, 0, Ty,
|
||||||
FriendTy, 0, 0, 0, 0);
|
FriendTy, 0, 0, 0, DINode::FlagZero);
|
||||||
}
|
}
|
||||||
|
|
||||||
DIDerivedType *DIBuilder::createInheritance(DIType *Ty, DIType *BaseTy,
|
DIDerivedType *DIBuilder::createInheritance(DIType *Ty, DIType *BaseTy,
|
||||||
uint64_t BaseOffset,
|
uint64_t BaseOffset,
|
||||||
unsigned Flags) {
|
DINode::DIFlags Flags) {
|
||||||
assert(Ty && "Unable to create inheritance");
|
assert(Ty && "Unable to create inheritance");
|
||||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_inheritance, "", nullptr,
|
return DIDerivedType::get(VMContext, dwarf::DW_TAG_inheritance, "", nullptr,
|
||||||
0, Ty, BaseTy, 0, 0, BaseOffset, Flags);
|
0, Ty, BaseTy, 0, 0, BaseOffset, Flags);
|
||||||
@ -263,7 +263,7 @@ DIDerivedType *DIBuilder::createMemberType(DIScope *Scope, StringRef Name,
|
|||||||
uint64_t SizeInBits,
|
uint64_t SizeInBits,
|
||||||
uint64_t AlignInBits,
|
uint64_t AlignInBits,
|
||||||
uint64_t OffsetInBits,
|
uint64_t OffsetInBits,
|
||||||
unsigned Flags, DIType *Ty) {
|
DINode::DIFlags Flags, DIType *Ty) {
|
||||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
|
return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
|
||||||
LineNumber, getNonCompileUnitScope(Scope), Ty,
|
LineNumber, getNonCompileUnitScope(Scope), Ty,
|
||||||
SizeInBits, AlignInBits, OffsetInBits, Flags);
|
SizeInBits, AlignInBits, OffsetInBits, Flags);
|
||||||
@ -278,7 +278,7 @@ static ConstantAsMetadata *getConstantOrNull(Constant *C) {
|
|||||||
DIDerivedType *DIBuilder::createBitFieldMemberType(
|
DIDerivedType *DIBuilder::createBitFieldMemberType(
|
||||||
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
|
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||||
uint64_t StorageOffsetInBits, unsigned Flags, DIType *Ty) {
|
uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty) {
|
||||||
Flags |= DINode::FlagBitField;
|
Flags |= DINode::FlagBitField;
|
||||||
return DIDerivedType::get(
|
return DIDerivedType::get(
|
||||||
VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
|
VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
|
||||||
@ -290,7 +290,7 @@ DIDerivedType *DIBuilder::createBitFieldMemberType(
|
|||||||
DIDerivedType *DIBuilder::createStaticMemberType(DIScope *Scope, StringRef Name,
|
DIDerivedType *DIBuilder::createStaticMemberType(DIScope *Scope, StringRef Name,
|
||||||
DIFile *File,
|
DIFile *File,
|
||||||
unsigned LineNumber,
|
unsigned LineNumber,
|
||||||
DIType *Ty, unsigned Flags,
|
DIType *Ty, DINode::DIFlags Flags,
|
||||||
llvm::Constant *Val) {
|
llvm::Constant *Val) {
|
||||||
Flags |= DINode::FlagStaticMember;
|
Flags |= DINode::FlagStaticMember;
|
||||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
|
return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
|
||||||
@ -302,7 +302,7 @@ DIDerivedType *DIBuilder::createObjCIVar(StringRef Name, DIFile *File,
|
|||||||
unsigned LineNumber,
|
unsigned LineNumber,
|
||||||
uint64_t SizeInBits,
|
uint64_t SizeInBits,
|
||||||
uint64_t AlignInBits,
|
uint64_t AlignInBits,
|
||||||
uint64_t OffsetInBits, unsigned Flags,
|
uint64_t OffsetInBits, DINode::DIFlags Flags,
|
||||||
DIType *Ty, MDNode *PropertyNode) {
|
DIType *Ty, MDNode *PropertyNode) {
|
||||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
|
return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
|
||||||
LineNumber, getNonCompileUnitScope(File), Ty,
|
LineNumber, getNonCompileUnitScope(File), Ty,
|
||||||
@ -360,7 +360,7 @@ DIBuilder::createTemplateParameterPack(DIScope *Context, StringRef Name,
|
|||||||
DICompositeType *DIBuilder::createClassType(
|
DICompositeType *DIBuilder::createClassType(
|
||||||
DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
|
DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||||
unsigned Flags, DIType *DerivedFrom, DINodeArray Elements,
|
DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements,
|
||||||
DIType *VTableHolder, MDNode *TemplateParams, StringRef UniqueIdentifier) {
|
DIType *VTableHolder, MDNode *TemplateParams, StringRef UniqueIdentifier) {
|
||||||
assert((!Context || isa<DIScope>(Context)) &&
|
assert((!Context || isa<DIScope>(Context)) &&
|
||||||
"createClassType should be called with a valid Context");
|
"createClassType should be called with a valid Context");
|
||||||
@ -376,7 +376,7 @@ DICompositeType *DIBuilder::createClassType(
|
|||||||
|
|
||||||
DICompositeType *DIBuilder::createStructType(
|
DICompositeType *DIBuilder::createStructType(
|
||||||
DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
|
DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
|
uint64_t SizeInBits, uint64_t AlignInBits, DINode::DIFlags Flags,
|
||||||
DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang,
|
DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang,
|
||||||
DIType *VTableHolder, StringRef UniqueIdentifier) {
|
DIType *VTableHolder, StringRef UniqueIdentifier) {
|
||||||
auto *R = DICompositeType::get(
|
auto *R = DICompositeType::get(
|
||||||
@ -389,7 +389,7 @@ DICompositeType *DIBuilder::createStructType(
|
|||||||
|
|
||||||
DICompositeType *DIBuilder::createUnionType(
|
DICompositeType *DIBuilder::createUnionType(
|
||||||
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
|
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
|
uint64_t SizeInBits, uint64_t AlignInBits, DINode::DIFlags Flags,
|
||||||
DINodeArray Elements, unsigned RunTimeLang, StringRef UniqueIdentifier) {
|
DINodeArray Elements, unsigned RunTimeLang, StringRef UniqueIdentifier) {
|
||||||
auto *R = DICompositeType::get(
|
auto *R = DICompositeType::get(
|
||||||
VMContext, dwarf::DW_TAG_union_type, Name, File, LineNumber,
|
VMContext, dwarf::DW_TAG_union_type, Name, File, LineNumber,
|
||||||
@ -400,7 +400,7 @@ DICompositeType *DIBuilder::createUnionType(
|
|||||||
}
|
}
|
||||||
|
|
||||||
DISubroutineType *DIBuilder::createSubroutineType(DITypeRefArray ParameterTypes,
|
DISubroutineType *DIBuilder::createSubroutineType(DITypeRefArray ParameterTypes,
|
||||||
unsigned Flags, unsigned CC) {
|
DINode::DIFlags Flags, unsigned CC) {
|
||||||
return DISubroutineType::get(VMContext, Flags, CC, ParameterTypes);
|
return DISubroutineType::get(VMContext, Flags, CC, ParameterTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,7 +419,7 @@ DICompositeType *DIBuilder::createEnumerationType(
|
|||||||
auto *CTy = DICompositeType::get(
|
auto *CTy = DICompositeType::get(
|
||||||
VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber,
|
VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber,
|
||||||
getNonCompileUnitScope(Scope), UnderlyingType, SizeInBits, AlignInBits, 0,
|
getNonCompileUnitScope(Scope), UnderlyingType, SizeInBits, AlignInBits, 0,
|
||||||
0, Elements, 0, nullptr, nullptr, UniqueIdentifier);
|
DINode::FlagZero, Elements, 0, nullptr, nullptr, UniqueIdentifier);
|
||||||
AllEnumTypes.push_back(CTy);
|
AllEnumTypes.push_back(CTy);
|
||||||
trackIfUnresolved(CTy);
|
trackIfUnresolved(CTy);
|
||||||
return CTy;
|
return CTy;
|
||||||
@ -430,7 +430,7 @@ DICompositeType *DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits,
|
|||||||
DINodeArray Subscripts) {
|
DINodeArray Subscripts) {
|
||||||
auto *R = DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "",
|
auto *R = DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "",
|
||||||
nullptr, 0, nullptr, Ty, Size, AlignInBits, 0,
|
nullptr, 0, nullptr, Ty, Size, AlignInBits, 0,
|
||||||
0, Subscripts, 0, nullptr);
|
DINode::FlagZero, Subscripts, 0, nullptr);
|
||||||
trackIfUnresolved(R);
|
trackIfUnresolved(R);
|
||||||
return R;
|
return R;
|
||||||
}
|
}
|
||||||
@ -446,7 +446,7 @@ DICompositeType *DIBuilder::createVectorType(uint64_t Size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static DIType *createTypeWithFlags(LLVMContext &Context, DIType *Ty,
|
static DIType *createTypeWithFlags(LLVMContext &Context, DIType *Ty,
|
||||||
unsigned FlagsToSet) {
|
DINode::DIFlags FlagsToSet) {
|
||||||
auto NewTy = Ty->clone();
|
auto NewTy = Ty->clone();
|
||||||
NewTy->setFlags(NewTy->getFlags() | FlagsToSet);
|
NewTy->setFlags(NewTy->getFlags() | FlagsToSet);
|
||||||
return MDNode::replaceWithUniqued(std::move(NewTy));
|
return MDNode::replaceWithUniqued(std::move(NewTy));
|
||||||
@ -463,7 +463,7 @@ DIType *DIBuilder::createObjectPointerType(DIType *Ty) {
|
|||||||
// FIXME: Restrict this to the nodes where it's valid.
|
// FIXME: Restrict this to the nodes where it's valid.
|
||||||
if (Ty->isObjectPointer())
|
if (Ty->isObjectPointer())
|
||||||
return Ty;
|
return Ty;
|
||||||
unsigned Flags = DINode::FlagObjectPointer | DINode::FlagArtificial;
|
DINode::DIFlags Flags = DINode::FlagObjectPointer | DINode::FlagArtificial;
|
||||||
return createTypeWithFlags(VMContext, Ty, Flags);
|
return createTypeWithFlags(VMContext, Ty, Flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -495,7 +495,7 @@ DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, DIScope *Scope,
|
|||||||
DICompositeType *DIBuilder::createReplaceableCompositeType(
|
DICompositeType *DIBuilder::createReplaceableCompositeType(
|
||||||
unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
|
unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
|
||||||
unsigned RuntimeLang, uint64_t SizeInBits, uint64_t AlignInBits,
|
unsigned RuntimeLang, uint64_t SizeInBits, uint64_t AlignInBits,
|
||||||
unsigned Flags, StringRef UniqueIdentifier) {
|
DINode::DIFlags Flags, StringRef UniqueIdentifier) {
|
||||||
auto *RetTy =
|
auto *RetTy =
|
||||||
DICompositeType::getTemporary(
|
DICompositeType::getTemporary(
|
||||||
VMContext, Tag, Name, F, Line, getNonCompileUnitScope(Scope), nullptr,
|
VMContext, Tag, Name, F, Line, getNonCompileUnitScope(Scope), nullptr,
|
||||||
@ -565,7 +565,7 @@ static DILocalVariable *createLocalVariable(
|
|||||||
LLVMContext &VMContext,
|
LLVMContext &VMContext,
|
||||||
DenseMap<MDNode *, SmallVector<TrackingMDNodeRef, 1>> &PreservedVariables,
|
DenseMap<MDNode *, SmallVector<TrackingMDNodeRef, 1>> &PreservedVariables,
|
||||||
DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
|
DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
|
||||||
unsigned LineNo, DIType *Ty, bool AlwaysPreserve, unsigned Flags) {
|
unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags) {
|
||||||
// FIXME: Why getNonCompileUnitScope()?
|
// FIXME: Why getNonCompileUnitScope()?
|
||||||
// FIXME: Why is "!Context" okay here?
|
// FIXME: Why is "!Context" okay here?
|
||||||
// FIXME: Why doesn't this check for a subprogram or lexical block (AFAICT
|
// FIXME: Why doesn't this check for a subprogram or lexical block (AFAICT
|
||||||
@ -589,7 +589,7 @@ static DILocalVariable *createLocalVariable(
|
|||||||
DILocalVariable *DIBuilder::createAutoVariable(DIScope *Scope, StringRef Name,
|
DILocalVariable *DIBuilder::createAutoVariable(DIScope *Scope, StringRef Name,
|
||||||
DIFile *File, unsigned LineNo,
|
DIFile *File, unsigned LineNo,
|
||||||
DIType *Ty, bool AlwaysPreserve,
|
DIType *Ty, bool AlwaysPreserve,
|
||||||
unsigned Flags) {
|
DINode::DIFlags Flags) {
|
||||||
return createLocalVariable(VMContext, PreservedVariables, Scope, Name,
|
return createLocalVariable(VMContext, PreservedVariables, Scope, Name,
|
||||||
/* ArgNo */ 0, File, LineNo, Ty, AlwaysPreserve,
|
/* ArgNo */ 0, File, LineNo, Ty, AlwaysPreserve,
|
||||||
Flags);
|
Flags);
|
||||||
@ -597,7 +597,7 @@ DILocalVariable *DIBuilder::createAutoVariable(DIScope *Scope, StringRef Name,
|
|||||||
|
|
||||||
DILocalVariable *DIBuilder::createParameterVariable(
|
DILocalVariable *DIBuilder::createParameterVariable(
|
||||||
DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
|
DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
|
||||||
unsigned LineNo, DIType *Ty, bool AlwaysPreserve, unsigned Flags) {
|
unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags) {
|
||||||
assert(ArgNo && "Expected non-zero argument number for parameter");
|
assert(ArgNo && "Expected non-zero argument number for parameter");
|
||||||
return createLocalVariable(VMContext, PreservedVariables, Scope, Name, ArgNo,
|
return createLocalVariable(VMContext, PreservedVariables, Scope, Name, ArgNo,
|
||||||
File, LineNo, Ty, AlwaysPreserve, Flags);
|
File, LineNo, Ty, AlwaysPreserve, Flags);
|
||||||
@ -629,7 +629,7 @@ static DISubprogram *getSubprogram(bool IsDistinct, Ts &&... Args) {
|
|||||||
DISubprogram *DIBuilder::createFunction(
|
DISubprogram *DIBuilder::createFunction(
|
||||||
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
|
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
|
||||||
unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
|
unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
|
||||||
bool isDefinition, unsigned ScopeLine, unsigned Flags, bool isOptimized,
|
bool isDefinition, unsigned ScopeLine, DINode::DIFlags Flags, bool isOptimized,
|
||||||
DITemplateParameterArray TParams, DISubprogram *Decl) {
|
DITemplateParameterArray TParams, DISubprogram *Decl) {
|
||||||
auto *Node = getSubprogram(
|
auto *Node = getSubprogram(
|
||||||
/* IsDistinct = */ isDefinition, VMContext,
|
/* IsDistinct = */ isDefinition, VMContext,
|
||||||
@ -647,7 +647,7 @@ DISubprogram *DIBuilder::createFunction(
|
|||||||
DISubprogram *DIBuilder::createTempFunctionFwdDecl(
|
DISubprogram *DIBuilder::createTempFunctionFwdDecl(
|
||||||
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
|
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
|
||||||
unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
|
unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
|
||||||
bool isDefinition, unsigned ScopeLine, unsigned Flags, bool isOptimized,
|
bool isDefinition, unsigned ScopeLine, DINode::DIFlags Flags, bool isOptimized,
|
||||||
DITemplateParameterArray TParams, DISubprogram *Decl) {
|
DITemplateParameterArray TParams, DISubprogram *Decl) {
|
||||||
return DISubprogram::getTemporary(
|
return DISubprogram::getTemporary(
|
||||||
VMContext, getNonCompileUnitScope(Context), Name, LinkageName,
|
VMContext, getNonCompileUnitScope(Context), Name, LinkageName,
|
||||||
@ -662,7 +662,7 @@ DIBuilder::createMethod(DIScope *Context, StringRef Name, StringRef LinkageName,
|
|||||||
DIFile *F, unsigned LineNo, DISubroutineType *Ty,
|
DIFile *F, unsigned LineNo, DISubroutineType *Ty,
|
||||||
bool isLocalToUnit, bool isDefinition, unsigned VK,
|
bool isLocalToUnit, bool isDefinition, unsigned VK,
|
||||||
unsigned VIndex, int ThisAdjustment,
|
unsigned VIndex, int ThisAdjustment,
|
||||||
DIType *VTableHolder, unsigned Flags, bool isOptimized,
|
DIType *VTableHolder, DINode::DIFlags Flags, bool isOptimized,
|
||||||
DITemplateParameterArray TParams) {
|
DITemplateParameterArray TParams) {
|
||||||
assert(getNonCompileUnitScope(Context) &&
|
assert(getNonCompileUnitScope(Context) &&
|
||||||
"Methods should have both a Context and a context that isn't "
|
"Methods should have both a Context and a context that isn't "
|
||||||
|
@ -65,29 +65,28 @@ DILocation *DILocation::getImpl(LLVMContext &Context, unsigned Line,
|
|||||||
Storage, Context.pImpl->DILocations);
|
Storage, Context.pImpl->DILocations);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned DINode::getFlag(StringRef Flag) {
|
DINode::DIFlags DINode::getFlag(StringRef Flag) {
|
||||||
return StringSwitch<unsigned>(Flag)
|
return StringSwitch<DIFlags>(Flag)
|
||||||
#define HANDLE_DI_FLAG(ID, NAME) .Case("DIFlag" #NAME, Flag##NAME)
|
#define HANDLE_DI_FLAG(ID, NAME) .Case("DIFlag" #NAME, Flag##NAME)
|
||||||
#include "llvm/IR/DebugInfoFlags.def"
|
#include "llvm/IR/DebugInfoFlags.def"
|
||||||
.Default(0);
|
.Default(DINode::FlagZero);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *DINode::getFlagString(unsigned Flag) {
|
const char *DINode::getFlagString(DIFlags Flag) {
|
||||||
switch (Flag) {
|
switch (Flag) {
|
||||||
default:
|
|
||||||
return "";
|
|
||||||
#define HANDLE_DI_FLAG(ID, NAME) \
|
#define HANDLE_DI_FLAG(ID, NAME) \
|
||||||
case Flag##NAME: \
|
case Flag##NAME: \
|
||||||
return "DIFlag" #NAME;
|
return "DIFlag" #NAME;
|
||||||
#include "llvm/IR/DebugInfoFlags.def"
|
#include "llvm/IR/DebugInfoFlags.def"
|
||||||
}
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned DINode::splitFlags(unsigned Flags,
|
DINode::DIFlags DINode::splitFlags(DIFlags Flags,
|
||||||
SmallVectorImpl<unsigned> &SplitFlags) {
|
SmallVectorImpl<DIFlags> &SplitFlags) {
|
||||||
// Accessibility and member pointer flags need to be specially handled, since
|
// Accessibility and member pointer flags need to be specially handled, since
|
||||||
// they're packed together.
|
// they're packed together.
|
||||||
if (unsigned A = Flags & FlagAccessibility) {
|
if (DIFlags A = Flags & FlagAccessibility) {
|
||||||
if (A == FlagPrivate)
|
if (A == FlagPrivate)
|
||||||
SplitFlags.push_back(FlagPrivate);
|
SplitFlags.push_back(FlagPrivate);
|
||||||
else if (A == FlagProtected)
|
else if (A == FlagProtected)
|
||||||
@ -96,7 +95,7 @@ unsigned DINode::splitFlags(unsigned Flags,
|
|||||||
SplitFlags.push_back(FlagPublic);
|
SplitFlags.push_back(FlagPublic);
|
||||||
Flags &= ~A;
|
Flags &= ~A;
|
||||||
}
|
}
|
||||||
if (unsigned R = Flags & FlagPtrToMemberRep) {
|
if (DIFlags R = Flags & FlagPtrToMemberRep) {
|
||||||
if (R == FlagSingleInheritance)
|
if (R == FlagSingleInheritance)
|
||||||
SplitFlags.push_back(FlagSingleInheritance);
|
SplitFlags.push_back(FlagSingleInheritance);
|
||||||
else if (R == FlagMultipleInheritance)
|
else if (R == FlagMultipleInheritance)
|
||||||
@ -107,12 +106,11 @@ unsigned DINode::splitFlags(unsigned Flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define HANDLE_DI_FLAG(ID, NAME) \
|
#define HANDLE_DI_FLAG(ID, NAME) \
|
||||||
if (unsigned Bit = Flags & ID) { \
|
if (DIFlags Bit = Flags & Flag##NAME) { \
|
||||||
SplitFlags.push_back(Bit); \
|
SplitFlags.push_back(Bit); \
|
||||||
Flags &= ~Bit; \
|
Flags &= ~Bit; \
|
||||||
}
|
}
|
||||||
#include "llvm/IR/DebugInfoFlags.def"
|
#include "llvm/IR/DebugInfoFlags.def"
|
||||||
|
|
||||||
return Flags;
|
return Flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +240,7 @@ DIBasicType *DIBasicType::getImpl(LLVMContext &Context, unsigned Tag,
|
|||||||
DIDerivedType *DIDerivedType::getImpl(
|
DIDerivedType *DIDerivedType::getImpl(
|
||||||
LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
|
LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
|
||||||
unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
|
unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
|
||||||
uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
|
uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags,
|
||||||
Metadata *ExtraData, StorageType Storage, bool ShouldCreate) {
|
Metadata *ExtraData, StorageType Storage, bool ShouldCreate) {
|
||||||
assert(isCanonical(Name) && "Expected canonical MDString");
|
assert(isCanonical(Name) && "Expected canonical MDString");
|
||||||
DEFINE_GETIMPL_LOOKUP(DIDerivedType,
|
DEFINE_GETIMPL_LOOKUP(DIDerivedType,
|
||||||
@ -257,7 +255,7 @@ DIDerivedType *DIDerivedType::getImpl(
|
|||||||
DICompositeType *DICompositeType::getImpl(
|
DICompositeType *DICompositeType::getImpl(
|
||||||
LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
|
LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
|
||||||
unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
|
unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
|
||||||
uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
|
uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags,
|
||||||
Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder,
|
Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder,
|
||||||
Metadata *TemplateParams, MDString *Identifier, StorageType Storage,
|
Metadata *TemplateParams, MDString *Identifier, StorageType Storage,
|
||||||
bool ShouldCreate) {
|
bool ShouldCreate) {
|
||||||
@ -279,7 +277,7 @@ DICompositeType *DICompositeType::buildODRType(
|
|||||||
LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name,
|
LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name,
|
||||||
Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType,
|
Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||||
unsigned Flags, Metadata *Elements, unsigned RuntimeLang,
|
DIFlags Flags, Metadata *Elements, unsigned RuntimeLang,
|
||||||
Metadata *VTableHolder, Metadata *TemplateParams) {
|
Metadata *VTableHolder, Metadata *TemplateParams) {
|
||||||
assert(!Identifier.getString().empty() && "Expected valid identifier");
|
assert(!Identifier.getString().empty() && "Expected valid identifier");
|
||||||
if (!Context.isODRUniquingDebugTypes())
|
if (!Context.isODRUniquingDebugTypes())
|
||||||
@ -313,7 +311,7 @@ DICompositeType *DICompositeType::getODRType(
|
|||||||
LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name,
|
LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name,
|
||||||
Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType,
|
Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType,
|
||||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||||
unsigned Flags, Metadata *Elements, unsigned RuntimeLang,
|
DIFlags Flags, Metadata *Elements, unsigned RuntimeLang,
|
||||||
Metadata *VTableHolder, Metadata *TemplateParams) {
|
Metadata *VTableHolder, Metadata *TemplateParams) {
|
||||||
assert(!Identifier.getString().empty() && "Expected valid identifier");
|
assert(!Identifier.getString().empty() && "Expected valid identifier");
|
||||||
if (!Context.isODRUniquingDebugTypes())
|
if (!Context.isODRUniquingDebugTypes())
|
||||||
@ -336,7 +334,7 @@ DICompositeType *DICompositeType::getODRTypeIfExists(LLVMContext &Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DISubroutineType *DISubroutineType::getImpl(LLVMContext &Context,
|
DISubroutineType *DISubroutineType::getImpl(LLVMContext &Context,
|
||||||
unsigned Flags, uint8_t CC,
|
DIFlags Flags, uint8_t CC,
|
||||||
Metadata *TypeArray,
|
Metadata *TypeArray,
|
||||||
StorageType Storage,
|
StorageType Storage,
|
||||||
bool ShouldCreate) {
|
bool ShouldCreate) {
|
||||||
@ -414,7 +412,7 @@ DISubprogram *DISubprogram::getImpl(
|
|||||||
MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
|
MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
|
||||||
bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
|
bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
|
||||||
Metadata *ContainingType, unsigned Virtuality, unsigned VirtualIndex,
|
Metadata *ContainingType, unsigned Virtuality, unsigned VirtualIndex,
|
||||||
int ThisAdjustment, unsigned Flags, bool IsOptimized, Metadata *Unit,
|
int ThisAdjustment, DIFlags Flags, bool IsOptimized, Metadata *Unit,
|
||||||
Metadata *TemplateParams, Metadata *Declaration, Metadata *Variables,
|
Metadata *TemplateParams, Metadata *Declaration, Metadata *Variables,
|
||||||
StorageType Storage, bool ShouldCreate) {
|
StorageType Storage, bool ShouldCreate) {
|
||||||
assert(isCanonical(Name) && "Expected canonical MDString");
|
assert(isCanonical(Name) && "Expected canonical MDString");
|
||||||
@ -529,7 +527,7 @@ DIGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
|
|||||||
DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, Metadata *Scope,
|
DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, Metadata *Scope,
|
||||||
MDString *Name, Metadata *File,
|
MDString *Name, Metadata *File,
|
||||||
unsigned Line, Metadata *Type,
|
unsigned Line, Metadata *Type,
|
||||||
unsigned Arg, unsigned Flags,
|
unsigned Arg, DIFlags Flags,
|
||||||
StorageType Storage,
|
StorageType Storage,
|
||||||
bool ShouldCreate) {
|
bool ShouldCreate) {
|
||||||
// 64K ought to be enough for any frontend.
|
// 64K ought to be enough for any frontend.
|
||||||
|
@ -55,27 +55,26 @@ TEST(DINodeTest, getFlagString) {
|
|||||||
DINode::getFlagString(DINode::FlagPublic | DINode::FlagVector));
|
DINode::getFlagString(DINode::FlagPublic | DINode::FlagVector));
|
||||||
EXPECT_EQ(StringRef(), DINode::getFlagString(DINode::FlagFwdDecl |
|
EXPECT_EQ(StringRef(), DINode::getFlagString(DINode::FlagFwdDecl |
|
||||||
DINode::FlagArtificial));
|
DINode::FlagArtificial));
|
||||||
EXPECT_EQ(StringRef(), DINode::getFlagString(0xffff));
|
EXPECT_EQ(StringRef(),
|
||||||
|
DINode::getFlagString(static_cast<DINode::DIFlags>(0xffff)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(DINodeTest, splitFlags) {
|
TEST(DINodeTest, splitFlags) {
|
||||||
// Some valid flags.
|
// Some valid flags.
|
||||||
#define CHECK_SPLIT(FLAGS, VECTOR, REMAINDER) \
|
#define CHECK_SPLIT(FLAGS, VECTOR, REMAINDER) \
|
||||||
{ \
|
{ \
|
||||||
SmallVector<unsigned, 8> V; \
|
SmallVector<DINode::DIFlags, 8> V; \
|
||||||
EXPECT_EQ(REMAINDER, DINode::splitFlags(FLAGS, V)); \
|
EXPECT_EQ(REMAINDER, DINode::splitFlags(FLAGS, V)); \
|
||||||
EXPECT_TRUE(makeArrayRef(V).equals(VECTOR)); \
|
EXPECT_TRUE(makeArrayRef(V).equals(VECTOR)); \
|
||||||
}
|
}
|
||||||
CHECK_SPLIT(DINode::FlagPublic, {DINode::FlagPublic}, 0u);
|
CHECK_SPLIT(DINode::FlagPublic, {DINode::FlagPublic}, DINode::FlagZero);
|
||||||
CHECK_SPLIT(DINode::FlagProtected, {DINode::FlagProtected}, 0u);
|
CHECK_SPLIT(DINode::FlagProtected, {DINode::FlagProtected}, DINode::FlagZero);
|
||||||
CHECK_SPLIT(DINode::FlagPrivate, {DINode::FlagPrivate}, 0u);
|
CHECK_SPLIT(DINode::FlagPrivate, {DINode::FlagPrivate}, DINode::FlagZero);
|
||||||
CHECK_SPLIT(DINode::FlagVector, {DINode::FlagVector}, 0u);
|
CHECK_SPLIT(DINode::FlagVector, {DINode::FlagVector}, DINode::FlagZero);
|
||||||
CHECK_SPLIT(DINode::FlagRValueReference, {DINode::FlagRValueReference}, 0u);
|
CHECK_SPLIT(DINode::FlagRValueReference, {DINode::FlagRValueReference}, DINode::FlagZero);
|
||||||
unsigned Flags[] = {DINode::FlagFwdDecl, DINode::FlagVector};
|
DINode::DIFlags Flags[] = {DINode::FlagFwdDecl, DINode::FlagVector};
|
||||||
CHECK_SPLIT(DINode::FlagFwdDecl | DINode::FlagVector, Flags, 0u);
|
CHECK_SPLIT(DINode::FlagFwdDecl | DINode::FlagVector, Flags, DINode::FlagZero);
|
||||||
CHECK_SPLIT(0x200000u, {}, 0x200000u);
|
CHECK_SPLIT(DINode::FlagZero, {}, DINode::FlagZero);
|
||||||
CHECK_SPLIT(0x200000u | DINode::FlagVector, {DINode::FlagVector}, 0x200000u);
|
|
||||||
CHECK_SPLIT(0x200000u | DINode::FlagNoReturn, {DINode::FlagNoReturn}, 0x200000u);
|
|
||||||
#undef CHECK_SPLIT
|
#undef CHECK_SPLIT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ TEST(DebugTypeODRUniquingTest, getODRType) {
|
|||||||
// Without a type map, this should return null.
|
// Without a type map, this should return null.
|
||||||
EXPECT_FALSE(DICompositeType::getODRType(
|
EXPECT_FALSE(DICompositeType::getODRType(
|
||||||
Context, UUID, dwarf::DW_TAG_class_type, nullptr, nullptr, 0, nullptr,
|
Context, UUID, dwarf::DW_TAG_class_type, nullptr, nullptr, 0, nullptr,
|
||||||
nullptr, 0, 0, 0, 0, nullptr, 0, nullptr, nullptr));
|
nullptr, 0, 0, 0, DINode::FlagZero, nullptr, 0, nullptr, nullptr));
|
||||||
|
|
||||||
// Enable the mapping. There still shouldn't be a type.
|
// Enable the mapping. There still shouldn't be a type.
|
||||||
Context.enableDebugTypeODRUniquing();
|
Context.enableDebugTypeODRUniquing();
|
||||||
@ -39,7 +39,7 @@ TEST(DebugTypeODRUniquingTest, getODRType) {
|
|||||||
// Create some ODR-uniqued type.
|
// Create some ODR-uniqued type.
|
||||||
auto &CT = *DICompositeType::getODRType(
|
auto &CT = *DICompositeType::getODRType(
|
||||||
Context, UUID, dwarf::DW_TAG_class_type, nullptr, nullptr, 0, nullptr,
|
Context, UUID, dwarf::DW_TAG_class_type, nullptr, nullptr, 0, nullptr,
|
||||||
nullptr, 0, 0, 0, 0, nullptr, 0, nullptr, nullptr);
|
nullptr, 0, 0, 0, DINode::FlagZero, nullptr, 0, nullptr, nullptr);
|
||||||
EXPECT_EQ(UUID.getString(), CT.getIdentifier());
|
EXPECT_EQ(UUID.getString(), CT.getIdentifier());
|
||||||
|
|
||||||
// Check that we get it back, even if we change a field.
|
// Check that we get it back, even if we change a field.
|
||||||
@ -47,11 +47,13 @@ TEST(DebugTypeODRUniquingTest, getODRType) {
|
|||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
&CT, DICompositeType::getODRType(Context, UUID, dwarf::DW_TAG_class_type,
|
&CT, DICompositeType::getODRType(Context, UUID, dwarf::DW_TAG_class_type,
|
||||||
nullptr, nullptr, 0, nullptr, nullptr, 0,
|
nullptr, nullptr, 0, nullptr, nullptr, 0,
|
||||||
0, 0, 0, nullptr, 0, nullptr, nullptr));
|
0, 0, DINode::FlagZero, nullptr, 0,
|
||||||
|
nullptr, nullptr));
|
||||||
EXPECT_EQ(&CT, DICompositeType::getODRType(
|
EXPECT_EQ(&CT, DICompositeType::getODRType(
|
||||||
Context, UUID, dwarf::DW_TAG_class_type,
|
Context, UUID, dwarf::DW_TAG_class_type,
|
||||||
MDString::get(Context, "name"), nullptr, 0, nullptr,
|
MDString::get(Context, "name"), nullptr, 0, nullptr,
|
||||||
nullptr, 0, 0, 0, 0, nullptr, 0, nullptr, nullptr));
|
nullptr, 0, 0, 0, DINode::FlagZero, nullptr, 0,
|
||||||
|
nullptr, nullptr));
|
||||||
|
|
||||||
// Check that it's discarded with the type map.
|
// Check that it's discarded with the type map.
|
||||||
Context.disableDebugTypeODRUniquing();
|
Context.disableDebugTypeODRUniquing();
|
||||||
@ -83,7 +85,7 @@ TEST(DebugTypeODRUniquingTest, buildODRType) {
|
|||||||
// Update with a definition. This time we should see a change.
|
// Update with a definition. This time we should see a change.
|
||||||
EXPECT_EQ(&CT, DICompositeType::buildODRType(
|
EXPECT_EQ(&CT, DICompositeType::buildODRType(
|
||||||
Context, UUID, dwarf::DW_TAG_structure_type, nullptr, nullptr, 0, nullptr,
|
Context, UUID, dwarf::DW_TAG_structure_type, nullptr, nullptr, 0, nullptr,
|
||||||
nullptr, 0, 0, 0, 0, nullptr, 0, nullptr, nullptr));
|
nullptr, 0, 0, 0, DINode::FlagZero, nullptr, 0, nullptr, nullptr));
|
||||||
EXPECT_EQ(dwarf::DW_TAG_structure_type, CT.getTag());
|
EXPECT_EQ(dwarf::DW_TAG_structure_type, CT.getTag());
|
||||||
|
|
||||||
// Further updates should be ignored.
|
// Further updates should be ignored.
|
||||||
@ -93,7 +95,7 @@ TEST(DebugTypeODRUniquingTest, buildODRType) {
|
|||||||
EXPECT_EQ(dwarf::DW_TAG_structure_type, CT.getTag());
|
EXPECT_EQ(dwarf::DW_TAG_structure_type, CT.getTag());
|
||||||
EXPECT_EQ(&CT, DICompositeType::buildODRType(
|
EXPECT_EQ(&CT, DICompositeType::buildODRType(
|
||||||
Context, UUID, dwarf::DW_TAG_class_type, nullptr, nullptr, 0, nullptr,
|
Context, UUID, dwarf::DW_TAG_class_type, nullptr, nullptr, 0, nullptr,
|
||||||
nullptr, 0, 0, 0, 0, nullptr, 0, nullptr, nullptr));
|
nullptr, 0, 0, 0, DINode::FlagZero, nullptr, 0, nullptr, nullptr));
|
||||||
EXPECT_EQ(dwarf::DW_TAG_structure_type, CT.getTag());
|
EXPECT_EQ(dwarf::DW_TAG_structure_type, CT.getTag());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,11 +344,13 @@ TEST_F(IRBuilderTest, DIBuilder) {
|
|||||||
"llvm-cobol74", true, "", 0);
|
"llvm-cobol74", true, "", 0);
|
||||||
auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
|
auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
|
||||||
auto SP =
|
auto SP =
|
||||||
DIB.createFunction(CU, "foo", "", File, 1, Type, false, true, 1, 0, true);
|
DIB.createFunction(CU, "foo", "", File, 1, Type, false, true, 1,
|
||||||
|
DINode::FlagZero, true);
|
||||||
F->setSubprogram(SP);
|
F->setSubprogram(SP);
|
||||||
AllocaInst *I = Builder.CreateAlloca(Builder.getInt8Ty());
|
AllocaInst *I = Builder.CreateAlloca(Builder.getInt8Ty());
|
||||||
auto BarSP =
|
auto BarSP =
|
||||||
DIB.createFunction(CU, "bar", "", File, 1, Type, false, true, 1, 0, true);
|
DIB.createFunction(CU, "bar", "", File, 1, Type, false, true, 1,
|
||||||
|
DINode::FlagZero, true);
|
||||||
auto BadScope = DIB.createLexicalBlockFile(BarSP, File, 0);
|
auto BadScope = DIB.createLexicalBlockFile(BarSP, File, 0);
|
||||||
I->setDebugLoc(DebugLoc::get(2, 0, BadScope));
|
I->setDebugLoc(DebugLoc::get(2, 0, BadScope));
|
||||||
DIB.finalize();
|
DIB.finalize();
|
||||||
|
@ -80,12 +80,13 @@ protected:
|
|||||||
|
|
||||||
MDTuple *getTuple() { return MDTuple::getDistinct(Context, None); }
|
MDTuple *getTuple() { return MDTuple::getDistinct(Context, None); }
|
||||||
DISubroutineType *getSubroutineType() {
|
DISubroutineType *getSubroutineType() {
|
||||||
return DISubroutineType::getDistinct(Context, 0, 0, getNode(nullptr));
|
return DISubroutineType::getDistinct(Context, DINode::FlagZero,
|
||||||
|
0, getNode(nullptr));
|
||||||
}
|
}
|
||||||
DISubprogram *getSubprogram() {
|
DISubprogram *getSubprogram() {
|
||||||
return DISubprogram::getDistinct(Context, nullptr, "", "", nullptr, 0,
|
return DISubprogram::getDistinct(Context, nullptr, "", "", nullptr, 0,
|
||||||
nullptr, false, false, 0, nullptr,
|
nullptr, false, false, 0, nullptr,
|
||||||
0, 0, 0, 0, false, nullptr);
|
0, 0, 0, DINode::FlagZero, false, nullptr);
|
||||||
}
|
}
|
||||||
DIFile *getFile() {
|
DIFile *getFile() {
|
||||||
return DIFile::getDistinct(Context, "file.c", "/path/to/dir");
|
return DIFile::getDistinct(Context, "file.c", "/path/to/dir");
|
||||||
@ -102,7 +103,8 @@ protected:
|
|||||||
DIType *getDerivedType() {
|
DIType *getDerivedType() {
|
||||||
return DIDerivedType::getDistinct(Context, dwarf::DW_TAG_pointer_type, "",
|
return DIDerivedType::getDistinct(Context, dwarf::DW_TAG_pointer_type, "",
|
||||||
nullptr, 0, nullptr,
|
nullptr, 0, nullptr,
|
||||||
getBasicType("basictype"), 1, 2, 0, 0);
|
getBasicType("basictype"),
|
||||||
|
1, 2, 0, DINode::FlagZero);
|
||||||
}
|
}
|
||||||
Constant *getConstant() {
|
Constant *getConstant() {
|
||||||
return ConstantInt::get(Type::getInt32Ty(Context), Counter++);
|
return ConstantInt::get(Type::getInt32Ty(Context), Counter++);
|
||||||
@ -113,7 +115,7 @@ protected:
|
|||||||
DIType *getCompositeType() {
|
DIType *getCompositeType() {
|
||||||
return DICompositeType::getDistinct(
|
return DICompositeType::getDistinct(
|
||||||
Context, dwarf::DW_TAG_structure_type, "", nullptr, 0, nullptr, nullptr,
|
Context, dwarf::DW_TAG_structure_type, "", nullptr, 0, nullptr, nullptr,
|
||||||
32, 32, 0, 0, nullptr, 0, nullptr, nullptr, "");
|
32, 32, 0, DINode::FlagZero, nullptr, 0, nullptr, nullptr, "");
|
||||||
}
|
}
|
||||||
Function *getFunction(StringRef Name) {
|
Function *getFunction(StringRef Name) {
|
||||||
return cast<Function>(M.getOrInsertFunction(
|
return cast<Function>(M.getOrInsertFunction(
|
||||||
@ -1028,19 +1030,21 @@ TEST_F(DITypeTest, setFlags) {
|
|||||||
Metadata *TypesOps[] = {nullptr};
|
Metadata *TypesOps[] = {nullptr};
|
||||||
Metadata *Types = MDTuple::get(Context, TypesOps);
|
Metadata *Types = MDTuple::get(Context, TypesOps);
|
||||||
|
|
||||||
DIType *D = DISubroutineType::getDistinct(Context, 0u, 0, Types);
|
DIType *D = DISubroutineType::getDistinct(Context, DINode::FlagZero,
|
||||||
EXPECT_EQ(0u, D->getFlags());
|
0, Types);
|
||||||
|
EXPECT_EQ(DINode::FlagZero, D->getFlags());
|
||||||
D->setFlags(DINode::FlagRValueReference);
|
D->setFlags(DINode::FlagRValueReference);
|
||||||
EXPECT_EQ(DINode::FlagRValueReference, D->getFlags());
|
EXPECT_EQ(DINode::FlagRValueReference, D->getFlags());
|
||||||
D->setFlags(0u);
|
D->setFlags(DINode::FlagZero);
|
||||||
EXPECT_EQ(0u, D->getFlags());
|
EXPECT_EQ(DINode::FlagZero, D->getFlags());
|
||||||
|
|
||||||
TempDIType T = DISubroutineType::getTemporary(Context, 0u, 0, Types);
|
TempDIType T = DISubroutineType::getTemporary(Context, DINode::FlagZero,
|
||||||
EXPECT_EQ(0u, T->getFlags());
|
0, Types);
|
||||||
|
EXPECT_EQ(DINode::FlagZero, T->getFlags());
|
||||||
T->setFlags(DINode::FlagRValueReference);
|
T->setFlags(DINode::FlagRValueReference);
|
||||||
EXPECT_EQ(DINode::FlagRValueReference, T->getFlags());
|
EXPECT_EQ(DINode::FlagRValueReference, T->getFlags());
|
||||||
T->setFlags(0u);
|
T->setFlags(DINode::FlagZero);
|
||||||
EXPECT_EQ(0u, T->getFlags());
|
EXPECT_EQ(DINode::FlagZero, T->getFlags());
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef MetadataTest DIDerivedTypeTest;
|
typedef MetadataTest DIDerivedTypeTest;
|
||||||
@ -1050,9 +1054,12 @@ TEST_F(DIDerivedTypeTest, get) {
|
|||||||
DIScope *Scope = getSubprogram();
|
DIScope *Scope = getSubprogram();
|
||||||
DIType *BaseType = getBasicType("basic");
|
DIType *BaseType = getBasicType("basic");
|
||||||
MDTuple *ExtraData = getTuple();
|
MDTuple *ExtraData = getTuple();
|
||||||
|
DINode::DIFlags Flags5 = static_cast<DINode::DIFlags>(5);
|
||||||
|
DINode::DIFlags Flags4 = static_cast<DINode::DIFlags>(4);
|
||||||
|
|
||||||
auto *N = DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type, "something",
|
auto *N = DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type, "something",
|
||||||
File, 1, Scope, BaseType, 2, 3, 4, 5, ExtraData);
|
File, 1, Scope, BaseType, 2, 3, 4,
|
||||||
|
Flags5, ExtraData);
|
||||||
EXPECT_EQ(dwarf::DW_TAG_pointer_type, N->getTag());
|
EXPECT_EQ(dwarf::DW_TAG_pointer_type, N->getTag());
|
||||||
EXPECT_EQ("something", N->getName());
|
EXPECT_EQ("something", N->getName());
|
||||||
EXPECT_EQ(File, N->getFile());
|
EXPECT_EQ(File, N->getFile());
|
||||||
@ -1066,41 +1073,41 @@ TEST_F(DIDerivedTypeTest, get) {
|
|||||||
EXPECT_EQ(ExtraData, N->getExtraData());
|
EXPECT_EQ(ExtraData, N->getExtraData());
|
||||||
EXPECT_EQ(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
EXPECT_EQ(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
||||||
"something", File, 1, Scope, BaseType, 2, 3,
|
"something", File, 1, Scope, BaseType, 2, 3,
|
||||||
4, 5, ExtraData));
|
4, Flags5, ExtraData));
|
||||||
|
|
||||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_reference_type,
|
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_reference_type,
|
||||||
"something", File, 1, Scope, BaseType, 2, 3,
|
"something", File, 1, Scope, BaseType, 2, 3,
|
||||||
4, 5, ExtraData));
|
4, Flags5, ExtraData));
|
||||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type, "else",
|
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type, "else",
|
||||||
File, 1, Scope, BaseType, 2, 3, 4, 5,
|
File, 1, Scope, BaseType, 2, 3, 4,
|
||||||
ExtraData));
|
Flags5, ExtraData));
|
||||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
||||||
"something", getFile(), 1, Scope, BaseType, 2,
|
"something", getFile(), 1, Scope, BaseType, 2,
|
||||||
3, 4, 5, ExtraData));
|
3, 4, Flags5, ExtraData));
|
||||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
||||||
"something", File, 2, Scope, BaseType, 2, 3,
|
"something", File, 2, Scope, BaseType, 2, 3,
|
||||||
4, 5, ExtraData));
|
4, Flags5, ExtraData));
|
||||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
||||||
"something", File, 1, getSubprogram(),
|
"something", File, 1, getSubprogram(),
|
||||||
BaseType, 2, 3, 4, 5, ExtraData));
|
BaseType, 2, 3, 4, Flags5, ExtraData));
|
||||||
EXPECT_NE(N, DIDerivedType::get(
|
EXPECT_NE(N, DIDerivedType::get(
|
||||||
Context, dwarf::DW_TAG_pointer_type, "something", File, 1,
|
Context, dwarf::DW_TAG_pointer_type, "something", File, 1,
|
||||||
Scope, getBasicType("basic2"), 2, 3, 4, 5, ExtraData));
|
Scope, getBasicType("basic2"), 2, 3, 4, Flags5, ExtraData));
|
||||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
||||||
"something", File, 1, Scope, BaseType, 3, 3,
|
"something", File, 1, Scope, BaseType, 3, 3,
|
||||||
4, 5, ExtraData));
|
4, Flags5, ExtraData));
|
||||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
||||||
"something", File, 1, Scope, BaseType, 2, 2,
|
"something", File, 1, Scope, BaseType, 2, 2,
|
||||||
4, 5, ExtraData));
|
4, Flags5, ExtraData));
|
||||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
||||||
"something", File, 1, Scope, BaseType, 2, 3,
|
"something", File, 1, Scope, BaseType, 2, 3,
|
||||||
5, 5, ExtraData));
|
5, Flags5, ExtraData));
|
||||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
||||||
"something", File, 1, Scope, BaseType, 2, 3,
|
"something", File, 1, Scope, BaseType, 2, 3,
|
||||||
4, 4, ExtraData));
|
4, Flags4, ExtraData));
|
||||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
||||||
"something", File, 1, Scope, BaseType, 2, 3,
|
"something", File, 1, Scope, BaseType, 2, 3,
|
||||||
4, 5, getTuple()));
|
4, Flags5, getTuple()));
|
||||||
|
|
||||||
TempDIDerivedType Temp = N->clone();
|
TempDIDerivedType Temp = N->clone();
|
||||||
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
@ -1111,10 +1118,11 @@ TEST_F(DIDerivedTypeTest, getWithLargeValues) {
|
|||||||
DIScope *Scope = getSubprogram();
|
DIScope *Scope = getSubprogram();
|
||||||
DIType *BaseType = getBasicType("basic");
|
DIType *BaseType = getBasicType("basic");
|
||||||
MDTuple *ExtraData = getTuple();
|
MDTuple *ExtraData = getTuple();
|
||||||
|
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(5);
|
||||||
|
|
||||||
auto *N = DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type, "something",
|
auto *N = DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type, "something",
|
||||||
File, 1, Scope, BaseType, UINT64_MAX,
|
File, 1, Scope, BaseType, UINT64_MAX,
|
||||||
UINT64_MAX - 1, UINT64_MAX - 2, 5, ExtraData);
|
UINT64_MAX - 1, UINT64_MAX - 2, Flags, ExtraData);
|
||||||
EXPECT_EQ(UINT64_MAX, N->getSizeInBits());
|
EXPECT_EQ(UINT64_MAX, N->getSizeInBits());
|
||||||
EXPECT_EQ(UINT64_MAX - 1, N->getAlignInBits());
|
EXPECT_EQ(UINT64_MAX - 1, N->getAlignInBits());
|
||||||
EXPECT_EQ(UINT64_MAX - 2, N->getOffsetInBits());
|
EXPECT_EQ(UINT64_MAX - 2, N->getOffsetInBits());
|
||||||
@ -1132,7 +1140,7 @@ TEST_F(DICompositeTypeTest, get) {
|
|||||||
uint64_t SizeInBits = 2;
|
uint64_t SizeInBits = 2;
|
||||||
uint64_t AlignInBits = 3;
|
uint64_t AlignInBits = 3;
|
||||||
uint64_t OffsetInBits = 4;
|
uint64_t OffsetInBits = 4;
|
||||||
unsigned Flags = 5;
|
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(5);
|
||||||
MDTuple *Elements = getTuple();
|
MDTuple *Elements = getTuple();
|
||||||
unsigned RuntimeLang = 6;
|
unsigned RuntimeLang = 6;
|
||||||
DIType *VTableHolder = getCompositeType();
|
DIType *VTableHolder = getCompositeType();
|
||||||
@ -1200,9 +1208,10 @@ TEST_F(DICompositeTypeTest, get) {
|
|||||||
Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits,
|
Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits,
|
||||||
AlignInBits, OffsetInBits + 1, Flags, Elements, RuntimeLang,
|
AlignInBits, OffsetInBits + 1, Flags, Elements, RuntimeLang,
|
||||||
VTableHolder, TemplateParams, Identifier));
|
VTableHolder, TemplateParams, Identifier));
|
||||||
|
DINode::DIFlags FlagsPOne = static_cast<DINode::DIFlags>(Flags + 1);
|
||||||
EXPECT_NE(N, DICompositeType::get(
|
EXPECT_NE(N, DICompositeType::get(
|
||||||
Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits,
|
Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits,
|
||||||
AlignInBits, OffsetInBits, Flags + 1, Elements, RuntimeLang,
|
AlignInBits, OffsetInBits, FlagsPOne, Elements, RuntimeLang,
|
||||||
VTableHolder, TemplateParams, Identifier));
|
VTableHolder, TemplateParams, Identifier));
|
||||||
EXPECT_NE(N, DICompositeType::get(
|
EXPECT_NE(N, DICompositeType::get(
|
||||||
Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits,
|
Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits,
|
||||||
@ -1251,7 +1260,7 @@ TEST_F(DICompositeTypeTest, getWithLargeValues) {
|
|||||||
uint64_t SizeInBits = UINT64_MAX;
|
uint64_t SizeInBits = UINT64_MAX;
|
||||||
uint64_t AlignInBits = UINT64_MAX - 1;
|
uint64_t AlignInBits = UINT64_MAX - 1;
|
||||||
uint64_t OffsetInBits = UINT64_MAX - 2;
|
uint64_t OffsetInBits = UINT64_MAX - 2;
|
||||||
unsigned Flags = 5;
|
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(5);
|
||||||
MDTuple *Elements = getTuple();
|
MDTuple *Elements = getTuple();
|
||||||
unsigned RuntimeLang = 6;
|
unsigned RuntimeLang = 6;
|
||||||
DIType *VTableHolder = getCompositeType();
|
DIType *VTableHolder = getCompositeType();
|
||||||
@ -1277,7 +1286,7 @@ TEST_F(DICompositeTypeTest, replaceOperands) {
|
|||||||
uint64_t SizeInBits = 2;
|
uint64_t SizeInBits = 2;
|
||||||
uint64_t AlignInBits = 3;
|
uint64_t AlignInBits = 3;
|
||||||
uint64_t OffsetInBits = 4;
|
uint64_t OffsetInBits = 4;
|
||||||
unsigned Flags = 5;
|
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(5);
|
||||||
unsigned RuntimeLang = 6;
|
unsigned RuntimeLang = 6;
|
||||||
StringRef Identifier = "some id";
|
StringRef Identifier = "some id";
|
||||||
|
|
||||||
@ -1310,7 +1319,8 @@ TEST_F(DICompositeTypeTest, replaceOperands) {
|
|||||||
typedef MetadataTest DISubroutineTypeTest;
|
typedef MetadataTest DISubroutineTypeTest;
|
||||||
|
|
||||||
TEST_F(DISubroutineTypeTest, get) {
|
TEST_F(DISubroutineTypeTest, get) {
|
||||||
unsigned Flags = 1;
|
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(1);
|
||||||
|
DINode::DIFlags FlagsPOne = static_cast<DINode::DIFlags>(Flags + 1);
|
||||||
MDTuple *TypeArray = getTuple();
|
MDTuple *TypeArray = getTuple();
|
||||||
|
|
||||||
auto *N = DISubroutineType::get(Context, Flags, 0, TypeArray);
|
auto *N = DISubroutineType::get(Context, Flags, 0, TypeArray);
|
||||||
@ -1319,7 +1329,7 @@ TEST_F(DISubroutineTypeTest, get) {
|
|||||||
EXPECT_EQ(TypeArray, N->getTypeArray().get());
|
EXPECT_EQ(TypeArray, N->getTypeArray().get());
|
||||||
EXPECT_EQ(N, DISubroutineType::get(Context, Flags, 0, TypeArray));
|
EXPECT_EQ(N, DISubroutineType::get(Context, Flags, 0, TypeArray));
|
||||||
|
|
||||||
EXPECT_NE(N, DISubroutineType::get(Context, Flags + 1, 0, TypeArray));
|
EXPECT_NE(N, DISubroutineType::get(Context, FlagsPOne, 0, TypeArray));
|
||||||
EXPECT_NE(N, DISubroutineType::get(Context, Flags, 0, getTuple()));
|
EXPECT_NE(N, DISubroutineType::get(Context, Flags, 0, getTuple()));
|
||||||
|
|
||||||
// Test the hashing of calling conventions.
|
// Test the hashing of calling conventions.
|
||||||
@ -1481,8 +1491,7 @@ TEST_F(DISubprogramTest, get) {
|
|||||||
unsigned Virtuality = 2;
|
unsigned Virtuality = 2;
|
||||||
unsigned VirtualIndex = 5;
|
unsigned VirtualIndex = 5;
|
||||||
int ThisAdjustment = -3;
|
int ThisAdjustment = -3;
|
||||||
unsigned Flags = 6;
|
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(6);
|
||||||
unsigned NotFlags = (~Flags) & ((1 << 27) - 1);
|
|
||||||
bool IsOptimized = false;
|
bool IsOptimized = false;
|
||||||
MDTuple *TemplateParams = getTuple();
|
MDTuple *TemplateParams = getTuple();
|
||||||
DISubprogram *Declaration = getSubprogram();
|
DISubprogram *Declaration = getSubprogram();
|
||||||
@ -1582,11 +1591,6 @@ TEST_F(DISubprogramTest, get) {
|
|||||||
ContainingType, Virtuality, VirtualIndex + 1,
|
ContainingType, Virtuality, VirtualIndex + 1,
|
||||||
ThisAdjustment, Flags, IsOptimized, Unit,
|
ThisAdjustment, Flags, IsOptimized, Unit,
|
||||||
TemplateParams, Declaration, Variables));
|
TemplateParams, Declaration, Variables));
|
||||||
EXPECT_NE(N, DISubprogram::get(Context, Scope, Name, LinkageName, File, Line,
|
|
||||||
Type, IsLocalToUnit, IsDefinition, ScopeLine,
|
|
||||||
ContainingType, Virtuality, VirtualIndex,
|
|
||||||
ThisAdjustment, NotFlags, IsOptimized, Unit,
|
|
||||||
TemplateParams, Declaration, Variables));
|
|
||||||
EXPECT_NE(N, DISubprogram::get(Context, Scope, Name, LinkageName, File, Line,
|
EXPECT_NE(N, DISubprogram::get(Context, Scope, Name, LinkageName, File, Line,
|
||||||
Type, IsLocalToUnit, IsDefinition, ScopeLine,
|
Type, IsLocalToUnit, IsDefinition, ScopeLine,
|
||||||
ContainingType, Virtuality, VirtualIndex,
|
ContainingType, Virtuality, VirtualIndex,
|
||||||
@ -1889,8 +1893,7 @@ TEST_F(DILocalVariableTest, get) {
|
|||||||
unsigned Line = 5;
|
unsigned Line = 5;
|
||||||
DIType *Type = getDerivedType();
|
DIType *Type = getDerivedType();
|
||||||
unsigned Arg = 6;
|
unsigned Arg = 6;
|
||||||
unsigned Flags = 7;
|
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(7);
|
||||||
unsigned NotFlags = (~Flags) & ((1 << 16) - 1);
|
|
||||||
|
|
||||||
auto *N =
|
auto *N =
|
||||||
DILocalVariable::get(Context, Scope, Name, File, Line, Type, Arg, Flags);
|
DILocalVariable::get(Context, Scope, Name, File, Line, Type, Arg, Flags);
|
||||||
@ -1920,8 +1923,6 @@ TEST_F(DILocalVariableTest, get) {
|
|||||||
getDerivedType(), Arg, Flags));
|
getDerivedType(), Arg, Flags));
|
||||||
EXPECT_NE(N, DILocalVariable::get(Context, Scope, Name, File, Line, Type,
|
EXPECT_NE(N, DILocalVariable::get(Context, Scope, Name, File, Line, Type,
|
||||||
Arg + 1, Flags));
|
Arg + 1, Flags));
|
||||||
EXPECT_NE(N, DILocalVariable::get(Context, Scope, Name, File, Line, Type, Arg,
|
|
||||||
NotFlags));
|
|
||||||
|
|
||||||
TempDILocalVariable Temp = N->clone();
|
TempDILocalVariable Temp = N->clone();
|
||||||
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||||
@ -1929,17 +1930,17 @@ TEST_F(DILocalVariableTest, get) {
|
|||||||
|
|
||||||
TEST_F(DILocalVariableTest, getArg256) {
|
TEST_F(DILocalVariableTest, getArg256) {
|
||||||
EXPECT_EQ(255u, DILocalVariable::get(Context, getSubprogram(), "", getFile(),
|
EXPECT_EQ(255u, DILocalVariable::get(Context, getSubprogram(), "", getFile(),
|
||||||
0, nullptr, 255, 0)
|
0, nullptr, 255, DINode::FlagZero)
|
||||||
->getArg());
|
->getArg());
|
||||||
EXPECT_EQ(256u, DILocalVariable::get(Context, getSubprogram(), "", getFile(),
|
EXPECT_EQ(256u, DILocalVariable::get(Context, getSubprogram(), "", getFile(),
|
||||||
0, nullptr, 256, 0)
|
0, nullptr, 256, DINode::FlagZero)
|
||||||
->getArg());
|
->getArg());
|
||||||
EXPECT_EQ(257u, DILocalVariable::get(Context, getSubprogram(), "", getFile(),
|
EXPECT_EQ(257u, DILocalVariable::get(Context, getSubprogram(), "", getFile(),
|
||||||
0, nullptr, 257, 0)
|
0, nullptr, 257, DINode::FlagZero)
|
||||||
->getArg());
|
->getArg());
|
||||||
unsigned Max = UINT16_MAX;
|
unsigned Max = UINT16_MAX;
|
||||||
EXPECT_EQ(Max, DILocalVariable::get(Context, getSubprogram(), "", getFile(),
|
EXPECT_EQ(Max, DILocalVariable::get(Context, getSubprogram(), "", getFile(),
|
||||||
0, nullptr, Max, 0)
|
0, nullptr, Max, DINode::FlagZero)
|
||||||
->getArg());
|
->getArg());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ protected:
|
|||||||
"/file/dir", "CloneFunc", false, "", 0);
|
"/file/dir", "CloneFunc", false, "", 0);
|
||||||
|
|
||||||
auto *Subprogram = DBuilder.createFunction(
|
auto *Subprogram = DBuilder.createFunction(
|
||||||
CU, "f", "f", File, 4, FuncType, true, true, 3, 0, false);
|
CU, "f", "f", File, 4, FuncType, true, true, 3, DINode::FlagZero, false);
|
||||||
OldFunc->setSubprogram(Subprogram);
|
OldFunc->setSubprogram(Subprogram);
|
||||||
|
|
||||||
// Function body
|
// Function body
|
||||||
@ -422,7 +422,8 @@ protected:
|
|||||||
"/file/dir", "CloneModule", false, "", 0);
|
"/file/dir", "CloneModule", false, "", 0);
|
||||||
// Function DI
|
// Function DI
|
||||||
auto *Subprogram = DBuilder.createFunction(CU, "f", "f", File, 4, DFuncType,
|
auto *Subprogram = DBuilder.createFunction(CU, "f", "f", File, 4, DFuncType,
|
||||||
true, true, 3, 0, false);
|
true, true, 3, DINode::FlagZero,
|
||||||
|
false);
|
||||||
F->setSubprogram(Subprogram);
|
F->setSubprogram(Subprogram);
|
||||||
|
|
||||||
auto *Entry = BasicBlock::Create(C, "", F);
|
auto *Entry = BasicBlock::Create(C, "", F);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user