[cfe-commits] r66629 - /cfe/trunk/lib/Analysis/GRExprEngine.cpp

Ted Kremenek kremenek at apple.com
Tue Mar 10 19:41:36 PDT 2009


Author: kremenek
Date: Tue Mar 10 21:41:36 2009
New Revision: 66629

URL: http://llvm.org/viewvc/llvm-project?rev=66629&view=rev
Log:
GRExprEngine: Add pretty-stack trace printing for crashes and assertion failures.

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

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

==============================================================================
--- cfe/trunk/lib/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Analysis/GRExprEngine.cpp Tue Mar 10 21:41:36 2009
@@ -18,6 +18,7 @@
 
 #include "clang/Analysis/PathSensitive/BugReporter.h"
 #include "clang/Basic/SourceManager.h"
+#include "clang/Basic/PrettyStackTrace.h"
 #include "llvm/Support/Streams.h"
 #include "llvm/ADT/ImmutableList.h"
 #include "llvm/Support/Compiler.h"
@@ -152,6 +153,10 @@
 
 void GRExprEngine::ProcessStmt(Stmt* S, StmtNodeBuilder& builder) {
   
+  PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(),
+                                S->getLocStart(),
+                                "Error evaluating statement");
+  
   Builder = &builder;
   EntryNode = builder.getLastNode();
   
@@ -221,8 +226,11 @@
   Builder = NULL;
 }
 
-void GRExprEngine::Visit(Stmt* S, NodeTy* Pred, NodeSet& Dst) {
-  
+void GRExprEngine::Visit(Stmt* S, NodeTy* Pred, NodeSet& Dst) {  
+  PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(),
+                                S->getLocStart(),
+                                "Error evaluating statement");
+
   // FIXME: add metadata to the CFG so that we can disable
   //  this check when we KNOW that there is no block-level subexpression.
   //  The motivation is that this check requires a hashtable lookup.
@@ -534,6 +542,10 @@
 
 void GRExprEngine::ProcessBranch(Stmt* Condition, Stmt* Term,
                                  BranchNodeBuilder& builder) {
+  
+  PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(),
+                                Condition->getLocStart(),
+                                "Error evaluating branch");
 
   // Remove old bindings for subexpressions.
   const GRState* PrevState =





More information about the cfe-commits mailing list