From: Adrian Prantl Date: Wed, 17 Aug 2016 16:42:15 +0000 (+0000) Subject: Simplify condition. (NFC) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c4be46253825314223aee85bd404b7157d09ffa;p=clang Simplify condition. (NFC) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@278946 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index cf34c7ab8d..cfdd5579c3 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -2657,13 +2657,14 @@ bool FunctionDecl::isGlobal() const { } bool FunctionDecl::isNoReturn() const { - bool HasNoReturnAttr = hasAttr() || hasAttr() - || hasAttr(); - const auto *FuncType = getType()->getAs(); - bool TypeHasNoReturnAttr = false; - if (FuncType) - TypeHasNoReturnAttr = FuncType->getNoReturnAttr(); - return HasNoReturnAttr || TypeHasNoReturnAttr; + if (hasAttr() || hasAttr() || + hasAttr()) + return true; + + if (auto *FnTy = getType()->getAs()) + return FnTy->getNoReturnAttr(); + + return false; } void