mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Revert "DebugInfo: use strongly typed enum for debug info flags"
This reverts commit r280686, bots are broken. llvm-svn: 280688
This commit is contained in:
parent
2f275228ad
commit
0fd43d38ae
@ -145,10 +145,10 @@ namespace llvm {
|
||||
/// \param SizeInBits Size.
|
||||
/// \param AlignInBits Alignment. (optional)
|
||||
/// \param Class Type for which this pointer points to members of.
|
||||
DIDerivedType *
|
||||
createMemberPointerType(DIType *PointeeTy, DIType *Class,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits = 0,
|
||||
DINode::DIFlags Flags = DINode::FlagZero);
|
||||
DIDerivedType *createMemberPointerType(DIType *PointeeTy, DIType *Class,
|
||||
uint64_t SizeInBits,
|
||||
uint64_t AlignInBits = 0,
|
||||
unsigned Flags = 0);
|
||||
|
||||
/// Create debugging information entry for a c++
|
||||
/// style reference or rvalue reference type.
|
||||
@ -176,8 +176,7 @@ namespace llvm {
|
||||
/// \param Flags Flags to describe inheritance attribute,
|
||||
/// e.g. private
|
||||
DIDerivedType *createInheritance(DIType *Ty, DIType *BaseTy,
|
||||
uint64_t BaseOffset,
|
||||
DINode::DIFlags Flags);
|
||||
uint64_t BaseOffset, unsigned Flags);
|
||||
|
||||
/// Create debugging information entry for a member.
|
||||
/// \param Scope Member scope.
|
||||
@ -192,8 +191,8 @@ namespace llvm {
|
||||
DIDerivedType *createMemberType(DIScope *Scope, StringRef Name,
|
||||
DIFile *File, unsigned LineNo,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits,
|
||||
DINode::DIFlags Flags, DIType *Ty);
|
||||
uint64_t OffsetInBits, unsigned Flags,
|
||||
DIType *Ty);
|
||||
|
||||
/// Create debugging information entry for a bit field member.
|
||||
/// \param Scope Member scope.
|
||||
@ -209,7 +208,7 @@ namespace llvm {
|
||||
DIDerivedType *createBitFieldMemberType(
|
||||
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||
uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty);
|
||||
uint64_t StorageOffsetInBits, unsigned Flags, DIType *Ty);
|
||||
|
||||
/// Create debugging information entry for a
|
||||
/// C++ static data member.
|
||||
@ -222,7 +221,7 @@ namespace llvm {
|
||||
/// \param Val Const initializer of the member.
|
||||
DIDerivedType *createStaticMemberType(DIScope *Scope, StringRef Name,
|
||||
DIFile *File, unsigned LineNo,
|
||||
DIType *Ty, DINode::DIFlags Flags,
|
||||
DIType *Ty, unsigned Flags,
|
||||
llvm::Constant *Val);
|
||||
|
||||
/// Create debugging information entry for Objective-C
|
||||
@ -238,7 +237,7 @@ namespace llvm {
|
||||
/// \param PropertyNode Property associated with this ivar.
|
||||
DIDerivedType *createObjCIVar(StringRef Name, DIFile *File, unsigned LineNo,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, DINode::DIFlags Flags,
|
||||
uint64_t OffsetInBits, unsigned Flags,
|
||||
DIType *Ty, MDNode *PropertyNode);
|
||||
|
||||
/// Create debugging information entry for Objective-C
|
||||
@ -272,12 +271,14 @@ namespace llvm {
|
||||
/// for more info.
|
||||
/// \param TemplateParms Template type parameters.
|
||||
/// \param UniqueIdentifier A unique identifier for the class.
|
||||
DICompositeType *createClassType(
|
||||
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||
DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements,
|
||||
DIType *VTableHolder = nullptr, MDNode *TemplateParms = nullptr,
|
||||
StringRef UniqueIdentifier = "");
|
||||
DICompositeType *createClassType(DIScope *Scope, StringRef Name,
|
||||
DIFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, unsigned Flags,
|
||||
DIType *DerivedFrom, DINodeArray Elements,
|
||||
DIType *VTableHolder = nullptr,
|
||||
MDNode *TemplateParms = nullptr,
|
||||
StringRef UniqueIdentifier = "");
|
||||
|
||||
/// Create debugging information entry for a struct.
|
||||
/// \param Scope Scope in which this struct is defined.
|
||||
@ -292,7 +293,7 @@ namespace llvm {
|
||||
/// \param UniqueIdentifier A unique identifier for the struct.
|
||||
DICompositeType *createStructType(
|
||||
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, DINode::DIFlags Flags,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
|
||||
DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0,
|
||||
DIType *VTableHolder = nullptr, StringRef UniqueIdentifier = "");
|
||||
|
||||
@ -310,8 +311,7 @@ namespace llvm {
|
||||
DICompositeType *createUnionType(DIScope *Scope, StringRef Name,
|
||||
DIFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
DINode::DIFlags Flags,
|
||||
DINodeArray Elements,
|
||||
unsigned Flags, DINodeArray Elements,
|
||||
unsigned RunTimeLang = 0,
|
||||
StringRef UniqueIdentifier = "");
|
||||
|
||||
@ -392,10 +392,8 @@ namespace llvm {
|
||||
/// \param Flags E.g.: LValueReference.
|
||||
/// These flags are used to emit dwarf attributes.
|
||||
/// \param CC Calling convention, e.g. dwarf::DW_CC_normal
|
||||
DISubroutineType *
|
||||
createSubroutineType(DITypeRefArray ParameterTypes,
|
||||
DINode::DIFlags Flags = DINode::FlagZero,
|
||||
unsigned CC = 0);
|
||||
DISubroutineType *createSubroutineType(DITypeRefArray ParameterTypes,
|
||||
unsigned Flags = 0, unsigned CC = 0);
|
||||
|
||||
/// Create an external type reference.
|
||||
/// \param Tag Dwarf TAG.
|
||||
@ -423,7 +421,7 @@ namespace llvm {
|
||||
DICompositeType *createReplaceableCompositeType(
|
||||
unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
|
||||
unsigned RuntimeLang = 0, uint64_t SizeInBits = 0,
|
||||
uint64_t AlignInBits = 0, DINode::DIFlags Flags = DINode::FlagFwdDecl,
|
||||
uint64_t AlignInBits = 0, unsigned Flags = DINode::FlagFwdDecl,
|
||||
StringRef UniqueIdentifier = "");
|
||||
|
||||
/// Retain DIScope* in a module even if it is not referenced
|
||||
@ -478,10 +476,11 @@ namespace llvm {
|
||||
///
|
||||
/// If \c AlwaysPreserve, this variable will be referenced from its
|
||||
/// containing subprogram, and will survive some optimizations.
|
||||
DILocalVariable *
|
||||
createAutoVariable(DIScope *Scope, StringRef Name, DIFile *File,
|
||||
unsigned LineNo, DIType *Ty, bool AlwaysPreserve = false,
|
||||
DINode::DIFlags Flags = DINode::FlagZero);
|
||||
DILocalVariable *createAutoVariable(DIScope *Scope, StringRef Name,
|
||||
DIFile *File, unsigned LineNo,
|
||||
DIType *Ty,
|
||||
bool AlwaysPreserve = false,
|
||||
unsigned Flags = 0);
|
||||
|
||||
/// Create a new descriptor for a parameter variable.
|
||||
///
|
||||
@ -494,11 +493,11 @@ namespace llvm {
|
||||
///
|
||||
/// If \c AlwaysPreserve, this variable will be referenced from its
|
||||
/// containing subprogram, and will survive some optimizations.
|
||||
DILocalVariable *
|
||||
createParameterVariable(DIScope *Scope, StringRef Name, unsigned ArgNo,
|
||||
DIFile *File, unsigned LineNo, DIType *Ty,
|
||||
bool AlwaysPreserve = false,
|
||||
DINode::DIFlags Flags = DINode::FlagZero);
|
||||
DILocalVariable *createParameterVariable(DIScope *Scope, StringRef Name,
|
||||
unsigned ArgNo, DIFile *File,
|
||||
unsigned LineNo, DIType *Ty,
|
||||
bool AlwaysPreserve = false,
|
||||
unsigned Flags = 0);
|
||||
|
||||
/// Create a new descriptor for the specified
|
||||
/// variable which has a complex address expression for its address.
|
||||
@ -533,8 +532,7 @@ namespace llvm {
|
||||
StringRef LinkageName, DIFile *File,
|
||||
unsigned LineNo, DISubroutineType *Ty,
|
||||
bool isLocalToUnit, bool isDefinition,
|
||||
unsigned ScopeLine,
|
||||
DINode::DIFlags Flags = DINode::FlagZero,
|
||||
unsigned ScopeLine, unsigned Flags = 0,
|
||||
bool isOptimized = false,
|
||||
DITemplateParameterArray TParams = nullptr,
|
||||
DISubprogram *Decl = nullptr);
|
||||
@ -544,9 +542,8 @@ namespace llvm {
|
||||
DISubprogram *createTempFunctionFwdDecl(
|
||||
DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
|
||||
unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
|
||||
bool isDefinition, unsigned ScopeLine,
|
||||
DINode::DIFlags Flags = DINode::FlagZero, bool isOptimized = false,
|
||||
DITemplateParameterArray TParams = nullptr,
|
||||
bool isDefinition, unsigned ScopeLine, unsigned Flags = 0,
|
||||
bool isOptimized = false, DITemplateParameterArray TParams = nullptr,
|
||||
DISubprogram *Decl = nullptr);
|
||||
|
||||
/// Create a new descriptor for the specified C++ method.
|
||||
@ -571,13 +568,14 @@ namespace llvm {
|
||||
/// This flags are used to emit dwarf attributes.
|
||||
/// \param isOptimized True if optimization is ON.
|
||||
/// \param TParams Function template parameters.
|
||||
DISubprogram *createMethod(
|
||||
DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
|
||||
unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
|
||||
bool isDefinition, unsigned Virtuality = 0, unsigned VTableIndex = 0,
|
||||
int ThisAdjustment = 0, DIType *VTableHolder = nullptr,
|
||||
DINode::DIFlags Flags = DINode::FlagZero, bool isOptimized = false,
|
||||
DITemplateParameterArray TParams = nullptr);
|
||||
DISubprogram *
|
||||
createMethod(DIScope *Scope, StringRef Name, StringRef LinkageName,
|
||||
DIFile *File, unsigned LineNo, DISubroutineType *Ty,
|
||||
bool isLocalToUnit, bool isDefinition, unsigned Virtuality = 0,
|
||||
unsigned VTableIndex = 0, int ThisAdjustment = 0,
|
||||
DIType *VTableHolder = nullptr, unsigned Flags = 0,
|
||||
bool isOptimized = false,
|
||||
DITemplateParameterArray TParams = nullptr);
|
||||
|
||||
/// This creates new descriptor for a namespace with the specified
|
||||
/// parent scope.
|
||||
|
@ -16,7 +16,6 @@
|
||||
#error "Missing macro definition of HANDLE_DI_FLAG"
|
||||
#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(2, Protected)
|
||||
HANDLE_DI_FLAG(3, Public)
|
||||
@ -41,11 +40,4 @@ HANDLE_DI_FLAG((1 << 18), IntroducedVirtual)
|
||||
HANDLE_DI_FLAG((1 << 19), BitField)
|
||||
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
|
||||
|
@ -14,7 +14,6 @@
|
||||
#ifndef LLVM_IR_DEBUGINFOMETADATA_H
|
||||
#define LLVM_IR_DEBUGINFOMETADATA_H
|
||||
|
||||
#include "llvm/ADT/BitmaskEnum.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
|
||||
@ -172,26 +171,23 @@ public:
|
||||
///
|
||||
/// The three accessibility flags are mutually exclusive and rolled together
|
||||
/// in the first two bits.
|
||||
enum DIFlags : uint32_t {
|
||||
enum DIFlags {
|
||||
#define HANDLE_DI_FLAG(ID, NAME) Flag##NAME = ID,
|
||||
#define DI_FLAG_LARGEST_NEEDED
|
||||
#include "llvm/IR/DebugInfoFlags.def"
|
||||
FlagAccessibility = FlagPrivate | FlagProtected | FlagPublic,
|
||||
FlagPtrToMemberRep = FlagSingleInheritance | FlagMultipleInheritance |
|
||||
FlagVirtualInheritance,
|
||||
LLVM_MARK_AS_BITMASK_ENUM(FlagLargest)
|
||||
};
|
||||
|
||||
static DIFlags getFlag(StringRef Flag);
|
||||
static const char *getFlagString(DIFlags Flag);
|
||||
// static const char *getFlagString(DIFlagsUnderlying Flag);
|
||||
static unsigned getFlag(StringRef Flag);
|
||||
static const char *getFlagString(unsigned Flag);
|
||||
|
||||
/// \brief Split up a flags bitfield.
|
||||
///
|
||||
/// Split \c Flags into \c SplitFlags, a vector of its components. Returns
|
||||
/// any remaining (unrecognized) bits.
|
||||
static DIFlags splitFlags(DIFlags Flags,
|
||||
SmallVectorImpl<DIFlags> &SplitFlags);
|
||||
static unsigned splitFlags(unsigned Flags,
|
||||
SmallVectorImpl<unsigned> &SplitFlags);
|
||||
|
||||
static bool classof(const Metadata *MD) {
|
||||
switch (MD->getMetadataID()) {
|
||||
@ -512,7 +508,7 @@ StringRef DIScope::getDirectory() const {
|
||||
/// TODO: Split up flags.
|
||||
class DIType : public DIScope {
|
||||
unsigned Line;
|
||||
DIFlags Flags;
|
||||
unsigned Flags;
|
||||
uint64_t SizeInBits;
|
||||
uint64_t AlignInBits;
|
||||
uint64_t OffsetInBits;
|
||||
@ -520,14 +516,14 @@ class DIType : public DIScope {
|
||||
protected:
|
||||
DIType(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag,
|
||||
unsigned Line, uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, DIFlags Flags, ArrayRef<Metadata *> Ops)
|
||||
uint64_t OffsetInBits, unsigned Flags, ArrayRef<Metadata *> Ops)
|
||||
: DIScope(C, ID, Storage, Tag, Ops) {
|
||||
init(Line, SizeInBits, AlignInBits, OffsetInBits, Flags);
|
||||
}
|
||||
~DIType() = default;
|
||||
|
||||
void init(unsigned Line, uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, DIFlags Flags) {
|
||||
uint64_t OffsetInBits, unsigned Flags) {
|
||||
this->Line = Line;
|
||||
this->Flags = Flags;
|
||||
this->SizeInBits = SizeInBits;
|
||||
@ -537,7 +533,7 @@ protected:
|
||||
|
||||
/// Change fields in place.
|
||||
void mutate(unsigned Tag, unsigned Line, uint64_t SizeInBits,
|
||||
uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags) {
|
||||
uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags) {
|
||||
assert(isDistinct() && "Only distinct nodes can mutate");
|
||||
setTag(Tag);
|
||||
init(Line, SizeInBits, AlignInBits, OffsetInBits, Flags);
|
||||
@ -552,7 +548,7 @@ public:
|
||||
uint64_t getSizeInBits() const { return SizeInBits; }
|
||||
uint64_t getAlignInBits() const { return AlignInBits; }
|
||||
uint64_t getOffsetInBits() const { return OffsetInBits; }
|
||||
DIFlags getFlags() const { return Flags; }
|
||||
unsigned getFlags() const { return Flags; }
|
||||
|
||||
DIScopeRef getScope() const { return DIScopeRef(getRawScope()); }
|
||||
StringRef getName() const { return getStringOperand(2); }
|
||||
@ -561,7 +557,7 @@ public:
|
||||
Metadata *getRawScope() const { return getOperand(1); }
|
||||
MDString *getRawName() const { return getOperandAs<MDString>(2); }
|
||||
|
||||
void setFlags(DIFlags NewFlags) {
|
||||
void setFlags(unsigned NewFlags) {
|
||||
assert(!isUniqued() && "Cannot set flags on uniqued nodes");
|
||||
Flags = NewFlags;
|
||||
}
|
||||
@ -618,7 +614,7 @@ class DIBasicType : public DIType {
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Encoding,
|
||||
ArrayRef<Metadata *> Ops)
|
||||
: DIType(C, DIBasicTypeKind, Storage, Tag, 0, SizeInBits, AlignInBits, 0,
|
||||
FlagZero, Ops),
|
||||
0, Ops),
|
||||
Encoding(Encoding) {}
|
||||
~DIBasicType() = default;
|
||||
|
||||
@ -672,7 +668,7 @@ class DIDerivedType : public DIType {
|
||||
|
||||
DIDerivedType(LLVMContext &C, StorageType Storage, unsigned Tag,
|
||||
unsigned Line, uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, DIFlags Flags, ArrayRef<Metadata *> Ops)
|
||||
uint64_t OffsetInBits, unsigned Flags, ArrayRef<Metadata *> Ops)
|
||||
: DIType(C, DIDerivedTypeKind, Storage, Tag, Line, SizeInBits,
|
||||
AlignInBits, OffsetInBits, Flags, Ops) {}
|
||||
~DIDerivedType() = default;
|
||||
@ -681,7 +677,7 @@ class DIDerivedType : public DIType {
|
||||
StringRef Name, DIFile *File, unsigned Line,
|
||||
DIScopeRef Scope, DITypeRef BaseType,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, DIFlags Flags,
|
||||
uint64_t OffsetInBits, unsigned Flags,
|
||||
Metadata *ExtraData, StorageType Storage,
|
||||
bool ShouldCreate = true) {
|
||||
return getImpl(Context, Tag, getCanonicalMDString(Context, Name), File,
|
||||
@ -692,7 +688,7 @@ class DIDerivedType : public DIType {
|
||||
MDString *Name, Metadata *File, unsigned Line,
|
||||
Metadata *Scope, Metadata *BaseType,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, DIFlags Flags,
|
||||
uint64_t OffsetInBits, unsigned Flags,
|
||||
Metadata *ExtraData, StorageType Storage,
|
||||
bool ShouldCreate = true);
|
||||
|
||||
@ -708,15 +704,15 @@ public:
|
||||
(unsigned Tag, MDString *Name, Metadata *File,
|
||||
unsigned Line, Metadata *Scope, Metadata *BaseType,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, DIFlags Flags,
|
||||
uint64_t OffsetInBits, unsigned Flags,
|
||||
Metadata *ExtraData = nullptr),
|
||||
(Tag, Name, File, Line, Scope, BaseType, SizeInBits,
|
||||
AlignInBits, OffsetInBits, Flags, ExtraData))
|
||||
DEFINE_MDNODE_GET(DIDerivedType,
|
||||
(unsigned Tag, StringRef Name, DIFile *File, unsigned Line,
|
||||
DIScopeRef Scope, DITypeRef BaseType, uint64_t SizeInBits,
|
||||
uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags,
|
||||
Metadata *ExtraData = nullptr),
|
||||
uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||
unsigned Flags, Metadata *ExtraData = nullptr),
|
||||
(Tag, Name, File, Line, Scope, BaseType, SizeInBits,
|
||||
AlignInBits, OffsetInBits, Flags, ExtraData))
|
||||
|
||||
@ -776,7 +772,7 @@ class DICompositeType : public DIType {
|
||||
|
||||
DICompositeType(LLVMContext &C, StorageType Storage, unsigned Tag,
|
||||
unsigned Line, unsigned RuntimeLang, uint64_t SizeInBits,
|
||||
uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags,
|
||||
uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
|
||||
ArrayRef<Metadata *> Ops)
|
||||
: DIType(C, DICompositeTypeKind, Storage, Tag, Line, SizeInBits,
|
||||
AlignInBits, OffsetInBits, Flags, Ops),
|
||||
@ -786,7 +782,7 @@ class DICompositeType : public DIType {
|
||||
/// Change fields in place.
|
||||
void mutate(unsigned Tag, unsigned Line, unsigned RuntimeLang,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||
DIFlags Flags) {
|
||||
unsigned Flags) {
|
||||
assert(isDistinct() && "Only distinct nodes can mutate");
|
||||
assert(getRawIdentifier() && "Only ODR-uniqued nodes should mutate");
|
||||
this->RuntimeLang = RuntimeLang;
|
||||
@ -797,7 +793,7 @@ class DICompositeType : public DIType {
|
||||
getImpl(LLVMContext &Context, unsigned Tag, StringRef Name, Metadata *File,
|
||||
unsigned Line, DIScopeRef Scope, DITypeRef BaseType,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||
DIFlags Flags, DINodeArray Elements, unsigned RuntimeLang,
|
||||
uint64_t Flags, DINodeArray Elements, unsigned RuntimeLang,
|
||||
DITypeRef VTableHolder, DITemplateParameterArray TemplateParams,
|
||||
StringRef Identifier, StorageType Storage, bool ShouldCreate = true) {
|
||||
return getImpl(
|
||||
@ -810,7 +806,7 @@ class DICompositeType : public DIType {
|
||||
getImpl(LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
|
||||
unsigned Line, Metadata *Scope, Metadata *BaseType,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||
DIFlags Flags, Metadata *Elements, unsigned RuntimeLang,
|
||||
unsigned Flags, Metadata *Elements, unsigned RuntimeLang,
|
||||
Metadata *VTableHolder, Metadata *TemplateParams,
|
||||
MDString *Identifier, StorageType Storage, bool ShouldCreate = true);
|
||||
|
||||
@ -826,8 +822,8 @@ public:
|
||||
DEFINE_MDNODE_GET(DICompositeType,
|
||||
(unsigned Tag, StringRef Name, DIFile *File, unsigned Line,
|
||||
DIScopeRef Scope, DITypeRef BaseType, uint64_t SizeInBits,
|
||||
uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags,
|
||||
DINodeArray Elements, unsigned RuntimeLang,
|
||||
uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||
unsigned Flags, DINodeArray Elements, unsigned RuntimeLang,
|
||||
DITypeRef VTableHolder,
|
||||
DITemplateParameterArray TemplateParams = nullptr,
|
||||
StringRef Identifier = ""),
|
||||
@ -838,7 +834,7 @@ public:
|
||||
(unsigned Tag, MDString *Name, Metadata *File,
|
||||
unsigned Line, Metadata *Scope, Metadata *BaseType,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, DIFlags Flags, Metadata *Elements,
|
||||
uint64_t OffsetInBits, unsigned Flags, Metadata *Elements,
|
||||
unsigned RuntimeLang, Metadata *VTableHolder,
|
||||
Metadata *TemplateParams = nullptr,
|
||||
MDString *Identifier = nullptr),
|
||||
@ -859,7 +855,7 @@ public:
|
||||
getODRType(LLVMContext &Context, MDString &Identifier, unsigned Tag,
|
||||
MDString *Name, Metadata *File, unsigned Line, Metadata *Scope,
|
||||
Metadata *BaseType, uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, DIFlags Flags, Metadata *Elements,
|
||||
uint64_t OffsetInBits, unsigned Flags, Metadata *Elements,
|
||||
unsigned RuntimeLang, Metadata *VTableHolder,
|
||||
Metadata *TemplateParams);
|
||||
static DICompositeType *getODRTypeIfExists(LLVMContext &Context,
|
||||
@ -878,7 +874,7 @@ public:
|
||||
buildODRType(LLVMContext &Context, MDString &Identifier, unsigned Tag,
|
||||
MDString *Name, Metadata *File, unsigned Line, Metadata *Scope,
|
||||
Metadata *BaseType, uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, DIFlags Flags, Metadata *Elements,
|
||||
uint64_t OffsetInBits, unsigned Flags, Metadata *Elements,
|
||||
unsigned RuntimeLang, Metadata *VTableHolder,
|
||||
Metadata *TemplateParams);
|
||||
|
||||
@ -937,20 +933,20 @@ class DISubroutineType : public DIType {
|
||||
/// type dwarf::CallingConvention.
|
||||
uint8_t CC;
|
||||
|
||||
DISubroutineType(LLVMContext &C, StorageType Storage, DIFlags Flags,
|
||||
DISubroutineType(LLVMContext &C, StorageType Storage, unsigned Flags,
|
||||
uint8_t CC, ArrayRef<Metadata *> Ops)
|
||||
: DIType(C, DISubroutineTypeKind, Storage, dwarf::DW_TAG_subroutine_type,
|
||||
0, 0, 0, 0, Flags, Ops),
|
||||
CC(CC) {}
|
||||
~DISubroutineType() = default;
|
||||
|
||||
static DISubroutineType *getImpl(LLVMContext &Context, DIFlags Flags,
|
||||
static DISubroutineType *getImpl(LLVMContext &Context, unsigned Flags,
|
||||
uint8_t CC, DITypeRefArray TypeArray,
|
||||
StorageType Storage,
|
||||
bool ShouldCreate = true) {
|
||||
return getImpl(Context, Flags, CC, TypeArray.get(), Storage, ShouldCreate);
|
||||
}
|
||||
static DISubroutineType *getImpl(LLVMContext &Context, DIFlags Flags,
|
||||
static DISubroutineType *getImpl(LLVMContext &Context, unsigned Flags,
|
||||
uint8_t CC, Metadata *TypeArray,
|
||||
StorageType Storage,
|
||||
bool ShouldCreate = true);
|
||||
@ -961,10 +957,10 @@ class DISubroutineType : public DIType {
|
||||
|
||||
public:
|
||||
DEFINE_MDNODE_GET(DISubroutineType,
|
||||
(DIFlags Flags, uint8_t CC, DITypeRefArray TypeArray),
|
||||
(unsigned Flags, uint8_t CC, DITypeRefArray TypeArray),
|
||||
(Flags, CC, TypeArray))
|
||||
DEFINE_MDNODE_GET(DISubroutineType,
|
||||
(DIFlags Flags, uint8_t CC, Metadata *TypeArray),
|
||||
(unsigned Flags, uint8_t CC, Metadata *TypeArray),
|
||||
(Flags, CC, TypeArray))
|
||||
|
||||
TempDISubroutineType clone() const { return cloneImpl(); }
|
||||
@ -1303,6 +1299,8 @@ class DISubprogram : public DILocalScope {
|
||||
// in 2 bits (none/pure/pure_virtual).
|
||||
unsigned Virtuality : 2;
|
||||
|
||||
unsigned Flags : 27;
|
||||
|
||||
// These are boolean flags so one bit is enough.
|
||||
// MSVC starts a new container field every time the base
|
||||
// type changes so we can't use 'bool' to ensure these bits
|
||||
@ -1311,22 +1309,19 @@ class DISubprogram : public DILocalScope {
|
||||
unsigned IsDefinition : 1;
|
||||
unsigned IsOptimized : 1;
|
||||
|
||||
unsigned Padding : 3;
|
||||
|
||||
DIFlags Flags;
|
||||
|
||||
DISubprogram(LLVMContext &C, StorageType Storage, unsigned Line,
|
||||
unsigned ScopeLine, unsigned Virtuality, unsigned VirtualIndex,
|
||||
int ThisAdjustment, DIFlags Flags, bool IsLocalToUnit,
|
||||
int ThisAdjustment, unsigned Flags, bool IsLocalToUnit,
|
||||
bool IsDefinition, bool IsOptimized, ArrayRef<Metadata *> Ops)
|
||||
: DILocalScope(C, DISubprogramKind, Storage, dwarf::DW_TAG_subprogram,
|
||||
Ops),
|
||||
Line(Line), ScopeLine(ScopeLine), VirtualIndex(VirtualIndex),
|
||||
ThisAdjustment(ThisAdjustment), Virtuality(Virtuality),
|
||||
ThisAdjustment(ThisAdjustment), Virtuality(Virtuality), Flags(Flags),
|
||||
IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition),
|
||||
IsOptimized(IsOptimized), Flags(Flags) {
|
||||
IsOptimized(IsOptimized) {
|
||||
static_assert(dwarf::DW_VIRTUALITY_max < 4, "Virtuality out of range");
|
||||
assert(Virtuality < 4 && "Virtuality out of range");
|
||||
assert((Flags < (1 << 27)) && "Flags out of range");
|
||||
}
|
||||
~DISubprogram() = default;
|
||||
|
||||
@ -1335,7 +1330,7 @@ class DISubprogram : public DILocalScope {
|
||||
StringRef LinkageName, DIFile *File, unsigned Line,
|
||||
DISubroutineType *Type, bool IsLocalToUnit, bool IsDefinition,
|
||||
unsigned ScopeLine, DITypeRef ContainingType, unsigned Virtuality,
|
||||
unsigned VirtualIndex, int ThisAdjustment, DIFlags Flags,
|
||||
unsigned VirtualIndex, int ThisAdjustment, unsigned Flags,
|
||||
bool IsOptimized, DICompileUnit *Unit,
|
||||
DITemplateParameterArray TemplateParams, DISubprogram *Declaration,
|
||||
DILocalVariableArray Variables, StorageType Storage,
|
||||
@ -1352,7 +1347,7 @@ class DISubprogram : public DILocalScope {
|
||||
MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
|
||||
bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
|
||||
Metadata *ContainingType, unsigned Virtuality, unsigned VirtualIndex,
|
||||
int ThisAdjustment, DIFlags Flags, bool IsOptimized, Metadata *Unit,
|
||||
int ThisAdjustment, unsigned Flags, bool IsOptimized, Metadata *Unit,
|
||||
Metadata *TemplateParams, Metadata *Declaration, Metadata *Variables,
|
||||
StorageType Storage, bool ShouldCreate = true);
|
||||
|
||||
@ -1371,7 +1366,7 @@ public:
|
||||
DIFile *File, unsigned Line, DISubroutineType *Type,
|
||||
bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
|
||||
DITypeRef ContainingType, unsigned Virtuality,
|
||||
unsigned VirtualIndex, int ThisAdjustment, DIFlags Flags,
|
||||
unsigned VirtualIndex, int ThisAdjustment, unsigned Flags,
|
||||
bool IsOptimized, DICompileUnit *Unit,
|
||||
DITemplateParameterArray TemplateParams = nullptr,
|
||||
DISubprogram *Declaration = nullptr,
|
||||
@ -1385,7 +1380,7 @@ public:
|
||||
(Metadata * Scope, MDString *Name, MDString *LinkageName, Metadata *File,
|
||||
unsigned Line, Metadata *Type, bool IsLocalToUnit, bool IsDefinition,
|
||||
unsigned ScopeLine, Metadata *ContainingType, unsigned Virtuality,
|
||||
unsigned VirtualIndex, int ThisAdjustment, DIFlags Flags,
|
||||
unsigned VirtualIndex, int ThisAdjustment, unsigned Flags,
|
||||
bool IsOptimized, Metadata *Unit, Metadata *TemplateParams = nullptr,
|
||||
Metadata *Declaration = nullptr, Metadata *Variables = nullptr),
|
||||
(Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition,
|
||||
@ -1400,12 +1395,12 @@ public:
|
||||
unsigned getVirtualIndex() const { return VirtualIndex; }
|
||||
int getThisAdjustment() const { return ThisAdjustment; }
|
||||
unsigned getScopeLine() const { return ScopeLine; }
|
||||
DIFlags getFlags() const { return Flags; }
|
||||
unsigned getFlags() const { return Flags; }
|
||||
bool isLocalToUnit() const { return IsLocalToUnit; }
|
||||
bool isDefinition() const { return IsDefinition; }
|
||||
bool isOptimized() const { return IsOptimized; }
|
||||
|
||||
bool isArtificial() const { return getFlags() & FlagArtificial; }
|
||||
unsigned isArtificial() const { return getFlags() & FlagArtificial; }
|
||||
bool isPrivate() const {
|
||||
return (getFlags() & FlagAccessibility) == FlagPrivate;
|
||||
}
|
||||
@ -1422,18 +1417,24 @@ public:
|
||||
///
|
||||
/// Return true if this subprogram is a C++11 reference-qualified non-static
|
||||
/// member function (void foo() &).
|
||||
bool isLValueReference() const { return getFlags() & FlagLValueReference; }
|
||||
unsigned isLValueReference() const {
|
||||
return getFlags() & FlagLValueReference;
|
||||
}
|
||||
|
||||
/// \brief Check if this is rvalue-reference-qualified.
|
||||
///
|
||||
/// Return true if this subprogram is a C++11 rvalue-reference-qualified
|
||||
/// non-static member function (void foo() &&).
|
||||
bool isRValueReference() const { return getFlags() & FlagRValueReference; }
|
||||
unsigned isRValueReference() const {
|
||||
return getFlags() & FlagRValueReference;
|
||||
}
|
||||
|
||||
/// \brief Check if this is marked as noreturn.
|
||||
///
|
||||
/// Return true if this subprogram is C++11 noreturn or C11 _Noreturn
|
||||
bool isNoReturn() const { return getFlags() & FlagNoReturn; }
|
||||
unsigned isNoReturn() const {
|
||||
return getFlags() & FlagNoReturn;
|
||||
}
|
||||
|
||||
DIScopeRef getScope() const { return DIScopeRef(getRawScope()); }
|
||||
|
||||
@ -1954,19 +1955,20 @@ class DILocalVariable : public DIVariable {
|
||||
friend class MDNode;
|
||||
|
||||
unsigned Arg : 16;
|
||||
DIFlags Flags;
|
||||
unsigned Flags : 16;
|
||||
|
||||
DILocalVariable(LLVMContext &C, StorageType Storage, unsigned Line,
|
||||
unsigned Arg, DIFlags Flags, ArrayRef<Metadata *> Ops)
|
||||
unsigned Arg, unsigned Flags, ArrayRef<Metadata *> Ops)
|
||||
: DIVariable(C, DILocalVariableKind, Storage, Line, Ops), Arg(Arg),
|
||||
Flags(Flags) {
|
||||
assert(Flags < (1 << 16) && "DILocalVariable: Flags out of range");
|
||||
assert(Arg < (1 << 16) && "DILocalVariable: Arg out of range");
|
||||
}
|
||||
~DILocalVariable() = default;
|
||||
|
||||
static DILocalVariable *getImpl(LLVMContext &Context, DIScope *Scope,
|
||||
StringRef Name, DIFile *File, unsigned Line,
|
||||
DITypeRef Type, unsigned Arg, DIFlags Flags,
|
||||
DITypeRef Type, unsigned Arg, unsigned Flags,
|
||||
StorageType Storage,
|
||||
bool ShouldCreate = true) {
|
||||
return getImpl(Context, Scope, getCanonicalMDString(Context, Name), File,
|
||||
@ -1974,7 +1976,7 @@ class DILocalVariable : public DIVariable {
|
||||
}
|
||||
static DILocalVariable *getImpl(LLVMContext &Context, Metadata *Scope,
|
||||
MDString *Name, Metadata *File, unsigned Line,
|
||||
Metadata *Type, unsigned Arg, DIFlags Flags,
|
||||
Metadata *Type, unsigned Arg, unsigned Flags,
|
||||
StorageType Storage,
|
||||
bool ShouldCreate = true);
|
||||
|
||||
@ -1987,12 +1989,12 @@ public:
|
||||
DEFINE_MDNODE_GET(DILocalVariable,
|
||||
(DILocalScope * Scope, StringRef Name, DIFile *File,
|
||||
unsigned Line, DITypeRef Type, unsigned Arg,
|
||||
DIFlags Flags),
|
||||
unsigned Flags),
|
||||
(Scope, Name, File, Line, Type, Arg, Flags))
|
||||
DEFINE_MDNODE_GET(DILocalVariable,
|
||||
(Metadata * Scope, MDString *Name, Metadata *File,
|
||||
unsigned Line, Metadata *Type, unsigned Arg,
|
||||
DIFlags Flags),
|
||||
unsigned Flags),
|
||||
(Scope, Name, File, Line, Type, Arg, Flags))
|
||||
|
||||
TempDILocalVariable clone() const { return cloneImpl(); }
|
||||
@ -2006,7 +2008,7 @@ public:
|
||||
|
||||
bool isParameter() const { return Arg; }
|
||||
unsigned getArg() const { return Arg; }
|
||||
DIFlags getFlags() const { return Flags; }
|
||||
unsigned getFlags() const { return Flags; }
|
||||
|
||||
bool isArtificial() const { return getFlags() & FlagArtificial; }
|
||||
bool isObjectPointer() const { return getFlags() & FlagObjectPointer; }
|
||||
|
@ -1271,7 +1271,7 @@ bool LLParser::ParseStringConstant(std::string &Result) {
|
||||
|
||||
/// ParseUInt32
|
||||
/// ::= uint32
|
||||
bool LLParser::ParseUInt32(uint32_t &Val) {
|
||||
bool LLParser::ParseUInt32(unsigned &Val) {
|
||||
if (Lex.getKind() != lltok::APSInt || Lex.getAPSIntVal().isSigned())
|
||||
return TokError("expected integer");
|
||||
uint64_t Val64 = Lex.getAPSIntVal().getLimitedValue(0xFFFFFFFFULL+1);
|
||||
@ -3407,8 +3407,8 @@ struct EmissionKindField : public MDUnsignedField {
|
||||
EmissionKindField() : MDUnsignedField(0, DICompileUnit::LastEmissionKind) {}
|
||||
};
|
||||
|
||||
struct DIFlagField : public MDFieldImpl<DINode::DIFlags> {
|
||||
DIFlagField() : MDFieldImpl(DINode::FlagZero) {}
|
||||
struct DIFlagField : public MDUnsignedField {
|
||||
DIFlagField() : MDUnsignedField(0, UINT32_MAX) {}
|
||||
};
|
||||
|
||||
struct MDSignedField : public MDFieldImpl<int64_t> {
|
||||
@ -3610,15 +3610,12 @@ bool LLParser::ParseMDField(LocTy Loc, StringRef Name,
|
||||
/// ::= DIFlagVector '|' DIFlagFwdDecl '|' uint32 '|' DIFlagPublic
|
||||
template <>
|
||||
bool LLParser::ParseMDField(LocTy Loc, StringRef Name, DIFlagField &Result) {
|
||||
assert(Result.Max == UINT32_MAX && "Expected only 32-bits");
|
||||
|
||||
// Parser for a single flag.
|
||||
auto parseFlag = [&](DINode::DIFlags &Val) {
|
||||
if (Lex.getKind() == lltok::APSInt && !Lex.getAPSIntVal().isSigned()) {
|
||||
uint32_t TempVal = static_cast<uint32_t>(Val);
|
||||
bool Res = ParseUInt32(TempVal);
|
||||
Val = static_cast<DINode::DIFlags>(TempVal);
|
||||
return Res;
|
||||
}
|
||||
auto parseFlag = [&](unsigned &Val) {
|
||||
if (Lex.getKind() == lltok::APSInt && !Lex.getAPSIntVal().isSigned())
|
||||
return ParseUInt32(Val);
|
||||
|
||||
if (Lex.getKind() != lltok::DIFlag)
|
||||
return TokError("expected debug info flag");
|
||||
@ -3632,9 +3629,9 @@ bool LLParser::ParseMDField(LocTy Loc, StringRef Name, DIFlagField &Result) {
|
||||
};
|
||||
|
||||
// Parse the flags and combine them together.
|
||||
DINode::DIFlags Combined = DINode::FlagZero;
|
||||
unsigned Combined = 0;
|
||||
do {
|
||||
DINode::DIFlags Val;
|
||||
unsigned Val;
|
||||
if (parseFlag(Val))
|
||||
return true;
|
||||
Combined |= Val;
|
||||
|
@ -2414,14 +2414,13 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
|
||||
return error("Invalid record");
|
||||
|
||||
IsDistinct = Record[0];
|
||||
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(Record[10]);
|
||||
MetadataList.assignValue(
|
||||
GET_OR_DISTINCT(DIDerivedType,
|
||||
(Context, Record[1], getMDString(Record[2]),
|
||||
getMDOrNull(Record[3]), Record[4],
|
||||
getDITypeRefOrNull(Record[5]),
|
||||
getDITypeRefOrNull(Record[6]), Record[7], Record[8],
|
||||
Record[9], Flags, getDITypeRefOrNull(Record[11]))),
|
||||
GET_OR_DISTINCT(
|
||||
DIDerivedType,
|
||||
(Context, Record[1], getMDString(Record[2]),
|
||||
getMDOrNull(Record[3]), Record[4], getDITypeRefOrNull(Record[5]),
|
||||
getDITypeRefOrNull(Record[6]), Record[7], Record[8], Record[9],
|
||||
Record[10], getDITypeRefOrNull(Record[11]))),
|
||||
NextMetadataNo++);
|
||||
break;
|
||||
}
|
||||
@ -2442,7 +2441,7 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
|
||||
uint64_t SizeInBits = Record[7];
|
||||
uint64_t AlignInBits = Record[8];
|
||||
uint64_t OffsetInBits = Record[9];
|
||||
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(Record[10]);
|
||||
unsigned Flags = Record[10];
|
||||
Metadata *Elements = getMDOrNull(Record[11]);
|
||||
unsigned RuntimeLang = Record[12];
|
||||
Metadata *VTableHolder = getDITypeRefOrNull(Record[13]);
|
||||
@ -2475,13 +2474,12 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
|
||||
unsigned CC = (Record.size() > 3) ? Record[3] : 0;
|
||||
|
||||
IsDistinct = Record[0] & 0x1;
|
||||
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(Record[1]);
|
||||
Metadata *Types = getMDOrNull(Record[2]);
|
||||
if (LLVM_UNLIKELY(IsOldTypeRefArray))
|
||||
Types = MetadataList.upgradeTypeRefArray(Types);
|
||||
|
||||
MetadataList.assignValue(
|
||||
GET_OR_DISTINCT(DISubroutineType, (Context, Flags, CC, Types)),
|
||||
GET_OR_DISTINCT(DISubroutineType, (Context, Record[1], CC, Types)),
|
||||
NextMetadataNo++);
|
||||
break;
|
||||
}
|
||||
@ -2553,21 +2551,20 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
|
||||
bool HasThisAdj = Record.size() >= 20;
|
||||
DISubprogram *SP = GET_OR_DISTINCT(
|
||||
DISubprogram, (Context,
|
||||
getDITypeRefOrNull(Record[1]), // scope
|
||||
getMDString(Record[2]), // name
|
||||
getMDString(Record[3]), // linkageName
|
||||
getMDOrNull(Record[4]), // file
|
||||
Record[5], // line
|
||||
getMDOrNull(Record[6]), // type
|
||||
Record[7], // isLocal
|
||||
Record[8], // isDefinition
|
||||
Record[9], // scopeLine
|
||||
getDITypeRefOrNull(Record[10]), // containingType
|
||||
Record[11], // virtuality
|
||||
Record[12], // virtualIndex
|
||||
HasThisAdj ? Record[19] : 0, // thisAdjustment
|
||||
static_cast<DINode::DIFlags>(Record[13] // flags
|
||||
),
|
||||
getDITypeRefOrNull(Record[1]), // scope
|
||||
getMDString(Record[2]), // name
|
||||
getMDString(Record[3]), // linkageName
|
||||
getMDOrNull(Record[4]), // file
|
||||
Record[5], // line
|
||||
getMDOrNull(Record[6]), // type
|
||||
Record[7], // isLocal
|
||||
Record[8], // isDefinition
|
||||
Record[9], // scopeLine
|
||||
getDITypeRefOrNull(Record[10]), // containingType
|
||||
Record[11], // virtuality
|
||||
Record[12], // virtualIndex
|
||||
HasThisAdj ? Record[19] : 0, // thisAdjustment
|
||||
Record[13], // flags
|
||||
Record[14], // isOptimized
|
||||
HasUnit ? CUorFn : nullptr, // unit
|
||||
getMDOrNull(Record[15 + Offset]), // templateParams
|
||||
@ -2698,14 +2695,13 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
|
||||
// DW_TAG_arg_variable.
|
||||
IsDistinct = Record[0];
|
||||
bool HasTag = Record.size() > 8;
|
||||
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(Record[7 + HasTag]);
|
||||
MetadataList.assignValue(
|
||||
GET_OR_DISTINCT(DILocalVariable,
|
||||
(Context, getMDOrNull(Record[1 + HasTag]),
|
||||
getMDString(Record[2 + HasTag]),
|
||||
getMDOrNull(Record[3 + HasTag]), Record[4 + HasTag],
|
||||
getDITypeRefOrNull(Record[5 + HasTag]),
|
||||
Record[6 + HasTag], Flags)),
|
||||
Record[6 + HasTag], Record[7 + HasTag])),
|
||||
NextMetadataNo++);
|
||||
break;
|
||||
}
|
||||
|
@ -1408,7 +1408,7 @@ struct MDFieldPrinter {
|
||||
template <class IntTy>
|
||||
void printInt(StringRef Name, IntTy Int, bool ShouldSkipZero = true);
|
||||
void printBool(StringRef Name, bool Value, Optional<bool> Default = None);
|
||||
void printDIFlags(StringRef Name, DINode::DIFlags Flags);
|
||||
void printDIFlags(StringRef Name, unsigned Flags);
|
||||
template <class IntTy, class Stringifier>
|
||||
void printDwarfEnum(StringRef Name, IntTy Value, Stringifier toString,
|
||||
bool ShouldSkipZero = true);
|
||||
@ -1477,17 +1477,17 @@ void MDFieldPrinter::printBool(StringRef Name, bool Value,
|
||||
Out << FS << Name << ": " << (Value ? "true" : "false");
|
||||
}
|
||||
|
||||
void MDFieldPrinter::printDIFlags(StringRef Name, DINode::DIFlags Flags) {
|
||||
void MDFieldPrinter::printDIFlags(StringRef Name, unsigned Flags) {
|
||||
if (!Flags)
|
||||
return;
|
||||
|
||||
Out << FS << Name << ": ";
|
||||
|
||||
SmallVector<DINode::DIFlags, 8> SplitFlags;
|
||||
auto Extra = DINode::splitFlags(Flags, SplitFlags);
|
||||
SmallVector<unsigned, 8> SplitFlags;
|
||||
unsigned Extra = DINode::splitFlags(Flags, SplitFlags);
|
||||
|
||||
FieldSeparator FlagsFS(" | ");
|
||||
for (auto F : SplitFlags) {
|
||||
for (unsigned F : SplitFlags) {
|
||||
const char *StringF = DINode::getFlagString(F);
|
||||
assert(StringF && "Expected valid flag");
|
||||
Out << FlagsFS << StringF;
|
||||
|
@ -204,7 +204,7 @@ DIBasicType *DIBuilder::createBasicType(StringRef Name, uint64_t SizeInBits,
|
||||
|
||||
DIDerivedType *DIBuilder::createQualifiedType(unsigned Tag, DIType *FromTy) {
|
||||
return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, FromTy, 0,
|
||||
0, 0, DINode::FlagZero);
|
||||
0, 0, 0);
|
||||
}
|
||||
|
||||
DIDerivedType *DIBuilder::createPointerType(DIType *PointeeTy,
|
||||
@ -214,14 +214,14 @@ DIDerivedType *DIBuilder::createPointerType(DIType *PointeeTy,
|
||||
// FIXME: Why is there a name here?
|
||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_pointer_type, Name,
|
||||
nullptr, 0, nullptr, PointeeTy, SizeInBits,
|
||||
AlignInBits, 0, DINode::FlagZero);
|
||||
AlignInBits, 0, 0);
|
||||
}
|
||||
|
||||
DIDerivedType *DIBuilder::createMemberPointerType(DIType *PointeeTy,
|
||||
DIType *Base,
|
||||
uint64_t SizeInBits,
|
||||
uint64_t AlignInBits,
|
||||
DINode::DIFlags Flags) {
|
||||
unsigned Flags) {
|
||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_ptr_to_member_type, "",
|
||||
nullptr, 0, nullptr, PointeeTy, SizeInBits,
|
||||
AlignInBits, 0, Flags, Base);
|
||||
@ -232,7 +232,7 @@ DIDerivedType *DIBuilder::createReferenceType(unsigned Tag, DIType *RTy,
|
||||
uint64_t AlignInBits) {
|
||||
assert(RTy && "Unable to create reference type");
|
||||
return DIDerivedType::get(VMContext, Tag, "", nullptr, 0, nullptr, RTy,
|
||||
SizeInBits, AlignInBits, 0, DINode::FlagZero);
|
||||
SizeInBits, AlignInBits, 0, 0);
|
||||
}
|
||||
|
||||
DIDerivedType *DIBuilder::createTypedef(DIType *Ty, StringRef Name,
|
||||
@ -240,19 +240,19 @@ DIDerivedType *DIBuilder::createTypedef(DIType *Ty, StringRef Name,
|
||||
DIScope *Context) {
|
||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_typedef, Name, File,
|
||||
LineNo, getNonCompileUnitScope(Context), Ty, 0, 0,
|
||||
0, DINode::FlagZero);
|
||||
0, 0);
|
||||
}
|
||||
|
||||
DIDerivedType *DIBuilder::createFriend(DIType *Ty, DIType *FriendTy) {
|
||||
assert(Ty && "Invalid type!");
|
||||
assert(FriendTy && "Invalid friend type!");
|
||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_friend, "", nullptr, 0, Ty,
|
||||
FriendTy, 0, 0, 0, DINode::FlagZero);
|
||||
FriendTy, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
DIDerivedType *DIBuilder::createInheritance(DIType *Ty, DIType *BaseTy,
|
||||
uint64_t BaseOffset,
|
||||
DINode::DIFlags Flags) {
|
||||
unsigned Flags) {
|
||||
assert(Ty && "Unable to create inheritance");
|
||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_inheritance, "", nullptr,
|
||||
0, Ty, BaseTy, 0, 0, BaseOffset, Flags);
|
||||
@ -263,7 +263,7 @@ DIDerivedType *DIBuilder::createMemberType(DIScope *Scope, StringRef Name,
|
||||
uint64_t SizeInBits,
|
||||
uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits,
|
||||
DINode::DIFlags Flags, DIType *Ty) {
|
||||
unsigned Flags, DIType *Ty) {
|
||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
|
||||
LineNumber, getNonCompileUnitScope(Scope), Ty,
|
||||
SizeInBits, AlignInBits, OffsetInBits, Flags);
|
||||
@ -278,7 +278,7 @@ static ConstantAsMetadata *getConstantOrNull(Constant *C) {
|
||||
DIDerivedType *DIBuilder::createBitFieldMemberType(
|
||||
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||
uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty) {
|
||||
uint64_t StorageOffsetInBits, unsigned Flags, DIType *Ty) {
|
||||
Flags |= DINode::FlagBitField;
|
||||
return DIDerivedType::get(
|
||||
VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
|
||||
@ -287,21 +287,23 @@ DIDerivedType *DIBuilder::createBitFieldMemberType(
|
||||
IntegerType::get(VMContext, 64), StorageOffsetInBits)));
|
||||
}
|
||||
|
||||
DIDerivedType *
|
||||
DIBuilder::createStaticMemberType(DIScope *Scope, StringRef Name, DIFile *File,
|
||||
unsigned LineNumber, DIType *Ty,
|
||||
DINode::DIFlags Flags, llvm::Constant *Val) {
|
||||
DIDerivedType *DIBuilder::createStaticMemberType(DIScope *Scope, StringRef Name,
|
||||
DIFile *File,
|
||||
unsigned LineNumber,
|
||||
DIType *Ty, unsigned Flags,
|
||||
llvm::Constant *Val) {
|
||||
Flags |= DINode::FlagStaticMember;
|
||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
|
||||
LineNumber, getNonCompileUnitScope(Scope), Ty, 0, 0,
|
||||
0, Flags, getConstantOrNull(Val));
|
||||
}
|
||||
|
||||
DIDerivedType *
|
||||
DIBuilder::createObjCIVar(StringRef Name, DIFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, DINode::DIFlags Flags,
|
||||
DIType *Ty, MDNode *PropertyNode) {
|
||||
DIDerivedType *DIBuilder::createObjCIVar(StringRef Name, DIFile *File,
|
||||
unsigned LineNumber,
|
||||
uint64_t SizeInBits,
|
||||
uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, unsigned Flags,
|
||||
DIType *Ty, MDNode *PropertyNode) {
|
||||
return DIDerivedType::get(VMContext, dwarf::DW_TAG_member, Name, File,
|
||||
LineNumber, getNonCompileUnitScope(File), Ty,
|
||||
SizeInBits, AlignInBits, OffsetInBits, Flags,
|
||||
@ -358,7 +360,7 @@ DIBuilder::createTemplateParameterPack(DIScope *Context, StringRef Name,
|
||||
DICompositeType *DIBuilder::createClassType(
|
||||
DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||
DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements,
|
||||
unsigned Flags, DIType *DerivedFrom, DINodeArray Elements,
|
||||
DIType *VTableHolder, MDNode *TemplateParams, StringRef UniqueIdentifier) {
|
||||
assert((!Context || isa<DIScope>(Context)) &&
|
||||
"createClassType should be called with a valid Context");
|
||||
@ -374,7 +376,7 @@ DICompositeType *DIBuilder::createClassType(
|
||||
|
||||
DICompositeType *DIBuilder::createStructType(
|
||||
DIScope *Context, StringRef Name, DIFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, DINode::DIFlags Flags,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
|
||||
DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang,
|
||||
DIType *VTableHolder, StringRef UniqueIdentifier) {
|
||||
auto *R = DICompositeType::get(
|
||||
@ -387,7 +389,7 @@ DICompositeType *DIBuilder::createStructType(
|
||||
|
||||
DICompositeType *DIBuilder::createUnionType(
|
||||
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, DINode::DIFlags Flags,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, unsigned Flags,
|
||||
DINodeArray Elements, unsigned RunTimeLang, StringRef UniqueIdentifier) {
|
||||
auto *R = DICompositeType::get(
|
||||
VMContext, dwarf::DW_TAG_union_type, Name, File, LineNumber,
|
||||
@ -398,8 +400,7 @@ DICompositeType *DIBuilder::createUnionType(
|
||||
}
|
||||
|
||||
DISubroutineType *DIBuilder::createSubroutineType(DITypeRefArray ParameterTypes,
|
||||
DINode::DIFlags Flags,
|
||||
unsigned CC) {
|
||||
unsigned Flags, unsigned CC) {
|
||||
return DISubroutineType::get(VMContext, Flags, CC, ParameterTypes);
|
||||
}
|
||||
|
||||
@ -418,7 +419,7 @@ DICompositeType *DIBuilder::createEnumerationType(
|
||||
auto *CTy = DICompositeType::get(
|
||||
VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber,
|
||||
getNonCompileUnitScope(Scope), UnderlyingType, SizeInBits, AlignInBits, 0,
|
||||
DINode::FlagZero, Elements, 0, nullptr, nullptr, UniqueIdentifier);
|
||||
0, Elements, 0, nullptr, nullptr, UniqueIdentifier);
|
||||
AllEnumTypes.push_back(CTy);
|
||||
trackIfUnresolved(CTy);
|
||||
return CTy;
|
||||
@ -429,7 +430,7 @@ DICompositeType *DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits,
|
||||
DINodeArray Subscripts) {
|
||||
auto *R = DICompositeType::get(VMContext, dwarf::DW_TAG_array_type, "",
|
||||
nullptr, 0, nullptr, Ty, Size, AlignInBits, 0,
|
||||
DINode::FlagZero, Subscripts, 0, nullptr);
|
||||
0, Subscripts, 0, nullptr);
|
||||
trackIfUnresolved(R);
|
||||
return R;
|
||||
}
|
||||
@ -445,7 +446,7 @@ DICompositeType *DIBuilder::createVectorType(uint64_t Size,
|
||||
}
|
||||
|
||||
static DIType *createTypeWithFlags(LLVMContext &Context, DIType *Ty,
|
||||
DINode::DIFlags FlagsToSet) {
|
||||
unsigned FlagsToSet) {
|
||||
auto NewTy = Ty->clone();
|
||||
NewTy->setFlags(NewTy->getFlags() | FlagsToSet);
|
||||
return MDNode::replaceWithUniqued(std::move(NewTy));
|
||||
@ -462,7 +463,7 @@ DIType *DIBuilder::createObjectPointerType(DIType *Ty) {
|
||||
// FIXME: Restrict this to the nodes where it's valid.
|
||||
if (Ty->isObjectPointer())
|
||||
return Ty;
|
||||
DINode::DIFlags Flags = DINode::FlagObjectPointer | DINode::FlagArtificial;
|
||||
unsigned Flags = DINode::FlagObjectPointer | DINode::FlagArtificial;
|
||||
return createTypeWithFlags(VMContext, Ty, Flags);
|
||||
}
|
||||
|
||||
@ -494,7 +495,7 @@ DIBuilder::createForwardDecl(unsigned Tag, StringRef Name, DIScope *Scope,
|
||||
DICompositeType *DIBuilder::createReplaceableCompositeType(
|
||||
unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
|
||||
unsigned RuntimeLang, uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
DINode::DIFlags Flags, StringRef UniqueIdentifier) {
|
||||
unsigned Flags, StringRef UniqueIdentifier) {
|
||||
auto *RetTy =
|
||||
DICompositeType::getTemporary(
|
||||
VMContext, Tag, Name, F, Line, getNonCompileUnitScope(Scope), nullptr,
|
||||
@ -564,7 +565,7 @@ static DILocalVariable *createLocalVariable(
|
||||
LLVMContext &VMContext,
|
||||
DenseMap<MDNode *, SmallVector<TrackingMDNodeRef, 1>> &PreservedVariables,
|
||||
DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
|
||||
unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags) {
|
||||
unsigned LineNo, DIType *Ty, bool AlwaysPreserve, unsigned Flags) {
|
||||
// FIXME: Why getNonCompileUnitScope()?
|
||||
// FIXME: Why is "!Context" okay here?
|
||||
// FIXME: Why doesn't this check for a subprogram or lexical block (AFAICT
|
||||
@ -588,7 +589,7 @@ static DILocalVariable *createLocalVariable(
|
||||
DILocalVariable *DIBuilder::createAutoVariable(DIScope *Scope, StringRef Name,
|
||||
DIFile *File, unsigned LineNo,
|
||||
DIType *Ty, bool AlwaysPreserve,
|
||||
DINode::DIFlags Flags) {
|
||||
unsigned Flags) {
|
||||
return createLocalVariable(VMContext, PreservedVariables, Scope, Name,
|
||||
/* ArgNo */ 0, File, LineNo, Ty, AlwaysPreserve,
|
||||
Flags);
|
||||
@ -596,7 +597,7 @@ DILocalVariable *DIBuilder::createAutoVariable(DIScope *Scope, StringRef Name,
|
||||
|
||||
DILocalVariable *DIBuilder::createParameterVariable(
|
||||
DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File,
|
||||
unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags) {
|
||||
unsigned LineNo, DIType *Ty, bool AlwaysPreserve, unsigned Flags) {
|
||||
assert(ArgNo && "Expected non-zero argument number for parameter");
|
||||
return createLocalVariable(VMContext, PreservedVariables, Scope, Name, ArgNo,
|
||||
File, LineNo, Ty, AlwaysPreserve, Flags);
|
||||
@ -628,8 +629,8 @@ static DISubprogram *getSubprogram(bool IsDistinct, Ts &&... Args) {
|
||||
DISubprogram *DIBuilder::createFunction(
|
||||
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
|
||||
unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
|
||||
bool isDefinition, unsigned ScopeLine, DINode::DIFlags Flags,
|
||||
bool isOptimized, DITemplateParameterArray TParams, DISubprogram *Decl) {
|
||||
bool isDefinition, unsigned ScopeLine, unsigned Flags, bool isOptimized,
|
||||
DITemplateParameterArray TParams, DISubprogram *Decl) {
|
||||
auto *Node = getSubprogram(
|
||||
/* IsDistinct = */ isDefinition, VMContext,
|
||||
getNonCompileUnitScope(Context), Name, LinkageName, File, LineNo, Ty,
|
||||
@ -646,8 +647,8 @@ DISubprogram *DIBuilder::createFunction(
|
||||
DISubprogram *DIBuilder::createTempFunctionFwdDecl(
|
||||
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
|
||||
unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit,
|
||||
bool isDefinition, unsigned ScopeLine, DINode::DIFlags Flags,
|
||||
bool isOptimized, DITemplateParameterArray TParams, DISubprogram *Decl) {
|
||||
bool isDefinition, unsigned ScopeLine, unsigned Flags, bool isOptimized,
|
||||
DITemplateParameterArray TParams, DISubprogram *Decl) {
|
||||
return DISubprogram::getTemporary(
|
||||
VMContext, getNonCompileUnitScope(Context), Name, LinkageName,
|
||||
File, LineNo, Ty, isLocalToUnit, isDefinition, ScopeLine, nullptr,
|
||||
@ -656,14 +657,13 @@ DISubprogram *DIBuilder::createTempFunctionFwdDecl(
|
||||
.release();
|
||||
}
|
||||
|
||||
DISubprogram *DIBuilder::createMethod(DIScope *Context, StringRef Name,
|
||||
StringRef LinkageName, DIFile *F,
|
||||
unsigned LineNo, DISubroutineType *Ty,
|
||||
bool isLocalToUnit, bool isDefinition,
|
||||
unsigned VK, unsigned VIndex,
|
||||
int ThisAdjustment, DIType *VTableHolder,
|
||||
DINode::DIFlags Flags, bool isOptimized,
|
||||
DITemplateParameterArray TParams) {
|
||||
DISubprogram *
|
||||
DIBuilder::createMethod(DIScope *Context, StringRef Name, StringRef LinkageName,
|
||||
DIFile *F, unsigned LineNo, DISubroutineType *Ty,
|
||||
bool isLocalToUnit, bool isDefinition, unsigned VK,
|
||||
unsigned VIndex, int ThisAdjustment,
|
||||
DIType *VTableHolder, unsigned Flags, bool isOptimized,
|
||||
DITemplateParameterArray TParams) {
|
||||
assert(getNonCompileUnitScope(Context) &&
|
||||
"Methods should have both a Context and a context that isn't "
|
||||
"the compile unit.");
|
||||
|
@ -65,15 +65,17 @@ DILocation *DILocation::getImpl(LLVMContext &Context, unsigned Line,
|
||||
Storage, Context.pImpl->DILocations);
|
||||
}
|
||||
|
||||
DINode::DIFlags DINode::getFlag(StringRef Flag) {
|
||||
return StringSwitch<DIFlags>(Flag)
|
||||
unsigned DINode::getFlag(StringRef Flag) {
|
||||
return StringSwitch<unsigned>(Flag)
|
||||
#define HANDLE_DI_FLAG(ID, NAME) .Case("DIFlag" #NAME, Flag##NAME)
|
||||
#include "llvm/IR/DebugInfoFlags.def"
|
||||
.Default(DINode::FlagZero);
|
||||
.Default(0);
|
||||
}
|
||||
|
||||
const char *DINode::getFlagString(DIFlags Flag) {
|
||||
const char *DINode::getFlagString(unsigned Flag) {
|
||||
switch (Flag) {
|
||||
default:
|
||||
return "";
|
||||
#define HANDLE_DI_FLAG(ID, NAME) \
|
||||
case Flag##NAME: \
|
||||
return "DIFlag" #NAME;
|
||||
@ -81,11 +83,11 @@ const char *DINode::getFlagString(DIFlags Flag) {
|
||||
}
|
||||
}
|
||||
|
||||
DINode::DIFlags DINode::splitFlags(DIFlags Flags,
|
||||
SmallVectorImpl<DIFlags> &SplitFlags) {
|
||||
unsigned DINode::splitFlags(unsigned Flags,
|
||||
SmallVectorImpl<unsigned> &SplitFlags) {
|
||||
// Accessibility and member pointer flags need to be specially handled, since
|
||||
// they're packed together.
|
||||
if (DIFlags A = Flags & FlagAccessibility) {
|
||||
if (unsigned A = Flags & FlagAccessibility) {
|
||||
if (A == FlagPrivate)
|
||||
SplitFlags.push_back(FlagPrivate);
|
||||
else if (A == FlagProtected)
|
||||
@ -94,7 +96,7 @@ DINode::DIFlags DINode::splitFlags(DIFlags Flags,
|
||||
SplitFlags.push_back(FlagPublic);
|
||||
Flags &= ~A;
|
||||
}
|
||||
if (DIFlags R = Flags & FlagPtrToMemberRep) {
|
||||
if (unsigned R = Flags & FlagPtrToMemberRep) {
|
||||
if (R == FlagSingleInheritance)
|
||||
SplitFlags.push_back(FlagSingleInheritance);
|
||||
else if (R == FlagMultipleInheritance)
|
||||
@ -105,11 +107,12 @@ DINode::DIFlags DINode::splitFlags(DIFlags Flags,
|
||||
}
|
||||
|
||||
#define HANDLE_DI_FLAG(ID, NAME) \
|
||||
if (DIFlags Bit = Flags & Flag##NAME) { \
|
||||
if (unsigned Bit = Flags & ID) { \
|
||||
SplitFlags.push_back(Bit); \
|
||||
Flags &= ~Bit; \
|
||||
}
|
||||
#include "llvm/IR/DebugInfoFlags.def"
|
||||
|
||||
return Flags;
|
||||
}
|
||||
|
||||
@ -239,7 +242,7 @@ DIBasicType *DIBasicType::getImpl(LLVMContext &Context, unsigned Tag,
|
||||
DIDerivedType *DIDerivedType::getImpl(
|
||||
LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
|
||||
unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
|
||||
uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags,
|
||||
uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
|
||||
Metadata *ExtraData, StorageType Storage, bool ShouldCreate) {
|
||||
assert(isCanonical(Name) && "Expected canonical MDString");
|
||||
DEFINE_GETIMPL_LOOKUP(DIDerivedType,
|
||||
@ -254,7 +257,7 @@ DIDerivedType *DIDerivedType::getImpl(
|
||||
DICompositeType *DICompositeType::getImpl(
|
||||
LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
|
||||
unsigned Line, Metadata *Scope, Metadata *BaseType, uint64_t SizeInBits,
|
||||
uint64_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags,
|
||||
uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags,
|
||||
Metadata *Elements, unsigned RuntimeLang, Metadata *VTableHolder,
|
||||
Metadata *TemplateParams, MDString *Identifier, StorageType Storage,
|
||||
bool ShouldCreate) {
|
||||
@ -276,7 +279,7 @@ DICompositeType *DICompositeType::buildODRType(
|
||||
LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name,
|
||||
Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||
DIFlags Flags, Metadata *Elements, unsigned RuntimeLang,
|
||||
unsigned Flags, Metadata *Elements, unsigned RuntimeLang,
|
||||
Metadata *VTableHolder, Metadata *TemplateParams) {
|
||||
assert(!Identifier.getString().empty() && "Expected valid identifier");
|
||||
if (!Context.isODRUniquingDebugTypes())
|
||||
@ -310,7 +313,7 @@ DICompositeType *DICompositeType::getODRType(
|
||||
LLVMContext &Context, MDString &Identifier, unsigned Tag, MDString *Name,
|
||||
Metadata *File, unsigned Line, Metadata *Scope, Metadata *BaseType,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits, uint64_t OffsetInBits,
|
||||
DIFlags Flags, Metadata *Elements, unsigned RuntimeLang,
|
||||
unsigned Flags, Metadata *Elements, unsigned RuntimeLang,
|
||||
Metadata *VTableHolder, Metadata *TemplateParams) {
|
||||
assert(!Identifier.getString().empty() && "Expected valid identifier");
|
||||
if (!Context.isODRUniquingDebugTypes())
|
||||
@ -332,8 +335,9 @@ DICompositeType *DICompositeType::getODRTypeIfExists(LLVMContext &Context,
|
||||
return Context.pImpl->DITypeMap->lookup(&Identifier);
|
||||
}
|
||||
|
||||
DISubroutineType *DISubroutineType::getImpl(LLVMContext &Context, DIFlags Flags,
|
||||
uint8_t CC, Metadata *TypeArray,
|
||||
DISubroutineType *DISubroutineType::getImpl(LLVMContext &Context,
|
||||
unsigned Flags, uint8_t CC,
|
||||
Metadata *TypeArray,
|
||||
StorageType Storage,
|
||||
bool ShouldCreate) {
|
||||
DEFINE_GETIMPL_LOOKUP(DISubroutineType, (Flags, CC, TypeArray));
|
||||
@ -410,7 +414,7 @@ DISubprogram *DISubprogram::getImpl(
|
||||
MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
|
||||
bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine,
|
||||
Metadata *ContainingType, unsigned Virtuality, unsigned VirtualIndex,
|
||||
int ThisAdjustment, DIFlags Flags, bool IsOptimized, Metadata *Unit,
|
||||
int ThisAdjustment, unsigned Flags, bool IsOptimized, Metadata *Unit,
|
||||
Metadata *TemplateParams, Metadata *Declaration, Metadata *Variables,
|
||||
StorageType Storage, bool ShouldCreate) {
|
||||
assert(isCanonical(Name) && "Expected canonical MDString");
|
||||
@ -525,7 +529,7 @@ DIGlobalVariable::getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
|
||||
DILocalVariable *DILocalVariable::getImpl(LLVMContext &Context, Metadata *Scope,
|
||||
MDString *Name, Metadata *File,
|
||||
unsigned Line, Metadata *Type,
|
||||
unsigned Arg, DIFlags Flags,
|
||||
unsigned Arg, unsigned Flags,
|
||||
StorageType Storage,
|
||||
bool ShouldCreate) {
|
||||
// 64K ought to be enough for any frontend.
|
||||
|
@ -55,28 +55,27 @@ TEST(DINodeTest, getFlagString) {
|
||||
DINode::getFlagString(DINode::FlagPublic | DINode::FlagVector));
|
||||
EXPECT_EQ(StringRef(), DINode::getFlagString(DINode::FlagFwdDecl |
|
||||
DINode::FlagArtificial));
|
||||
EXPECT_EQ(StringRef(),
|
||||
DINode::getFlagString(static_cast<DINode::DIFlags>(0xffff)));
|
||||
EXPECT_EQ(StringRef(), DINode::getFlagString(0xffff));
|
||||
}
|
||||
|
||||
TEST(DINodeTest, splitFlags) {
|
||||
// Some valid flags.
|
||||
#define CHECK_SPLIT(FLAGS, VECTOR, REMAINDER) \
|
||||
{ \
|
||||
SmallVector<DINode::DIFlags, 8> V; \
|
||||
SmallVector<unsigned, 8> V; \
|
||||
EXPECT_EQ(REMAINDER, DINode::splitFlags(FLAGS, V)); \
|
||||
EXPECT_TRUE(makeArrayRef(V).equals(VECTOR)); \
|
||||
}
|
||||
CHECK_SPLIT(DINode::FlagPublic, {DINode::FlagPublic}, DINode::FlagZero);
|
||||
CHECK_SPLIT(DINode::FlagProtected, {DINode::FlagProtected}, DINode::FlagZero);
|
||||
CHECK_SPLIT(DINode::FlagPrivate, {DINode::FlagPrivate}, DINode::FlagZero);
|
||||
CHECK_SPLIT(DINode::FlagVector, {DINode::FlagVector}, DINode::FlagZero);
|
||||
CHECK_SPLIT(DINode::FlagRValueReference, {DINode::FlagRValueReference},
|
||||
DINode::FlagZero);
|
||||
DINode::DIFlags Flags[] = {DINode::FlagFwdDecl, DINode::FlagVector};
|
||||
CHECK_SPLIT(DINode::FlagFwdDecl | DINode::FlagVector, Flags,
|
||||
DINode::FlagZero);
|
||||
CHECK_SPLIT(DINode::FlagZero, {}, DINode::FlagZero);
|
||||
CHECK_SPLIT(DINode::FlagPublic, {DINode::FlagPublic}, 0u);
|
||||
CHECK_SPLIT(DINode::FlagProtected, {DINode::FlagProtected}, 0u);
|
||||
CHECK_SPLIT(DINode::FlagPrivate, {DINode::FlagPrivate}, 0u);
|
||||
CHECK_SPLIT(DINode::FlagVector, {DINode::FlagVector}, 0u);
|
||||
CHECK_SPLIT(DINode::FlagRValueReference, {DINode::FlagRValueReference}, 0u);
|
||||
unsigned Flags[] = {DINode::FlagFwdDecl, DINode::FlagVector};
|
||||
CHECK_SPLIT(DINode::FlagFwdDecl | DINode::FlagVector, Flags, 0u);
|
||||
CHECK_SPLIT(0x200000u, {}, 0x200000u);
|
||||
CHECK_SPLIT(0x200000u | DINode::FlagVector, {DINode::FlagVector}, 0x200000u);
|
||||
CHECK_SPLIT(0x200000u | DINode::FlagNoReturn, {DINode::FlagNoReturn}, 0x200000u);
|
||||
#undef CHECK_SPLIT
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ TEST(DebugTypeODRUniquingTest, getODRType) {
|
||||
// Without a type map, this should return null.
|
||||
EXPECT_FALSE(DICompositeType::getODRType(
|
||||
Context, UUID, dwarf::DW_TAG_class_type, nullptr, nullptr, 0, nullptr,
|
||||
nullptr, 0, 0, 0, DINode::FlagZero, nullptr, 0, nullptr, nullptr));
|
||||
nullptr, 0, 0, 0, 0, nullptr, 0, nullptr, nullptr));
|
||||
|
||||
// Enable the mapping. There still shouldn't be a type.
|
||||
Context.enableDebugTypeODRUniquing();
|
||||
@ -39,20 +39,19 @@ TEST(DebugTypeODRUniquingTest, getODRType) {
|
||||
// Create some ODR-uniqued type.
|
||||
auto &CT = *DICompositeType::getODRType(
|
||||
Context, UUID, dwarf::DW_TAG_class_type, nullptr, nullptr, 0, nullptr,
|
||||
nullptr, 0, 0, 0, DINode::FlagZero, nullptr, 0, nullptr, nullptr);
|
||||
nullptr, 0, 0, 0, 0, nullptr, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(UUID.getString(), CT.getIdentifier());
|
||||
|
||||
// Check that we get it back, even if we change a field.
|
||||
EXPECT_EQ(&CT, DICompositeType::getODRTypeIfExists(Context, UUID));
|
||||
EXPECT_EQ(
|
||||
&CT, DICompositeType::getODRType(Context, UUID, dwarf::DW_TAG_class_type,
|
||||
nullptr, nullptr, 0, nullptr, nullptr, 0,
|
||||
0, 0, 0, nullptr, 0, nullptr, nullptr));
|
||||
EXPECT_EQ(&CT, DICompositeType::getODRType(
|
||||
Context, UUID, dwarf::DW_TAG_class_type, nullptr, nullptr,
|
||||
0, nullptr, nullptr, 0, 0, 0, DINode::FlagZero, nullptr, 0,
|
||||
nullptr, nullptr));
|
||||
EXPECT_EQ(&CT,
|
||||
DICompositeType::getODRType(
|
||||
Context, UUID, dwarf::DW_TAG_class_type,
|
||||
MDString::get(Context, "name"), nullptr, 0, nullptr, nullptr, 0,
|
||||
0, 0, DINode::FlagZero, nullptr, 0, nullptr, nullptr));
|
||||
Context, UUID, dwarf::DW_TAG_class_type,
|
||||
MDString::get(Context, "name"), nullptr, 0, nullptr,
|
||||
nullptr, 0, 0, 0, 0, nullptr, 0, nullptr, nullptr));
|
||||
|
||||
// Check that it's discarded with the type map.
|
||||
Context.disableDebugTypeODRUniquing();
|
||||
@ -83,9 +82,8 @@ TEST(DebugTypeODRUniquingTest, buildODRType) {
|
||||
|
||||
// Update with a definition. This time we should see a change.
|
||||
EXPECT_EQ(&CT, DICompositeType::buildODRType(
|
||||
Context, UUID, dwarf::DW_TAG_structure_type, nullptr,
|
||||
nullptr, 0, nullptr, nullptr, 0, 0, 0, DINode::FlagZero,
|
||||
nullptr, 0, nullptr, nullptr));
|
||||
Context, UUID, dwarf::DW_TAG_structure_type, nullptr, nullptr, 0, nullptr,
|
||||
nullptr, 0, 0, 0, 0, nullptr, 0, nullptr, nullptr));
|
||||
EXPECT_EQ(dwarf::DW_TAG_structure_type, CT.getTag());
|
||||
|
||||
// Further updates should be ignored.
|
||||
@ -94,9 +92,8 @@ TEST(DebugTypeODRUniquingTest, buildODRType) {
|
||||
nullptr, 0, 0, 0, DINode::FlagFwdDecl, nullptr, 0, nullptr, nullptr));
|
||||
EXPECT_EQ(dwarf::DW_TAG_structure_type, CT.getTag());
|
||||
EXPECT_EQ(&CT, DICompositeType::buildODRType(
|
||||
Context, UUID, dwarf::DW_TAG_class_type, nullptr, nullptr,
|
||||
0, nullptr, nullptr, 0, 0, 0, DINode::FlagZero, nullptr, 0,
|
||||
nullptr, nullptr));
|
||||
Context, UUID, dwarf::DW_TAG_class_type, nullptr, nullptr, 0, nullptr,
|
||||
nullptr, 0, 0, 0, 0, nullptr, 0, nullptr, nullptr));
|
||||
EXPECT_EQ(dwarf::DW_TAG_structure_type, CT.getTag());
|
||||
}
|
||||
|
||||
|
@ -343,12 +343,12 @@ TEST_F(IRBuilderTest, DIBuilder) {
|
||||
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_Cobol74, "F.CBL", "/",
|
||||
"llvm-cobol74", true, "", 0);
|
||||
auto Type = DIB.createSubroutineType(DIB.getOrCreateTypeArray(None));
|
||||
auto SP = DIB.createFunction(CU, "foo", "", File, 1, Type, false, true, 1,
|
||||
DINode::FlagZero, true);
|
||||
auto SP =
|
||||
DIB.createFunction(CU, "foo", "", File, 1, Type, false, true, 1, 0, true);
|
||||
F->setSubprogram(SP);
|
||||
AllocaInst *I = Builder.CreateAlloca(Builder.getInt8Ty());
|
||||
auto BarSP = DIB.createFunction(CU, "bar", "", File, 1, Type, false, true, 1,
|
||||
DINode::FlagZero, true);
|
||||
auto BarSP =
|
||||
DIB.createFunction(CU, "bar", "", File, 1, Type, false, true, 1, 0, true);
|
||||
auto BadScope = DIB.createLexicalBlockFile(BarSP, File, 0);
|
||||
I->setDebugLoc(DebugLoc::get(2, 0, BadScope));
|
||||
DIB.finalize();
|
||||
|
@ -80,13 +80,12 @@ protected:
|
||||
|
||||
MDTuple *getTuple() { return MDTuple::getDistinct(Context, None); }
|
||||
DISubroutineType *getSubroutineType() {
|
||||
return DISubroutineType::getDistinct(Context, DINode::FlagZero, 0,
|
||||
getNode(nullptr));
|
||||
return DISubroutineType::getDistinct(Context, 0, 0, getNode(nullptr));
|
||||
}
|
||||
DISubprogram *getSubprogram() {
|
||||
return DISubprogram::getDistinct(Context, nullptr, "", "", nullptr, 0,
|
||||
nullptr, false, false, 0, nullptr, 0, 0, 0,
|
||||
DINode::FlagZero, false, nullptr);
|
||||
nullptr, false, false, 0, nullptr,
|
||||
0, 0, 0, 0, false, nullptr);
|
||||
}
|
||||
DIFile *getFile() {
|
||||
return DIFile::getDistinct(Context, "file.c", "/path/to/dir");
|
||||
@ -101,9 +100,9 @@ protected:
|
||||
return DIBasicType::get(Context, dwarf::DW_TAG_unspecified_type, Name);
|
||||
}
|
||||
DIType *getDerivedType() {
|
||||
return DIDerivedType::getDistinct(
|
||||
Context, dwarf::DW_TAG_pointer_type, "", nullptr, 0, nullptr,
|
||||
getBasicType("basictype"), 1, 2, 0, DINode::FlagZero);
|
||||
return DIDerivedType::getDistinct(Context, dwarf::DW_TAG_pointer_type, "",
|
||||
nullptr, 0, nullptr,
|
||||
getBasicType("basictype"), 1, 2, 0, 0);
|
||||
}
|
||||
Constant *getConstant() {
|
||||
return ConstantInt::get(Type::getInt32Ty(Context), Counter++);
|
||||
@ -114,7 +113,7 @@ protected:
|
||||
DIType *getCompositeType() {
|
||||
return DICompositeType::getDistinct(
|
||||
Context, dwarf::DW_TAG_structure_type, "", nullptr, 0, nullptr, nullptr,
|
||||
32, 32, 0, DINode::FlagZero, nullptr, 0, nullptr, nullptr, "");
|
||||
32, 32, 0, 0, nullptr, 0, nullptr, nullptr, "");
|
||||
}
|
||||
Function *getFunction(StringRef Name) {
|
||||
return cast<Function>(M.getOrInsertFunction(
|
||||
@ -1029,21 +1028,19 @@ TEST_F(DITypeTest, setFlags) {
|
||||
Metadata *TypesOps[] = {nullptr};
|
||||
Metadata *Types = MDTuple::get(Context, TypesOps);
|
||||
|
||||
DIType *D =
|
||||
DISubroutineType::getDistinct(Context, DINode::FlagZero, 0, Types);
|
||||
EXPECT_EQ(DINode::FlagZero, D->getFlags());
|
||||
DIType *D = DISubroutineType::getDistinct(Context, 0u, 0, Types);
|
||||
EXPECT_EQ(0u, D->getFlags());
|
||||
D->setFlags(DINode::FlagRValueReference);
|
||||
EXPECT_EQ(DINode::FlagRValueReference, D->getFlags());
|
||||
D->setFlags(DINode::FlagZero);
|
||||
EXPECT_EQ(DINode::FlagZero, D->getFlags());
|
||||
D->setFlags(0u);
|
||||
EXPECT_EQ(0u, D->getFlags());
|
||||
|
||||
TempDIType T =
|
||||
DISubroutineType::getTemporary(Context, DINode::FlagZero, 0, Types);
|
||||
EXPECT_EQ(DINode::FlagZero, T->getFlags());
|
||||
TempDIType T = DISubroutineType::getTemporary(Context, 0u, 0, Types);
|
||||
EXPECT_EQ(0u, T->getFlags());
|
||||
T->setFlags(DINode::FlagRValueReference);
|
||||
EXPECT_EQ(DINode::FlagRValueReference, T->getFlags());
|
||||
T->setFlags(DINode::FlagZero);
|
||||
EXPECT_EQ(DINode::FlagZero, T->getFlags());
|
||||
T->setFlags(0u);
|
||||
EXPECT_EQ(0u, T->getFlags());
|
||||
}
|
||||
|
||||
typedef MetadataTest DIDerivedTypeTest;
|
||||
@ -1053,12 +1050,9 @@ TEST_F(DIDerivedTypeTest, get) {
|
||||
DIScope *Scope = getSubprogram();
|
||||
DIType *BaseType = getBasicType("basic");
|
||||
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", File,
|
||||
1, Scope, BaseType, 2, 3, 4, Flags5, ExtraData);
|
||||
auto *N = DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type, "something",
|
||||
File, 1, Scope, BaseType, 2, 3, 4, 5, ExtraData);
|
||||
EXPECT_EQ(dwarf::DW_TAG_pointer_type, N->getTag());
|
||||
EXPECT_EQ("something", N->getName());
|
||||
EXPECT_EQ(File, N->getFile());
|
||||
@ -1072,41 +1066,41 @@ TEST_F(DIDerivedTypeTest, get) {
|
||||
EXPECT_EQ(ExtraData, N->getExtraData());
|
||||
EXPECT_EQ(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
||||
"something", File, 1, Scope, BaseType, 2, 3,
|
||||
4, Flags5, ExtraData));
|
||||
4, 5, ExtraData));
|
||||
|
||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_reference_type,
|
||||
"something", File, 1, Scope, BaseType, 2, 3,
|
||||
4, Flags5, ExtraData));
|
||||
4, 5, ExtraData));
|
||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type, "else",
|
||||
File, 1, Scope, BaseType, 2, 3, 4, Flags5,
|
||||
File, 1, Scope, BaseType, 2, 3, 4, 5,
|
||||
ExtraData));
|
||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
||||
"something", getFile(), 1, Scope, BaseType, 2,
|
||||
3, 4, Flags5, ExtraData));
|
||||
3, 4, 5, ExtraData));
|
||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
||||
"something", File, 2, Scope, BaseType, 2, 3,
|
||||
4, Flags5, ExtraData));
|
||||
4, 5, ExtraData));
|
||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
||||
"something", File, 1, getSubprogram(),
|
||||
BaseType, 2, 3, 4, Flags5, ExtraData));
|
||||
BaseType, 2, 3, 4, 5, ExtraData));
|
||||
EXPECT_NE(N, DIDerivedType::get(
|
||||
Context, dwarf::DW_TAG_pointer_type, "something", File, 1,
|
||||
Scope, getBasicType("basic2"), 2, 3, 4, Flags5, ExtraData));
|
||||
Scope, getBasicType("basic2"), 2, 3, 4, 5, ExtraData));
|
||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
||||
"something", File, 1, Scope, BaseType, 3, 3,
|
||||
4, Flags5, ExtraData));
|
||||
4, 5, ExtraData));
|
||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
||||
"something", File, 1, Scope, BaseType, 2, 2,
|
||||
4, Flags5, ExtraData));
|
||||
4, 5, ExtraData));
|
||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
||||
"something", File, 1, Scope, BaseType, 2, 3,
|
||||
5, Flags5, ExtraData));
|
||||
5, 5, ExtraData));
|
||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
||||
"something", File, 1, Scope, BaseType, 2, 3,
|
||||
4, Flags4, ExtraData));
|
||||
4, 4, ExtraData));
|
||||
EXPECT_NE(N, DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type,
|
||||
"something", File, 1, Scope, BaseType, 2, 3,
|
||||
4, Flags5, getTuple()));
|
||||
4, 5, getTuple()));
|
||||
|
||||
TempDIDerivedType Temp = N->clone();
|
||||
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||
@ -1117,11 +1111,10 @@ TEST_F(DIDerivedTypeTest, getWithLargeValues) {
|
||||
DIScope *Scope = getSubprogram();
|
||||
DIType *BaseType = getBasicType("basic");
|
||||
MDTuple *ExtraData = getTuple();
|
||||
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(5);
|
||||
|
||||
auto *N = DIDerivedType::get(
|
||||
Context, dwarf::DW_TAG_pointer_type, "something", File, 1, Scope,
|
||||
BaseType, UINT64_MAX, UINT64_MAX - 1, UINT64_MAX - 2, Flags, ExtraData);
|
||||
auto *N = DIDerivedType::get(Context, dwarf::DW_TAG_pointer_type, "something",
|
||||
File, 1, Scope, BaseType, UINT64_MAX,
|
||||
UINT64_MAX - 1, UINT64_MAX - 2, 5, ExtraData);
|
||||
EXPECT_EQ(UINT64_MAX, N->getSizeInBits());
|
||||
EXPECT_EQ(UINT64_MAX - 1, N->getAlignInBits());
|
||||
EXPECT_EQ(UINT64_MAX - 2, N->getOffsetInBits());
|
||||
@ -1139,7 +1132,7 @@ TEST_F(DICompositeTypeTest, get) {
|
||||
uint64_t SizeInBits = 2;
|
||||
uint64_t AlignInBits = 3;
|
||||
uint64_t OffsetInBits = 4;
|
||||
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(5);
|
||||
unsigned Flags = 5;
|
||||
MDTuple *Elements = getTuple();
|
||||
unsigned RuntimeLang = 6;
|
||||
DIType *VTableHolder = getCompositeType();
|
||||
@ -1207,10 +1200,9 @@ TEST_F(DICompositeTypeTest, get) {
|
||||
Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits,
|
||||
AlignInBits, OffsetInBits + 1, Flags, Elements, RuntimeLang,
|
||||
VTableHolder, TemplateParams, Identifier));
|
||||
DINode::DIFlags FlagsPOne = static_cast<DINode::DIFlags>(Flags + 1);
|
||||
EXPECT_NE(N, DICompositeType::get(
|
||||
Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits,
|
||||
AlignInBits, OffsetInBits, FlagsPOne, Elements, RuntimeLang,
|
||||
AlignInBits, OffsetInBits, Flags + 1, Elements, RuntimeLang,
|
||||
VTableHolder, TemplateParams, Identifier));
|
||||
EXPECT_NE(N, DICompositeType::get(
|
||||
Context, Tag, Name, File, Line, Scope, BaseType, SizeInBits,
|
||||
@ -1259,7 +1251,7 @@ TEST_F(DICompositeTypeTest, getWithLargeValues) {
|
||||
uint64_t SizeInBits = UINT64_MAX;
|
||||
uint64_t AlignInBits = UINT64_MAX - 1;
|
||||
uint64_t OffsetInBits = UINT64_MAX - 2;
|
||||
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(5);
|
||||
unsigned Flags = 5;
|
||||
MDTuple *Elements = getTuple();
|
||||
unsigned RuntimeLang = 6;
|
||||
DIType *VTableHolder = getCompositeType();
|
||||
@ -1285,7 +1277,7 @@ TEST_F(DICompositeTypeTest, replaceOperands) {
|
||||
uint64_t SizeInBits = 2;
|
||||
uint64_t AlignInBits = 3;
|
||||
uint64_t OffsetInBits = 4;
|
||||
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(5);
|
||||
unsigned Flags = 5;
|
||||
unsigned RuntimeLang = 6;
|
||||
StringRef Identifier = "some id";
|
||||
|
||||
@ -1318,8 +1310,7 @@ TEST_F(DICompositeTypeTest, replaceOperands) {
|
||||
typedef MetadataTest DISubroutineTypeTest;
|
||||
|
||||
TEST_F(DISubroutineTypeTest, get) {
|
||||
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(1);
|
||||
DINode::DIFlags FlagsPOne = static_cast<DINode::DIFlags>(Flags + 1);
|
||||
unsigned Flags = 1;
|
||||
MDTuple *TypeArray = getTuple();
|
||||
|
||||
auto *N = DISubroutineType::get(Context, Flags, 0, TypeArray);
|
||||
@ -1328,7 +1319,7 @@ TEST_F(DISubroutineTypeTest, get) {
|
||||
EXPECT_EQ(TypeArray, N->getTypeArray().get());
|
||||
EXPECT_EQ(N, DISubroutineType::get(Context, Flags, 0, TypeArray));
|
||||
|
||||
EXPECT_NE(N, DISubroutineType::get(Context, FlagsPOne, 0, TypeArray));
|
||||
EXPECT_NE(N, DISubroutineType::get(Context, Flags + 1, 0, TypeArray));
|
||||
EXPECT_NE(N, DISubroutineType::get(Context, Flags, 0, getTuple()));
|
||||
|
||||
// Test the hashing of calling conventions.
|
||||
@ -1490,7 +1481,8 @@ TEST_F(DISubprogramTest, get) {
|
||||
unsigned Virtuality = 2;
|
||||
unsigned VirtualIndex = 5;
|
||||
int ThisAdjustment = -3;
|
||||
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(6);
|
||||
unsigned Flags = 6;
|
||||
unsigned NotFlags = (~Flags) & ((1 << 27) - 1);
|
||||
bool IsOptimized = false;
|
||||
MDTuple *TemplateParams = getTuple();
|
||||
DISubprogram *Declaration = getSubprogram();
|
||||
@ -1590,6 +1582,11 @@ TEST_F(DISubprogramTest, get) {
|
||||
ContainingType, Virtuality, VirtualIndex + 1,
|
||||
ThisAdjustment, Flags, IsOptimized, Unit,
|
||||
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,
|
||||
Type, IsLocalToUnit, IsDefinition, ScopeLine,
|
||||
ContainingType, Virtuality, VirtualIndex,
|
||||
@ -1892,7 +1889,8 @@ TEST_F(DILocalVariableTest, get) {
|
||||
unsigned Line = 5;
|
||||
DIType *Type = getDerivedType();
|
||||
unsigned Arg = 6;
|
||||
DINode::DIFlags Flags = static_cast<DINode::DIFlags>(7);
|
||||
unsigned Flags = 7;
|
||||
unsigned NotFlags = (~Flags) & ((1 << 16) - 1);
|
||||
|
||||
auto *N =
|
||||
DILocalVariable::get(Context, Scope, Name, File, Line, Type, Arg, Flags);
|
||||
@ -1922,6 +1920,8 @@ TEST_F(DILocalVariableTest, get) {
|
||||
getDerivedType(), Arg, Flags));
|
||||
EXPECT_NE(N, DILocalVariable::get(Context, Scope, Name, File, Line, Type,
|
||||
Arg + 1, Flags));
|
||||
EXPECT_NE(N, DILocalVariable::get(Context, Scope, Name, File, Line, Type, Arg,
|
||||
NotFlags));
|
||||
|
||||
TempDILocalVariable Temp = N->clone();
|
||||
EXPECT_EQ(N, MDNode::replaceWithUniqued(std::move(Temp)));
|
||||
@ -1929,17 +1929,17 @@ TEST_F(DILocalVariableTest, get) {
|
||||
|
||||
TEST_F(DILocalVariableTest, getArg256) {
|
||||
EXPECT_EQ(255u, DILocalVariable::get(Context, getSubprogram(), "", getFile(),
|
||||
0, nullptr, 255, DINode::FlagZero)
|
||||
0, nullptr, 255, 0)
|
||||
->getArg());
|
||||
EXPECT_EQ(256u, DILocalVariable::get(Context, getSubprogram(), "", getFile(),
|
||||
0, nullptr, 256, DINode::FlagZero)
|
||||
0, nullptr, 256, 0)
|
||||
->getArg());
|
||||
EXPECT_EQ(257u, DILocalVariable::get(Context, getSubprogram(), "", getFile(),
|
||||
0, nullptr, 257, DINode::FlagZero)
|
||||
0, nullptr, 257, 0)
|
||||
->getArg());
|
||||
unsigned Max = UINT16_MAX;
|
||||
EXPECT_EQ(Max, DILocalVariable::get(Context, getSubprogram(), "", getFile(),
|
||||
0, nullptr, Max, DINode::FlagZero)
|
||||
0, nullptr, Max, 0)
|
||||
->getArg());
|
||||
}
|
||||
|
||||
|
@ -235,9 +235,8 @@ protected:
|
||||
DBuilder.createCompileUnit(dwarf::DW_LANG_C99, "filename.c",
|
||||
"/file/dir", "CloneFunc", false, "", 0);
|
||||
|
||||
auto *Subprogram =
|
||||
DBuilder.createFunction(CU, "f", "f", File, 4, FuncType, true, true, 3,
|
||||
DINode::FlagZero, false);
|
||||
auto *Subprogram = DBuilder.createFunction(
|
||||
CU, "f", "f", File, 4, FuncType, true, true, 3, 0, false);
|
||||
OldFunc->setSubprogram(Subprogram);
|
||||
|
||||
// Function body
|
||||
@ -422,9 +421,8 @@ protected:
|
||||
DBuilder.createCompileUnit(dwarf::DW_LANG_C99, "filename.c",
|
||||
"/file/dir", "CloneModule", false, "", 0);
|
||||
// Function DI
|
||||
auto *Subprogram =
|
||||
DBuilder.createFunction(CU, "f", "f", File, 4, DFuncType, true, true, 3,
|
||||
DINode::FlagZero, false);
|
||||
auto *Subprogram = DBuilder.createFunction(CU, "f", "f", File, 4, DFuncType,
|
||||
true, true, 3, 0, false);
|
||||
F->setSubprogram(Subprogram);
|
||||
|
||||
auto *Entry = BasicBlock::Create(C, "", F);
|
||||
|
Loading…
Reference in New Issue
Block a user