diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-08-14 20:51:58 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-08-14 20:51:58 +0000 |
commit | f1858598d2dea36991df88bb32a795797ea1c316 (patch) | |
tree | 9e78c2bdc2615c16a2450f4d4bce4c24fa7f89bf /lib/Sema/SemaDeclAttr.cpp | |
parent | a18d7d80eb914a48521f0b7b25057fb8a69c4652 (diff) |
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
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 4952e62900..e65b3aa6fd 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -438,13 +438,14 @@ static void HandleMallocAttr(Decl *d, const AttributeList &Attr, Sema &S) { 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())) { |