]> granicus.if.org Git - clang/commitdiff
clang/lib/Analysis/CFG.cpp: Get rid of early insertion of placeholder to the map.
authorNAKAMURA Takumi <geek4civic@gmail.com>
Sun, 25 Mar 2012 06:30:37 +0000 (06:30 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Sun, 25 Mar 2012 06:30:37 +0000 (06:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153407 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/CFG.cpp

index e54fae33fe86e5b8fa5676877605080f1352ffce..0129cfa5e18fa7cfb97d4d500fa539b514613f27 100644 (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.