Define metadata interfaces for describing a static data member

of a class. Emit static data member declarations and definitions
through correctly.

Part of PR14471.

Patch by Paul Robinson!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172590 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher
2013-01-16 01:22:23 +00:00
parent 171192f149
commit 6b6061f011
6 changed files with 164 additions and 51 deletions

View File

@@ -62,7 +62,8 @@ namespace llvm {
FlagPrototyped = 1 << 8,
FlagObjcClassComplete = 1 << 9,
FlagObjectPointer = 1 << 10,
FlagVector = 1 << 11
FlagVector = 1 << 11,
FlagStaticMember = 1 << 12
};
protected:
const MDNode *DbgNode;
@@ -300,6 +301,9 @@ namespace llvm {
bool isVector() const {
return (getFlags() & FlagVector) != 0;
}
bool isStaticMember() const {
return (getFlags() & FlagStaticMember) != 0;
}
bool isValid() const {
return DbgNode && (isBasicType() || isDerivedType() || isCompositeType());
}
@@ -337,7 +341,8 @@ namespace llvm {
};
/// DIDerivedType - A simple derived type, like a const qualified type,
/// a typedef, a pointer or reference, etc.
/// a typedef, a pointer or reference, et cetera. Or, a data member of
/// a class/struct/union.
class DIDerivedType : public DIType {
friend class DIDescriptor;
void printInternal(raw_ostream &OS) const;
@@ -363,6 +368,11 @@ namespace llvm {
return getFieldAs<DIType>(10);
}
Constant *getConstant() const {
assert((getTag() == dwarf::DW_TAG_member) && isStaticMember());
return getConstantField(10);
}
StringRef getObjCPropertyName() const {
if (getVersion() > LLVMDebugVersion11)
return StringRef();
@@ -620,6 +630,9 @@ namespace llvm {
GlobalVariable *getGlobal() const { return getGlobalVariableField(11); }
Constant *getConstant() const { return getConstantField(11); }
DIDerivedType getStaticDataMemberDeclaration() const {
return getFieldAs<DIDerivedType>(12);
}
/// Verify - Verify that a global variable descriptor is well formed.
bool Verify() const;