]> granicus.if.org Git - clang/commitdiff
[analyzer] MacOSKeychainAPIChecker: Simplify getSymbolForRegion by using existing...
authorAnna Zaks <ganna@apple.com>
Mon, 29 Aug 2011 21:10:00 +0000 (21:10 +0000)
committerAnna Zaks <ganna@apple.com>
Mon, 29 Aug 2011 21:10:00 +0000 (21:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138765 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp

index 76d92874be15e4d1785b0eb24b98af77c2182fc0..c2b547612c481b988c0e3de2512b97ca8ec47da6 100644 (file)
@@ -198,14 +198,10 @@ unsigned MacOSKeychainAPIChecker::getTrackedFunctionIndex(StringRef Name,
 
 static SymbolRef getSymbolForRegion(CheckerContext &C,
                                    const MemRegion *R) {
+  // Implicit casts (ex: void* -> char*) can turn Symbolic region into element
+  // region, if that is the case, get the underlining region.
+  R = R->StripCasts();
   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();
-      if (!R || !isa<SymbolicRegion>(R))
-        return 0;
-    } else
       return 0;
   }
   return cast<SymbolicRegion>(R)->getSymbol();