Use 'dyn_cast' instead of a check for a function declaration followed by a
'cast'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79041 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 4952e62..e65b3aa 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -438,13 +438,14 @@
return;
}
- if (!isFunction(d)) {
+ const FunctionDecl *FD = dyn_cast<FunctionDecl>(d);
+
+ if (!FD) {
S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
<< Attr.getName() << 0 /*function*/;
return;
}
- const FunctionDecl *FD = cast<FunctionDecl>(d);
QualType RetTy = FD->getResultType();
if (!(RetTy->isAnyPointerType() || RetTy->isBlockPointerType())) {