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

llvm-svn: 47844
This commit is contained in:
Ted Kremenek 2008-03-03 16:52:27 +00:00
parent 7e97ed56e3
commit 98c56677a7
1 changed files with 8 additions and 0 deletions

View File

@ -1998,6 +1998,14 @@ void Sema::HandleNoReturnAttribute(Decl *d, AttributeList *rawAttr) {
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());
}