]> granicus.if.org Git - clang/commitdiff
change cast to dyn_cast because d may not be a FunctionDecl
authorRyan Flynn <pizza@parseerror.com>
Thu, 13 Aug 2009 01:19:23 +0000 (01:19 +0000)
committerRyan Flynn <pizza@parseerror.com>
Thu, 13 Aug 2009 01:19:23 +0000 (01:19 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78876 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclAttr.cpp

index 8a4ae3b4005c051dce26e7596ab22fa1844ec8d5..d5d3840569bf62c8737cb103152eb287f370bead 100644 (file)
@@ -437,7 +437,7 @@ static void HandleMallocAttr(Decl *d, const AttributeList &Attr, Sema &S) {
     return;
   }
 
-  if (FunctionDecl *FD = cast<FunctionDecl>(d)) {
+  if (FunctionDecl *FD = dyn_cast<FunctionDecl>(d)) {
     if (!FD->getResultType()->isPointerType()) {
       S.Diag(Attr.getLoc(), diag::warn_attribute_malloc_pointer_only);
       return;