Simplify logic for determining values of 'ReturnsVoid' and 'HasNoReturn' flags.

No functionality change.

llvm-svn: 96847
This commit is contained in:
Ted Kremenek 2010-02-23 01:19:11 +00:00
parent 5586096a5a
commit bab459eaf4
1 changed files with 7 additions and 9 deletions

View File

@ -2490,22 +2490,20 @@ void Sema::CheckFallThroughForFunctionDef(Decl *D, Stmt *Body,
bool ReturnsVoid = false;
bool HasNoReturn = false;
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
// For function templates, class templates and member function templates
// we'll do the analysis at instantiation time.
if (FD->isDependentContext())
return;
if (FD->getResultType()->isVoidType())
ReturnsVoid = true;
if (FD->hasAttr<NoReturnAttr>() ||
FD->getType()->getAs<FunctionType>()->getNoReturnAttr())
HasNoReturn = true;
ReturnsVoid = FD->getResultType()->isVoidType();
HasNoReturn = FD->hasAttr<NoReturnAttr>() ||
FD->getType()->getAs<FunctionType>()->getNoReturnAttr();
} else if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) {
if (MD->getResultType()->isVoidType())
ReturnsVoid = true;
if (MD->hasAttr<NoReturnAttr>())
HasNoReturn = true;
ReturnsVoid = MD->getResultType()->isVoidType();
HasNoReturn = MD->hasAttr<NoReturnAttr>();
}
// Short circuit for compilation speed.