]> granicus.if.org Git - clang/commitdiff
Add transfer function support for BlockExpr.
authorTed Kremenek <kremenek@apple.com>
Wed, 25 Nov 2009 01:33:13 +0000 (01:33 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 25 Nov 2009 01:33:13 +0000 (01:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89829 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/GRExprEngine.h
lib/Analysis/GRExprEngine.cpp

index 99ff57443b8334e5c86a2d7c53e6aaab6c0d35fb..5c6475acf8ef913fd6df0d3bf66e77b63471045d 100644 (file)
@@ -255,6 +255,9 @@ protected:
                                 AsmStmt::inputs_iterator I,
                                 AsmStmt::inputs_iterator E,
                                 ExplodedNode* Pred, ExplodedNodeSet& Dst);
+  
+  /// VisitBlockExpr - Transfer function logic for BlockExprs.
+  void VisitBlockExpr(BlockExpr *BE, ExplodedNode *Pred, ExplodedNodeSet &Dst);
 
   /// VisitBinaryOperator - Transfer function logic for binary operators.
   void VisitBinaryOperator(BinaryOperator* B, ExplodedNode* Pred, 
index 255a6639acf1f6cfe1322c90ff8843767a45d84f..11ea5f8f3f9c3b7e1d938afc57a2ce1889f0c5c1 100644 (file)
@@ -420,6 +420,10 @@ void GRExprEngine::Visit(Stmt* S, ExplodedNode* Pred, ExplodedNodeSet& Dst) {
       VisitAsmStmt(cast<AsmStmt>(S), Pred, Dst);
       break;
 
+    case Stmt::BlockExprClass:
+      VisitBlockExpr(cast<BlockExpr>(S), Pred, Dst);
+      break;
+
     case Stmt::BinaryOperatorClass: {
       BinaryOperator* B = cast<BinaryOperator>(S);
 
@@ -1059,6 +1063,14 @@ void GRExprEngine::VisitLogicalExpr(BinaryOperator* B, ExplodedNode* Pred,
 // Transfer functions: Loads and stores.
 //===----------------------------------------------------------------------===//
 
+void GRExprEngine::VisitBlockExpr(BlockExpr *BE, ExplodedNode *Pred,
+                                  ExplodedNodeSet &Dst) {
+  CanQualType T = getContext().getCanonicalType(BE->getType());
+  SVal V = ValMgr.getBlockPointer(BE->getBlockDecl(), T);
+  MakeNode(Dst, BE, Pred, GetState(Pred)->BindExpr(BE, V),
+           ProgramPoint::PostLValueKind);
+}
+
 void GRExprEngine::VisitDeclRefExpr(DeclRefExpr *Ex, ExplodedNode *Pred,
                                     ExplodedNodeSet &Dst, bool asLValue) {