diff options
author | Eric Christopher <echristo@gmail.com> | 2013-01-16 01:22:23 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2013-01-16 01:22:23 +0000 |
commit | 6b6061f01171bd3d4e32022efa45428d4f9941ee (patch) | |
tree | aae4e22e2a4ca079f2ff59c85f524318eb91d5a0 /include | |
parent | 171192f149dce679cd520f85ffced4789448b017 (diff) | |
download | external_llvm-6b6061f01171bd3d4e32022efa45428d4f9941ee.zip external_llvm-6b6061f01171bd3d4e32022efa45428d4f9941ee.tar.gz external_llvm-6b6061f01171bd3d4e32022efa45428d4f9941ee.tar.bz2 |
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
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/DIBuilder.h | 17 | ||||
-rw-r--r-- | include/llvm/DebugInfo.h | 17 |
2 files changed, 31 insertions, 3 deletions
diff --git a/include/llvm/DIBuilder.h b/include/llvm/DIBuilder.h index e0e3fc9..fb7aa8b 100644 --- a/include/llvm/DIBuilder.h +++ b/include/llvm/DIBuilder.h @@ -172,6 +172,19 @@ namespace llvm { uint64_t AlignInBits, uint64_t OffsetInBits, unsigned Flags, DIType Ty); + /// createStaticMemberType - Create debugging information entry for a + /// C++ static data member. + /// @param Scope Member scope. + /// @param Name Member name. + /// @param File File where this member is declared. + /// @param LineNo Line number. + /// @param Ty Type of the static member. + /// @param Flags Flags to encode member attribute, e.g. private. + /// @param Val Const initializer of the member. + DIType createStaticMemberType(DIDescriptor Scope, StringRef Name, + DIFile File, unsigned LineNo, DIType Ty, + unsigned Flags, llvm::Value *Val); + /// createObjCIVar - Create debugging information entry for Objective-C /// instance variable. /// @param Name Member name. @@ -402,10 +415,12 @@ namespace llvm { /// @param isLocalToUnit Boolean flag indicate whether this variable is /// externally visible or not. /// @param Val llvm::Value of the variable. + /// @param Decl Reference to the corresponding declaration. DIGlobalVariable createStaticVariable(DIDescriptor Context, StringRef Name, StringRef LinkageName, DIFile File, unsigned LineNo, - DIType Ty, bool isLocalToUnit, llvm::Value *Val); + DIType Ty, bool isLocalToUnit, llvm::Value *Val, + MDNode *Decl = NULL); /// createLocalVariable - Create a new descriptor for the specified diff --git a/include/llvm/DebugInfo.h b/include/llvm/DebugInfo.h index ec0f000..fdf6e96 100644 --- a/include/llvm/DebugInfo.h +++ b/include/llvm/DebugInfo.h @@ -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; |