summaryrefslogtreecommitdiff
path: root/include/llvm/Metadata.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-28 07:41:54 +0000
committerChris Lattner <sabre@nondot.org>2009-12-28 07:41:54 +0000
commitc5e08a963973f43c10869cd249c0718d307dd031 (patch)
tree64a0237283ed4ed33f39bfae9cc7cea6094338b1 /include/llvm/Metadata.h
parent0b86a6f049e4d839bd770241571628d10c980887 (diff)
downloadllvm-c5e08a963973f43c10869cd249c0718d307dd031.tar.gz
llvm-c5e08a963973f43c10869cd249c0718d307dd031.tar.bz2
llvm-c5e08a963973f43c10869cd249c0718d307dd031.tar.xz
move ElementVH out of the MDNode class into the MDNode.cpp file. Among
other things, this avoids vtable and rtti data for it being splatted in every translation unit that uses it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92207 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Metadata.h')
-rw-r--r--include/llvm/Metadata.h29
1 files changed, 7 insertions, 22 deletions
diff --git a/include/llvm/Metadata.h b/include/llvm/Metadata.h
index fd8ea0c13b..e7d9c1a868 100644
--- a/include/llvm/Metadata.h
+++ b/include/llvm/Metadata.h
@@ -84,6 +84,9 @@ public:
}
};
+
+class MDNodeElement;
+
//===----------------------------------------------------------------------===//
/// MDNode - a tuple of other values.
/// These contain a list of the values that represent the metadata.
@@ -91,29 +94,14 @@ public:
class MDNode : public MetadataBase, public FoldingSetNode {
MDNode(const MDNode &); // DO NOT IMPLEMENT
- friend class ElementVH;
- // Use CallbackVH to hold MDNode elements.
- struct ElementVH : public CallbackVH {
- MDNode *Parent;
- ElementVH() {}
- ElementVH(Value *V, MDNode *P) : CallbackVH(V), Parent(P) {}
- ~ElementVH() {}
-
- virtual void deleted() {
- Parent->replaceElement(this->operator Value*(), 0);
- }
-
- virtual void allUsesReplacedWith(Value *NV) {
- Parent->replaceElement(this->operator Value*(), NV);
- }
- };
+ friend class MDNodeElement;
static const unsigned short FunctionLocalBit = 1;
// Replace each instance of F from the element list of this node with T.
void replaceElement(Value *F, Value *T);
- ElementVH *Node;
+ MDNodeElement *Node;
unsigned NodeSize;
protected:
@@ -128,11 +116,8 @@ public:
~MDNode();
/// getElement - Return specified element.
- Value *getElement(unsigned i) const {
- assert(i < getNumElements() && "Invalid element number!");
- return Node[i];
- }
-
+ Value *getElement(unsigned i) const;
+
/// getNumElements - Return number of MDNode elements.
unsigned getNumElements() const { return NodeSize; }