clang/lib/Analysis/CFG.cpp: Get rid of early insertion of placeholder to the map.

llvm-svn: 153407
This commit is contained in:
NAKAMURA Takumi 2012-03-25 06:30:37 +00:00
parent f0434b09fc
commit e9ca55ea9b
1 changed files with 4 additions and 7 deletions

View File

@ -288,7 +288,8 @@ class CFGBuilder {
// Caches boolean evaluations of expressions to avoid multiple re-evaluations
// during construction of branches for chained logical operators.
llvm::DenseMap<Expr *, TryResult> CachedBoolEvals;
typedef llvm::DenseMap<Expr *, TryResult> CachedBoolEvalsTy;
CachedBoolEvalsTy CachedBoolEvals;
public:
explicit CFGBuilder(ASTContext *astContext,
@ -450,12 +451,8 @@ private:
if (BinaryOperator *Bop = dyn_cast<BinaryOperator>(S)) {
if (Bop->isLogicalOp()) {
// Check the cache first.
typedef llvm::DenseMap<Expr *, TryResult>::iterator eval_iterator;
eval_iterator I;
bool Inserted;
llvm::tie(I, Inserted) =
CachedBoolEvals.insert(std::make_pair(S, TryResult()));
if (!Inserted)
CachedBoolEvalsTy::iterator I = CachedBoolEvals.find(S);
if (I != CachedBoolEvals.end())
return I->second; // already in map;
// Retrieve result at first, or the map might be updated.