[cfe-commits] r58553 - /cfe/trunk/lib/Analysis/GRExprEngineInternalChecks.cpp

Ted Kremenek kremenek at apple.com
Sat Nov 1 17:35:25 PDT 2008


Author: kremenek
Date: Sat Nov  1 19:35:25 2008
New Revision: 58553

URL: http://llvm.org/viewvc/llvm-project?rev=58553&view=rev
Log:
Enhance return-of-stack-address checker to recognize regions created by alloca().

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

Modified: cfe/trunk/lib/Analysis/GRExprEngineInternalChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/GRExprEngineInternalChecks.cpp?rev=58553&r1=58552&r2=58553&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngineInternalChecks.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngineInternalChecks.cpp Sat Nov  1 19:35:25 2008
@@ -216,6 +216,15 @@
         
         R = CL->getSourceRange();
       }
+      else if (const AllocaRegion* AR = dyn_cast<AllocaRegion>(V.getRegion())) {
+        const Expr* ARE = AR->getExpr();
+        SourceLocation L = ARE->getLocStart();
+        R = ARE->getSourceRange();
+        
+        os << "Address of stack memory allocated by call to alloca() on line "
+           << BR.getSourceManager().getLogicalLineNumber(L)
+           << " returned.";
+      }      
       else {        
         os << "Address of stack memory associated with local variable '"
            << V.getRegion()->getString() << "' returned.";





More information about the cfe-commits mailing list