aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/StaticAnalyzer/Core/ExprEngine.cpp9
-rw-r--r--test/Analysis/exceptions.mm15
-rw-r--r--test/Analysis/misc-ps-region-store.cpp6
3 files changed, 21 insertions, 9 deletions
diff --git a/lib/StaticAnalyzer/Core/ExprEngine.cpp b/lib/StaticAnalyzer/Core/ExprEngine.cpp
index e7b009a176..c64a35eafb 100644
--- a/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -607,11 +607,6 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred,
case Stmt::AtomicExprClass:
// Fall through.
- // Currently all handling of 'throw' just falls to the CFG. We
- // can consider doing more if necessary.
- case Stmt::CXXThrowExprClass:
- // Fall through.
-
// Cases we intentionally don't evaluate, since they don't need
// to be explicitly evaluated.
case Stmt::AddrLabelExprClass:
@@ -886,12 +881,12 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred,
Bldr.addNodes(Dst);
break;
- case Stmt::ObjCAtThrowStmtClass: {
+ case Stmt::ObjCAtThrowStmtClass:
+ case Stmt::CXXThrowExprClass:
// FIXME: This is not complete. We basically treat @throw as
// an abort.
Bldr.generateNode(S, Pred, Pred->getState(), /*IsSink=*/true);
break;
- }
case Stmt::ReturnStmtClass:
Bldr.takeNodes(Pred);
diff --git a/test/Analysis/exceptions.mm b/test/Analysis/exceptions.mm
index 7306038ba1..ab2a6a6851 100644
--- a/test/Analysis/exceptions.mm
+++ b/test/Analysis/exceptions.mm
@@ -21,3 +21,18 @@ int testObjC() {
return a; // no-warning
}
+
+void inlinedCXX() {
+ clang_analyzer_checkInlined(true); // expected-warning{{TRUE}}
+ throw -1;
+}
+
+int testCXX() {
+ int a; // uninitialized
+ // FIXME: this should be reported as a leak, because C++ exceptions are
+ // often not fatal.
+ void *mem = malloc(4);
+ inlinedCXX();
+ free(mem);
+ return a; // no-warning
+}
diff --git a/test/Analysis/misc-ps-region-store.cpp b/test/Analysis/misc-ps-region-store.cpp
index e30cedb911..164bffc70f 100644
--- a/test/Analysis/misc-ps-region-store.cpp
+++ b/test/Analysis/misc-ps-region-store.cpp
@@ -537,7 +537,8 @@ MyEnum rdar10892489_positive() {
throw MyEnumValue;
} catch (MyEnum e) {
int *p = 0;
- *p = 0xDEADBEEF; // expected-warning {{null}}
+ // FALSE NEGATIVE
+ *p = 0xDEADBEEF; // {{null}}
return e;
}
return MyEnumValue;
@@ -562,7 +563,8 @@ void PR11545_positive() {
catch (...)
{
int *p = 0;
- *p = 0xDEADBEEF; // expected-warning {{null}}
+ // FALSE NEGATIVE
+ *p = 0xDEADBEEF; // {{null}}
}
}