From bab459eaf46e4ea9c98ebed00d4abed8d05078d6 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Tue, 23 Feb 2010 01:19:11 +0000 Subject: [PATCH] Simplify logic for determining values of 'ReturnsVoid' and 'HasNoReturn' flags. No functionality change. llvm-svn: 96847 --- clang/lib/Sema/SemaChecking.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 3617f546e089..97ad5b7dce19 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/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(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() || - FD->getType()->getAs()->getNoReturnAttr()) - HasNoReturn = true; + ReturnsVoid = FD->getResultType()->isVoidType(); + HasNoReturn = FD->hasAttr() || + FD->getType()->getAs()->getNoReturnAttr(); + } else if (ObjCMethodDecl *MD = dyn_cast(D)) { - if (MD->getResultType()->isVoidType()) - ReturnsVoid = true; - if (MD->hasAttr()) - HasNoReturn = true; + ReturnsVoid = MD->getResultType()->isVoidType(); + HasNoReturn = MD->hasAttr(); } // Short circuit for compilation speed.