Only allow a "noreturn" attribute to be affixed to a FunctionDecl.
llvm-svn: 47844
This commit is contained in:
parent
7e97ed56e3
commit
98c56677a7
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue