[cfe-commits] r153407 - /cfe/trunk/lib/Analysis/CFG.cpp

NAKAMURA Takumi geek4civic at gmail.com
Sat Mar 24 23:30:37 PDT 2012


Author: chapuni
Date: Sun Mar 25 01:30:37 2012
New Revision: 153407

URL: http://llvm.org/viewvc/llvm-project?rev=153407&view=rev
Log:
clang/lib/Analysis/CFG.cpp: Get rid of early insertion of placeholder to the map.

Modified:
    cfe/trunk/lib/Analysis/CFG.cpp

Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=153407&r1=153406&r2=153407&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Sun Mar 25 01:30:37 2012
@@ -288,7 +288,8 @@
 
   // 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 @@
     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.





More information about the cfe-commits mailing list