[cfe-commits] r76133 - in /cfe/trunk: lib/Analysis/CFG.cpp test/Analysis/dead-stores.c

Zhongxing Xu xuzhongxing at gmail.com
Fri Jul 17 00:39:39 PDT 2009


On Fri, Jul 17, 2009 at 2:08 PM, Chris Lattner<clattner at apple.com> wrote:
>
> 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.

I did this in r76164.

>
>> +        if (FD->hasAttr<NoReturnAttr>())
>> +          NoReturn = true;
>> +      }
>> +    }
>> +
>> +    if (!NoReturn)
>> +      break;
>> +
>> +    if (Block) {
>> +      if (!FinishBlock(Block))
>
> Any reason not to use "&&" here?
>
> -Chris
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list