From e9ca55ea9b3fb2b3301499d89336b96945521f91 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Sun, 25 Mar 2012 06:30:37 +0000 Subject: [PATCH] clang/lib/Analysis/CFG.cpp: Get rid of early insertion of placeholder to the map. llvm-svn: 153407 --- clang/lib/Analysis/CFG.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp index e54fae33fe86..0129cfa5e18f 100644 --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -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 CachedBoolEvals; + typedef llvm::DenseMap CachedBoolEvalsTy; + CachedBoolEvalsTy CachedBoolEvals; public: explicit CFGBuilder(ASTContext *astContext, @@ -450,12 +451,8 @@ private: if (BinaryOperator *Bop = dyn_cast(S)) { if (Bop->isLogicalOp()) { // Check the cache first. - typedef llvm::DenseMap::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.