Use 'getAs<CodeTextRegion>' instead of 'dyn_cast<CodeTextRegion>' to handle any
layered regions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69686 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/SVals.cpp b/lib/Analysis/SVals.cpp
index 8eaeda4..71f09d2 100644
--- a/lib/Analysis/SVals.cpp
+++ b/lib/Analysis/SVals.cpp
@@ -33,7 +33,7 @@
 const FunctionDecl* SVal::getAsFunctionDecl() const {
   if (const loc::MemRegionVal* X = dyn_cast<loc::MemRegionVal>(this)) {
     const MemRegion* R = X->getRegion();
-    if (const CodeTextRegion* CTR = dyn_cast<CodeTextRegion>(R)) {
+    if (const CodeTextRegion* CTR = R->getAs<CodeTextRegion>()) {
       if (CTR->isDeclared())
         return CTR->getDecl();
     }