diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-02-23 01:19:11 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-02-23 01:19:11 +0000 |
commit | 1e025f2e559a884a3be5db2c784cdd865352e17b (patch) | |
tree | 7ea105d6fa1d088222a076a54d76268e76a1471f /lib/Sema/SemaChecking.cpp | |
parent | 46f35f3660903a98ba16a74fe9302dc09b2c37b5 (diff) |
Simplify logic for determining values of 'ReturnsVoid' and 'HasNoReturn' flags.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96847 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 3617f546e0..97ad5b7dce 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -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. |