diff options
author | Mike Stump <mrs@apple.com> | 2009-07-25 21:26:53 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-07-25 21:26:53 +0000 |
commit | 2455636163fdd18581d7fdae816433f886d88213 (patch) | |
tree | 400db92d5838683de2174dddb056f3a186d6c8cc /lib/Analysis/CFG.cpp | |
parent | 742cd1b7bb86b52b23b335d47abbd842dac0e1bf (diff) |
Add noreturn as a type attribute, handle printing for them and handle
calls to noreturn function pointers when CFG building.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77089 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFG.cpp')
-rw-r--r-- | lib/Analysis/CFG.cpp | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/lib/Analysis/CFG.cpp b/lib/Analysis/CFG.cpp index 217df459b8..c4406858e5 100644 --- a/lib/Analysis/CFG.cpp +++ b/lib/Analysis/CFG.cpp @@ -501,25 +501,29 @@ CFGBlock *CFGBuilder::VisitBreakStmt(BreakStmt *B) { CFGBlock *CFGBuilder::VisitCallExpr(CallExpr *C, bool alwaysAdd) { // If this is a call to a no-return function, this stops the block here. - if (FunctionDecl *FD = C->getDirectCallee()) { - - if (!FD->hasAttr<NoReturnAttr>()) - return VisitStmt(C, alwaysAdd); - - if (Block && !FinishBlock(Block)) - return 0; - - // Create new block with no successor for the remaining pieces. - Block = createBlock(false); - Block->appendStmt(C); + bool NoReturn = false; + if (C->getCallee()->getType().getNoReturnAttr()) { + NoReturn = true; + } + + if (FunctionDecl *FD = C->getDirectCallee()) + if (FD->hasAttr<NoReturnAttr>()) + NoReturn = true; + + if (!NoReturn) + return VisitStmt(C, alwaysAdd); - // Wire this to the exit block directly. - Block->addSuccessor(&cfg->getExit()); + if (Block && !FinishBlock(Block)) + return 0; - return VisitChildren(C); - } + // Create new block with no successor for the remaining pieces. + Block = createBlock(false); + Block->appendStmt(C); + + // Wire this to the exit block directly. + Block->addSuccessor(&cfg->getExit()); - return VisitStmt(C, alwaysAdd); + return VisitChildren(C); } CFGBlock *CFGBuilder::VisitChooseExpr(ChooseExpr *C) { |