[cfe-commits] r138415 - /cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
Anna Zaks
ganna at apple.com
Tue Aug 23 16:56:12 PDT 2011
Author: zaks
Date: Tue Aug 23 18:56:12 2011
New Revision: 138415
URL: http://llvm.org/viewvc/llvm-project?rev=138415&view=rev
Log:
[analyzer] MacOSKeychainAPIChecker: Retrieve the memory region which we are tracking even when it's no longer a SymbolicRegion, for example, when it is cast to char*.
Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp?rev=138415&r1=138414&r2=138415&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp Tue Aug 23 18:56:12 2011
@@ -167,8 +167,14 @@
static SymbolRef getSymbolForRegion(CheckerContext &C,
const MemRegion *R) {
- if (!isa<SymbolicRegion>(R))
- return 0;
+ if (!isa<SymbolicRegion>(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<ElementRegion>(R))
+ R = ER->getAsArrayOffset().getRegion();
+ else
+ return 0;
+ }
return cast<SymbolicRegion>(R)->getSymbol();
}
More information about the cfe-commits
mailing list