[cfe-commits] r47844 - /cfe/trunk/Sema/SemaDecl.cpp
Ted Kremenek
kremenek at apple.com
Mon Mar 3 08:52:27 PST 2008
Author: kremenek
Date: Mon Mar 3 10:52:27 2008
New Revision: 47844
URL: http://llvm.org/viewvc/llvm-project?rev=47844&view=rev
Log:
Only allow a "noreturn" attribute to be affixed to a FunctionDecl.
Modified:
cfe/trunk/Sema/SemaDecl.cpp
Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=47844&r1=47843&r2=47844&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Mon Mar 3 10:52:27 2008
@@ -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());
}
More information about the cfe-commits
mailing list