diff options
Diffstat (limited to 'llvm/lib/IR')
-rw-r--r-- | llvm/lib/IR/AttributeImpl.h | 3 | ||||
-rw-r--r-- | llvm/lib/IR/Attributes.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/IR/Metadata.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/IR/Value.cpp | 8 |
4 files changed, 12 insertions, 7 deletions
diff --git a/llvm/lib/IR/AttributeImpl.h b/llvm/lib/IR/AttributeImpl.h index 9da3f9659e0..ea954ac2032 100644 --- a/llvm/lib/IR/AttributeImpl.h +++ b/llvm/lib/IR/AttributeImpl.h @@ -94,6 +94,7 @@ public: /// attribute enties, which are for target-dependent attributes. class EnumAttributeImpl : public AttributeImpl { + virtual void anchor(); Attribute::AttrKind Kind; protected: @@ -108,6 +109,7 @@ public: }; class AlignAttributeImpl : public EnumAttributeImpl { + virtual void anchor(); unsigned Align; public: @@ -122,6 +124,7 @@ public: }; class StringAttributeImpl : public AttributeImpl { + virtual void anchor(); std::string Kind; std::string Val; diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index bcd324c4ffa..0f2b7a0ebb4 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -286,7 +286,11 @@ bool Attribute::operator<(Attribute A) const { // AttributeImpl Definition //===----------------------------------------------------------------------===// +// Pin the vtabels to this file. AttributeImpl::~AttributeImpl() {} +void EnumAttributeImpl::anchor() {} +void AlignAttributeImpl::anchor() {} +void StringAttributeImpl::anchor() {} bool AttributeImpl::hasAttribute(Attribute::AttrKind A) const { if (isStringAttribute()) return false; diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp index bd4d9c0a077..a32d25c92ae 100644 --- a/llvm/lib/IR/Metadata.cpp +++ b/llvm/lib/IR/Metadata.cpp @@ -65,7 +65,7 @@ class MDNodeOperand : public CallbackVH { public: MDNodeOperand(Value *V) : CallbackVH(V) {} - ~MDNodeOperand() {} + virtual ~MDNodeOperand(); void set(Value *V) { unsigned IsFirst = this->getValPtrInt(); @@ -82,6 +82,8 @@ public: }; } // end namespace llvm. +// Provide out-of-line definition to prevent weak vtable. +MDNodeOperand::~MDNodeOperand() {} void MDNodeOperand::deleted() { getParent()->replaceOperand(this, 0); diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp index 35808a658b4..62a3b31c18b 100644 --- a/llvm/lib/IR/Value.cpp +++ b/llvm/lib/IR/Value.cpp @@ -735,9 +735,5 @@ void ValueHandleBase::ValueIsRAUWd(Value *Old, Value *New) { #endif } -// Default implementation for CallbackVH. -void CallbackVH::allUsesReplacedWith(Value *) {} - -void CallbackVH::deleted() { - setValPtr(NULL); -} +// Pin the vtable to this file. +void CallbackVH::anchor() {} |