diff options
-rw-r--r-- | lib/StaticAnalyzer/Core/ExprEngine.cpp | 2 | ||||
-rw-r--r-- | test/Analysis/exceptions.mm | 23 |
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Core/ExprEngine.cpp b/lib/StaticAnalyzer/Core/ExprEngine.cpp index b0435fb562..e7b009a176 100644 --- a/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -889,7 +889,7 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred, case Stmt::ObjCAtThrowStmtClass: { // FIXME: This is not complete. We basically treat @throw as // an abort. - Bldr.generateNode(S, Pred, Pred->getState()); + Bldr.generateNode(S, Pred, Pred->getState(), /*IsSink=*/true); break; } diff --git a/test/Analysis/exceptions.mm b/test/Analysis/exceptions.mm new file mode 100644 index 0000000000..7306038ba1 --- /dev/null +++ b/test/Analysis/exceptions.mm @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -analyze -fexceptions -fobjc-exceptions -fcxx-exceptions -analyzer-ipa=inlining -analyzer-checker=core,unix.Malloc,debug.ExprInspection -verify %s + +void clang_analyzer_checkInlined(bool); + +typedef typeof(sizeof(int)) size_t; +void *malloc(size_t); +void free(void *); + + +id getException(); +void inlinedObjC() { + clang_analyzer_checkInlined(true); // expected-warning{{TRUE}} + @throw getException(); +} + +int testObjC() { + int a; // uninitialized + void *mem = malloc(4); // no-warning (ObjC exceptions are usually fatal) + inlinedObjC(); + free(mem); + return a; // no-warning +} + |