diff --git a/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp b/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp index 40c9c72dc2..1c9390217f 100644 --- a/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp @@ -201,9 +201,11 @@ static SymbolRef getSymbolForRegion(CheckerContext &C, if (!isa(R)) { // Implicit casts (ex: void* -> char*) can turn Symbolic region into element // region, if that is the case, get the underlining region. - if (const ElementRegion *ER = dyn_cast(R)) + if (const ElementRegion *ER = dyn_cast(R)) { R = ER->getAsArrayOffset().getRegion(); - else + if (!isa(R)) + return 0; + } else return 0; } return cast(R)->getSymbol(); diff --git a/test/Analysis/keychainAPI.m b/test/Analysis/keychainAPI.m index 69b36e811a..1969a9d169 100644 --- a/test/Analysis/keychainAPI.m +++ b/test/Analysis/keychainAPI.m @@ -304,3 +304,9 @@ void DellocWithCFStringCreate4(CFAllocatorRef alloc) { CFRelease(userStr); } } + +//Example from bug 10797. +__inline__ static +const char *__WBASLLevelString(int level) { + return "foo"; +}