[cfe-commits] r171501 - /cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp

Ted Kremenek kremenek at apple.com
Fri Jan 4 11:04:36 PST 2013


Author: kremenek
Date: Fri Jan  4 13:04:36 2013
New Revision: 171501

URL: http://llvm.org/viewvc/llvm-project?rev=171501&view=rev
Log:
Tighten code.  No functionality change.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp?rev=171501&r1=171500&r2=171501&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp Fri Jan  4 13:04:36 2013
@@ -1500,16 +1500,16 @@
 
   // Retrieve the associated statement.
   ProgramPoint ProgLoc = N->getLocation();
-  if (StmtPoint *SP = dyn_cast<StmtPoint>(&ProgLoc))
+  if (StmtPoint *SP = dyn_cast<StmtPoint>(&ProgLoc)) {
     S = SP->getStmt();
-  else if (CallExitEnd *Exit = dyn_cast<CallExitEnd>(&ProgLoc))
+  } else if (CallExitEnd *Exit = dyn_cast<CallExitEnd>(&ProgLoc)) {
     S = Exit->getCalleeContext()->getCallSite();
-  // If an assumption was made on a branch, it should be caught
-  // here by looking at the state transition.
-  else if (BlockEdge *Edge = dyn_cast<BlockEdge>(&ProgLoc)) {
-    const CFGBlock *srcBlk = Edge->getSrc();
-    S = srcBlk->getTerminator();
+  } else if (BlockEdge *Edge = dyn_cast<BlockEdge>(&ProgLoc)) {
+    // If an assumption was made on a branch, it should be caught
+    // here by looking at the state transition.
+    S = Edge->getSrc()->getTerminator();
   }
+
   if (!S)
     return 0;
 





More information about the cfe-commits mailing list