Only allow a "noreturn" attribute to be affixed to a FunctionDecl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47844 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 6854aac..88225f5 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -1998,6 +1998,14 @@
     return;
   }
   
+  FunctionDecl *Fn = dyn_cast<FunctionDecl>(d);
+  
+  if (!Fn) {
+    Diag(rawAttr->getLoc(), diag::warn_attribute_wrong_decl_type,
+         "noreturn", "function");
+    return;
+  }
+  
   d->addAttr(new NoReturnAttr());
 }