aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-01-03 22:52:32 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-01-03 22:52:32 +0000
commit341b8be2b8069e09eb4d928bebf5d55a50515614 (patch)
treee023d44f070813da5f1a2c49626b8a359b31f5ed /lib/Sema/SemaDeclAttr.cpp
parented002bd2f9eaea6ed5030ccd90fdaa870598a16a (diff)
objc: diagnose misplacement of objc_suppress_autosynthesis
attribute. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147490 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--lib/Sema/SemaDeclAttr.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 4074afee1c..22a2cfe8a6 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -1581,6 +1581,11 @@ static void handleArcWeakrefUnavailableAttr(Sema &S, Decl *D,
static void handleObjCSuppressAutosynthesisAttr(Sema &S, Decl *D,
const AttributeList &Attr) {
+ if (!isa<ObjCInterfaceDecl>(D)) {
+ S.Diag(Attr.getLoc(), diag::err_suppress_autosynthesis);
+ return;
+ }
+
unsigned NumArgs = Attr.getNumArgs();
if (NumArgs > 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_too_many_arguments) << 0;