]> granicus.if.org Git - clang/commitdiff
Added support for __builtin_choose_expr (ChooseExpr) in CFGs.
authorTed Kremenek <kremenek@apple.com>
Fri, 31 Aug 2007 17:03:41 +0000 (17:03 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 31 Aug 2007 17:03:41 +0000 (17:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41646 91177308-0d34-0410-b5e6-96231b3b80d8

AST/CFG.cpp

index 2c9336e3814fdaba6055d5815d1c9e33b4def6ad..89d7af99657d7dfcad07e218601c61445ea36824 100644 (file)
@@ -243,6 +243,28 @@ CFGBlock* CFGBuilder::WalkAST(Stmt* S, bool AlwaysAddStmt = false) {
       Block->setTerminator(C);
       return addStmt(C->getCond());
     }
+    
+    case Stmt::ChooseExprClass: {
+      ChooseExpr* C = cast<ChooseExpr>(S);      
+      
+      CFGBlock* ConfluenceBlock = (Block) ? Block : createBlock();  
+      ConfluenceBlock->appendStmt(C);
+      FinishBlock(ConfluenceBlock);
+      
+      Succ = ConfluenceBlock;
+      Block = NULL;
+      CFGBlock* LHSBlock = Visit(C->getLHS());
+      
+      Succ = ConfluenceBlock;
+      Block = NULL;
+      CFGBlock* RHSBlock = Visit(C->getRHS());
+      
+      Block = createBlock(false);
+      Block->addSuccessor(LHSBlock);
+      Block->addSuccessor(RHSBlock);
+      Block->setTerminator(C);
+      return addStmt(C->getCond());
+    }
 
     case Stmt::DeclStmtClass:      
       if (VarDecl* V = dyn_cast<VarDecl>(cast<DeclStmt>(S)->getDecl())) {