r278946 - Simplify condition. (NFC)
Adrian Prantl via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 17 09:42:15 PDT 2016
Author: adrian
Date: Wed Aug 17 11:42:15 2016
New Revision: 278946
URL: http://llvm.org/viewvc/llvm-project?rev=278946&view=rev
Log:
Simplify condition. (NFC)
Modified:
cfe/trunk/lib/AST/Decl.cpp
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=278946&r1=278945&r2=278946&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Wed Aug 17 11:42:15 2016
@@ -2657,13 +2657,14 @@ bool FunctionDecl::isGlobal() const {
}
bool FunctionDecl::isNoReturn() const {
- bool HasNoReturnAttr = hasAttr<NoReturnAttr>() || hasAttr<CXX11NoReturnAttr>()
- || hasAttr<C11NoReturnAttr>();
- const auto *FuncType = getType()->getAs<FunctionType>();
- bool TypeHasNoReturnAttr = false;
- if (FuncType)
- TypeHasNoReturnAttr = FuncType->getNoReturnAttr();
- return HasNoReturnAttr || TypeHasNoReturnAttr;
+ if (hasAttr<NoReturnAttr>() || hasAttr<CXX11NoReturnAttr>() ||
+ hasAttr<C11NoReturnAttr>())
+ return true;
+
+ if (auto *FnTy = getType()->getAs<FunctionType>())
+ return FnTy->getNoReturnAttr();
+
+ return false;
}
void
More information about the cfe-commits
mailing list