summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-08-13 23:50:15 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-08-13 23:50:15 +0000
commit2dcef9e0a41331f9645bd659ffa37b8da76cab28 (patch)
treed7a540d9b4d54c4504372b1be68143b63829d781 /clang/lib/CodeGen/CodeGenModule.cpp
parentf7b41371d9ede1aecf0930e5bd4a463519264633 (diff)
downloadbcm5719-llvm-2dcef9e0a41331f9645bd659ffa37b8da76cab28.tar.gz
bcm5719-llvm-2dcef9e0a41331f9645bd659ffa37b8da76cab28.zip
Avoid iteration invalidation issues around MaterializedTemporaryExpr
We risk iterator invalidation issues if we use a DenseMap to hold the backing storage for an APValue. Instead, BumpPtrAllocate them and use APValue * as our DenseMap value. Also, don't assume that MaterializedGlobalTemporaryMap won't regrow between when we initially perform a lookup and later on when we actually try to insert into it. This fixes PR24289. Differential Revision: http://reviews.llvm.org/D11629 llvm-svn: 244989
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 5ce25a29d48..76e6f3dcde4 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -3029,8 +3029,7 @@ llvm::Constant *CodeGenModule::GetAddrOfGlobalTemporary(
if (Init == E->GetTemporaryExpr())
MaterializedType = E->getType();
- llvm::Constant *&Slot = MaterializedGlobalTemporaryMap[E];
- if (Slot)
+ if (llvm::Constant *Slot = MaterializedGlobalTemporaryMap[E])
return Slot;
// FIXME: If an externally-visible declaration extends multiple temporaries,
@@ -3101,7 +3100,7 @@ llvm::Constant *CodeGenModule::GetAddrOfGlobalTemporary(
GV->setComdat(TheModule.getOrInsertComdat(GV->getName()));
if (VD->getTLSKind())
setTLSMode(GV, *VD);
- Slot = GV;
+ MaterializedGlobalTemporaryMap[E] = GV;
return GV;
}
OpenPOWER on IntegriCloud