summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorManman Ren <manman.ren@gmail.com>2013-09-06 18:27:00 +0000
committerManman Ren <manman.ren@gmail.com>2013-09-06 18:27:00 +0000
commit5930eabe0fdc48c02c5af500aa5b1c5b732848b1 (patch)
tree5e40e3fa4a6139447f8372b585de3379cc4a0e3a /include
parent28da141d44cd67b96085d7bb0ae7dfac554a0c10 (diff)
downloadllvm-5930eabe0fdc48c02c5af500aa5b1c5b732848b1.tar.gz
llvm-5930eabe0fdc48c02c5af500aa5b1c5b732848b1.tar.bz2
llvm-5930eabe0fdc48c02c5af500aa5b1c5b732848b1.tar.xz
Debug Info: Move a helper function getTypeIdentifier from DIBuilder to be part
of DIType. Implement DIType::generateRef to return a type reference. This function will be used in setContaintingType and in DIBuilder to generete the type reference. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190188 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/DebugInfo.h34
1 files changed, 20 insertions, 14 deletions
diff --git a/include/llvm/DebugInfo.h b/include/llvm/DebugInfo.h
index bbb274329c..4d08ce90b2 100644
--- a/include/llvm/DebugInfo.h
+++ b/include/llvm/DebugInfo.h
@@ -155,20 +155,6 @@ namespace llvm {
template <>
DITypeRef DIDescriptor::getFieldAs<DITypeRef>(unsigned Elt) const;
- /// Represents reference to a DIType, abstracts over direct and
- /// identifier-based metadata type references.
- class DITypeRef {
- template <typename DescTy>
- friend DescTy DIDescriptor::getFieldAs(unsigned Elt) const;
-
- /// TypeVal can be either a MDNode or a MDString, in the latter,
- /// MDString specifies the type identifier.
- const Value *TypeVal;
- explicit DITypeRef(const Value *V);
- public:
- DIType resolve(const DITypeIdentifierMap &Map) const;
- };
-
/// DISubrange - This is used to represent ranges, for array bounds.
class DISubrange : public DIDescriptor {
friend class DIDescriptor;
@@ -285,12 +271,32 @@ namespace llvm {
/// isUnsignedDIType - Return true if type encoding is unsigned.
bool isUnsignedDIType();
+ /// Generate a reference to this DIType. Uses the type identifier instead
+ /// of the actual MDNode if possible, to help type uniquing.
+ DITypeRef generateRef();
+
/// replaceAllUsesWith - Replace all uses of debug info referenced by
/// this descriptor.
void replaceAllUsesWith(DIDescriptor &D);
void replaceAllUsesWith(MDNode *D);
};
+ /// Represents reference to a DIType, abstracts over direct and
+ /// identifier-based metadata type references.
+ class DITypeRef {
+ template <typename DescTy>
+ friend DescTy DIDescriptor::getFieldAs(unsigned Elt) const;
+ friend DITypeRef DIType::generateRef();
+
+ /// TypeVal can be either a MDNode or a MDString, in the latter,
+ /// MDString specifies the type identifier.
+ const Value *TypeVal;
+ explicit DITypeRef(const Value *V);
+ public:
+ DIType resolve(const DITypeIdentifierMap &Map) const;
+ operator Value *() const { return const_cast<Value*>(TypeVal); }
+ };
+
/// DIBasicType - A basic type, like 'int' or 'float'.
class DIBasicType : public DIType {
public: