diff options
author | David Blaikie <dblaikie@gmail.com> | 2015-08-13 22:12:21 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2015-08-13 22:12:21 +0000 |
commit | c1334cc17d024117f25351b00be400e630b16825 (patch) | |
tree | adcfbe91b26adadca8381818ea9cfa239b5f8a91 /clang/lib/Analysis/CFG.cpp | |
parent | 5c73c941c9369189480f43a753858340814775c6 (diff) | |
download | bcm5719-llvm-c1334cc17d024117f25351b00be400e630b16825.tar.gz bcm5719-llvm-c1334cc17d024117f25351b00be400e630b16825.zip |
Wdeprecated: Make BumpVectorContext movable
Turns out the one place that relied on the implicit copy ctor was safe
because it created an object in a state where the dtor was a no-op, but
that's more luck that good management.
Sure up the API by defining move construction and using it, which
implicitly disallows the unreliable copy operations.
llvm-svn: 244968
Diffstat (limited to 'clang/lib/Analysis/CFG.cpp')
-rw-r--r-- | clang/lib/Analysis/CFG.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp index 3a358f91b09..efc93534ed1 100644 --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -176,8 +176,8 @@ private: public: /// Constructs empty scope linked to previous scope in specified place. - LocalScope(BumpVectorContext &ctx, const_iterator P) - : ctx(ctx), Vars(ctx, 4), Prev(P) {} + LocalScope(BumpVectorContext ctx, const_iterator P) + : ctx(std::move(ctx)), Vars(this->ctx, 4), Prev(P) {} /// Begin of scope in direction of CFG building (backwards). const_iterator begin() const { return const_iterator(*this, Vars.size()); } @@ -1247,13 +1247,11 @@ void CFGBuilder::addImplicitDtorsForDestructor(const CXXDestructorDecl *DD) { /// createOrReuseLocalScope - If Scope is NULL create new LocalScope. Either /// way return valid LocalScope object. LocalScope* CFGBuilder::createOrReuseLocalScope(LocalScope* Scope) { - if (!Scope) { - llvm::BumpPtrAllocator &alloc = cfg->getAllocator(); - Scope = alloc.Allocate<LocalScope>(); - BumpVectorContext ctx(alloc); - new (Scope) LocalScope(ctx, ScopePos); - } - return Scope; + if (Scope) + return Scope; + llvm::BumpPtrAllocator &alloc = cfg->getAllocator(); + return new (alloc.Allocate<LocalScope>()) + LocalScope(BumpVectorContext(alloc), ScopePos); } /// addLocalScopeForStmt - Add LocalScope to local scopes tree for statement |