Introduce new CFGElement hierarchy to support C++ CFG, based on Marcin's patch
and discussions with Ted and Jordy.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114056 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Checker/BugReporter.cpp b/lib/Checker/BugReporter.cpp
index 5043d90..a3f4f03 100644
--- a/lib/Checker/BugReporter.cpp
+++ b/lib/Checker/BugReporter.cpp
@@ -1165,15 +1165,15 @@
       }
 
       if (const BlockEntrance *BE = dyn_cast<BlockEntrance>(&P)) {
-        if (const Stmt* S = BE->getFirstStmt()) {
-         if (IsControlFlowExpr(S)) {
-           // Add the proper context for '&&', '||', and '?'.
-           EB.addContext(S);
-         }
-         else
-           EB.addExtendedContext(PDB.getEnclosingStmtLocation(S).asStmt());
+        if (CFGStmt S = BE->getFirstElement().getAs<CFGStmt>()) {
+          if (IsControlFlowExpr(S)) {
+            // Add the proper context for '&&', '||', and '?'.
+            EB.addContext(S);
+          }
+          else
+            EB.addExtendedContext(PDB.getEnclosingStmtLocation(S).asStmt());
         }
-
+        
         break;
       }
     } while (0);