[cfe-commits] r138765 - /cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp

Anna Zaks ganna at apple.com
Mon Aug 29 14:10:00 PDT 2011


Author: zaks
Date: Mon Aug 29 16:10:00 2011
New Revision: 138765

URL: http://llvm.org/viewvc/llvm-project?rev=138765&view=rev
Log:
[analyzer] MacOSKeychainAPIChecker: Simplify getSymbolForRegion by using existing API. Thanks Jordy.

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=138765&r1=138764&r2=138765&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp Mon Aug 29 16:10:00 2011
@@ -198,14 +198,10 @@
 
 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();





More information about the cfe-commits mailing list