[cfe-commits] r76133 - in /cfe/trunk: lib/Analysis/CFG.cpp test/Analysis/dead-stores.c
Chris Lattner
clattner at apple.com
Thu Jul 16 23:08:33 PDT 2009
On Jul 16, 2009, at 6:04 PM, Mike Stump wrote:
> Author: mrs
> Date: Thu Jul 16 20:04:31 2009
> New Revision: 76133
>
> URL: http://llvm.org/viewvc/llvm-project?rev=76133&view=rev
> Log:
> Make noreturn functions alter the CFG.
Great, this is a nice enhancement.
> + case Stmt::CallExprClass: {
> + bool NoReturn = false;
> + CallExpr *C = cast<CallExpr>(Terminator);
> + Expr *CEE = C->getCallee()->IgnoreParenCasts();
> + if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(CEE)) {
> + // FIXME: We can follow objective-c methods and C++ member
> functions...
> + if (FunctionDecl *FD = dyn_cast<FunctionDecl>(DRE-
> >getDecl())) {
Please factor this out into a new CallExpr::getDirectCallee() method,
which returns a FunctionDecl* if the call is a direct call to a
function or null if not.
> + if (FD->hasAttr<NoReturnAttr>())
> + NoReturn = true;
> + }
> + }
> +
> + if (!NoReturn)
> + break;
> +
> + if (Block) {
> + if (!FinishBlock(Block))
Any reason not to use "&&" here?
-Chris
More information about the cfe-commits
mailing list