[PATCH] [patch] Adding Consumed Analysis to Clang

Delesley Hutchins delesley at google.com
Wed Aug 7 11:08:13 PDT 2013



================
Comment at: lib/Analysis/Consumed.cpp:145
@@ +144,3 @@
+  return MethodDecl->isMoveAssignmentOperator() ||
+         (MethodDecl->getNameAsString() == "operator=" &&
+          MethodDecl->getNumParams()    == 1 &&
----------------
Use getOverloadedOperator() == OO_Equal, rather than string comparisons.

================
Comment at: include/clang/Analysis/Analyses/Consumed.h:67
@@ +66,3 @@
+    
+    typedef llvm::DenseMap<const CFGBlock *, ConsumedStateMap *> MapType;
+    typedef std::pair<const CFGBlock *, ConsumedStateMap *> PairType;
----------------
CFG blocks are numbered from 0 to N, so you can save both time and memory by using a vector indexed by the block number, rather than a hash table on the pointer.  

================
Comment at: include/clang/Analysis/Analyses/Consumed.h:70
@@ +69,3 @@
+    
+    typedef llvm::DenseSet<const CFGBlock *> SetType;
+    
----------------
Again, this should be a BitVector, indexed by the block ID, rather than a set.

================
Comment at: lib/Analysis/Consumed.cpp:466
@@ +465,3 @@
+bool ConsumedStmtVisitor::VisitMaterializeTemporaryExpr(
+  MaterializeTemporaryExpr *Temp) {
+  
----------------
Indent by 4?


http://llvm-reviews.chandlerc.com/D1233



More information about the cfe-commits mailing list