Use SymbolicRegion instead of CodeTextRegion for symbolic function
pointers.  Most logic cares first about whether or not a region is
symbolic, and second if represents code.  This should fix a series of
silent corner case bugs (as well as simplify a bunch of code).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80335 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/Store.cpp b/lib/Analysis/Store.cpp
index e2412f6..f0ecda7 100644
--- a/lib/Analysis/Store.cpp
+++ b/lib/Analysis/Store.cpp
@@ -52,16 +52,12 @@
     return CastResult(state, R->getBaseRegion());
 
   if (CastToTy->isBlockPointerType()) {
-    if (isa<CodeTextRegion>(R))
-      return CastResult(state, R);
-    
-    // FIXME: This may not be the right approach, depending on the symbol
+    // FIXME: We may need different solutions, depending on the symbol
     // involved.  Blocks can be casted to/from 'id', as they can be treated
-    // as Objective-C objects.
-    if (SymbolRef sym = loc::MemRegionVal(R).getAsSymbol()) {
-      R = MRMgr.getCodeTextRegion(sym, CastToTy);
+    // as Objective-C objects.  This could possibly be handled by enhancing
+    // our reasoning of downcasts of symbolic objects.    
+    if (isa<CodeTextRegion>(R) || isa<SymbolicRegion>(R))
       return CastResult(state, R);
-    }
 
     // We don't know what to make of it.  Return a NULL region, which
     // will be interpretted as UnknownVal.