diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-11-18 00:37:17 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-11-18 00:37:17 +0000 |
commit | 50846f80acea3d2e2e74d472ae22ddbae0984930 (patch) | |
tree | ea98a752c8216e1abd7fb700f337c9a34d1b0da0 /llvm/lib/IR/LLVMContextImpl.cpp | |
parent | 94d384e4231e5e1e511873e421fdb63b175d64f0 (diff) | |
download | llvm-50846f80acea3d2e2e74d472ae22ddbae0984930.zip llvm-50846f80acea3d2e2e74d472ae22ddbae0984930.tar.gz llvm-50846f80acea3d2e2e74d472ae22ddbae0984930.tar.bz2 |
IR: Split MDNode into GenericMDNode and MDNodeFwdDecl
Split `MDNode` into two classes:
- `GenericMDNode`, which is uniquable (and for now, always starts
uniqued). Once `Metadata` is split from the `Value` hierarchy, this
class will lose the ability to RAUW itself.
- `MDNodeFwdDecl`, which is used for the "temporary" interface, is
never uniqued, and isn't managed by `LLVMContext` at all.
I've left most of the guts in `MDNode` for now, but I'll incrementally
move things to the right places (or delete the functionality, as
appropriate).
Part of PR21532.
llvm-svn: 222205
Diffstat (limited to 'llvm/lib/IR/LLVMContextImpl.cpp')
-rw-r--r-- | llvm/lib/IR/LLVMContextImpl.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp index cd9da0d..d4239e5 100644 --- a/llvm/lib/IR/LLVMContextImpl.cpp +++ b/llvm/lib/IR/LLVMContextImpl.cpp @@ -122,13 +122,12 @@ LLVMContextImpl::~LLVMContextImpl() { // Destroy MDNodes. ~MDNode can move and remove nodes between the MDNodeSet // and the NonUniquedMDNodes sets, so copy the values out first. - SmallVector<MDNode*, 8> MDNodes; + SmallVector<GenericMDNode *, 8> MDNodes; MDNodes.reserve(MDNodeSet.size() + NonUniquedMDNodes.size()); MDNodes.append(MDNodeSet.begin(), MDNodeSet.end()); MDNodes.append(NonUniquedMDNodes.begin(), NonUniquedMDNodes.end()); - for (SmallVectorImpl<MDNode *>::iterator I = MDNodes.begin(), - E = MDNodes.end(); I != E; ++I) - (*I)->destroy(); + for (auto &I : MDNodes) + I->destroy(); assert(MDNodeSet.empty() && NonUniquedMDNodes.empty() && "Destroying all MDNodes didn't empty the Context's sets."); |