|
@@ -14,6 +14,7 @@
|
|
#ifndef LLVM_IR_DEBUGINFOMETADATA_H
|
|
#ifndef LLVM_IR_DEBUGINFOMETADATA_H
|
|
#define LLVM_IR_DEBUGINFOMETADATA_H
|
|
#define LLVM_IR_DEBUGINFOMETADATA_H
|
|
|
|
|
|
|
|
+#include "llvm/ADT/BitmaskEnum.h"
|
|
#include "llvm/IR/Metadata.h"
|
|
#include "llvm/IR/Metadata.h"
|
|
#include "llvm/Support/Dwarf.h"
|
|
#include "llvm/Support/Dwarf.h"
|
|
|
|
|
|
@@ -171,23 +172,26 @@ 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 const char *getFlagString(unsigned Flag);
|
|
|
|
|
|
+ static DIFlags getFlag(StringRef Flag);
|
|
|
|
+ static const char *getFlagString(DIFlags Flag);
|
|
|
|
+ // static const char *getFlagString(DIFlagsUnderlying 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,
|
|
|
|
- SmallVectorImpl<unsigned> &SplitFlags);
|
|
|
|
|
|
+ static DIFlags splitFlags(DIFlags Flags,
|
|
|
|
+ SmallVectorImpl<DIFlags> &SplitFlags);
|
|
|
|
|
|
static bool classof(const Metadata *MD) {
|
|
static bool classof(const Metadata *MD) {
|
|
switch (MD->getMetadataID()) {
|
|
switch (MD->getMetadataID()) {
|
|
@@ -508,7 +512,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 +520,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 +537,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 +552,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 +561,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 +618,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 +672,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 +681,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 +692,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,15 +708,15 @@ 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))
|
|
DEFINE_MDNODE_GET(DIDerivedType,
|
|
DEFINE_MDNODE_GET(DIDerivedType,
|
|
(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,
|
|
|
|
- unsigned Flags, Metadata *ExtraData = nullptr),
|
|
|
|
|
|
+ uint64_t AlignInBits, uint64_t OffsetInBits, 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 +776,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 +786,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 +797,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 +810,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);
|
|
|
|
|
|
@@ -822,8 +826,8 @@ public:
|
|
DEFINE_MDNODE_GET(DICompositeType,
|
|
DEFINE_MDNODE_GET(DICompositeType,
|
|
(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,
|
|
|
|
- unsigned Flags, DINodeArray Elements, unsigned RuntimeLang,
|
|
|
|
|
|
+ uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags,
|
|
|
|
+ DINodeArray Elements, unsigned RuntimeLang,
|
|
DITypeRef VTableHolder,
|
|
DITypeRef VTableHolder,
|
|
DITemplateParameterArray TemplateParams = nullptr,
|
|
DITemplateParameterArray TemplateParams = nullptr,
|
|
StringRef Identifier = ""),
|
|
StringRef Identifier = ""),
|
|
@@ -834,7 +838,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 +859,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 +878,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 +937,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 +961,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 +1303,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 +1311,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 +1335,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 +1352,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 +1371,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 +1385,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 +1400,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,24 +1422,18 @@ 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 {
|
|
|
|
- return getFlags() & FlagLValueReference;
|
|
|
|
- }
|
|
|
|
|
|
+ bool isLValueReference() const { return getFlags() & FlagLValueReference; }
|
|
|
|
|
|
/// \brief Check if this is rvalue-reference-qualified.
|
|
/// \brief Check if this is rvalue-reference-qualified.
|
|
///
|
|
///
|
|
/// 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 {
|
|
|
|
- return getFlags() & FlagRValueReference;
|
|
|
|
- }
|
|
|
|
|
|
+ bool isRValueReference() const { 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 {
|
|
|
|
- return getFlags() & FlagNoReturn;
|
|
|
|
- }
|
|
|
|
|
|
+ bool isNoReturn() const { return getFlags() & FlagNoReturn; }
|
|
|
|
|
|
DIScopeRef getScope() const { return DIScopeRef(getRawScope()); }
|
|
DIScopeRef getScope() const { return DIScopeRef(getRawScope()); }
|
|
|
|
|
|
@@ -1955,20 +1954,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 +1974,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);
|
|
|
|
|
|
@@ -1989,12 +1987,12 @@ 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,
|
|
- unsigned Flags),
|
|
|
|
|
|
+ DIFlags 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,
|
|
- unsigned Flags),
|
|
|
|
|
|
+ DIFlags 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 +2006,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; }
|