aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/CFG.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-13 19:06:18 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-13 19:06:18 +0000
commit9653db7bd0e3665b955a0445859285f2e1e7dacd (patch)
tree7ab8824e1fd2be0d0c42e7f623081ac860358d20 /lib/AST/CFG.cpp
parent26efc3388adb010984da2f70e1f24e8286e6476d (diff)
Remove DeclGroupOwningRef, since we intend for declarations to be owned
by DeclContexts (always) rather than by statements. DeclContext currently goes out of its way to avoid destroying any Decls that might be owned by a DeclGroupOwningRef. However, in an error-recovery situation, a failure in a declaration statement can cause all of the decls in a DeclGroupOwningRef to be destroyed after they've already be added into the DeclContext. Hence, DeclContext is left with already-destroyed declarations, and bad things happen. This problem was causing failures that showed up as assertions on x86 Linux in test/Parser/objc-forcollection-neg-2.m. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64474 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/CFG.cpp')
-rw-r--r--lib/AST/CFG.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/AST/CFG.cpp b/lib/AST/CFG.cpp
index 2ea8388287..e08a00b8a5 100644
--- a/lib/AST/CFG.cpp
+++ b/lib/AST/CFG.cpp
@@ -379,11 +379,8 @@ CFGBlock* CFGBuilder::WalkAST(Stmt* Terminator, bool AlwaysAddStmt = false) {
? 8 : llvm::AlignOf<DeclStmt>::Alignment;
// Allocate the DeclStmt using the BumpPtrAllocator. It will
- // get automatically freed with the CFG. Note that even though
- // we are using a DeclGroupOwningRef that wraps a singe Decl*,
- // that Decl* will not get deallocated because the destroy method
- // of DG is never called.
- DeclGroupOwningRef DG(*I);
+ // get automatically freed with the CFG.
+ DeclGroupRef DG(*I);
Decl* D = *I;
void* Mem = cfg->getAllocator().Allocate(sizeof(DeclStmt), A);