aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-10-22 01:56:45 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-10-22 01:56:45 +0000
commitee28a4be624c875e1a3ad08e84f17841117897a1 (patch)
treecd3b4e99073a7c52cb0e101eaf128904121e6462
parent7fda400103a5ae21fdc5f31b07c69cf60737cb29 (diff)
Fixes a minor hick up to my last patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142711 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaDeclObjC.cpp8
-rw-r--r--test/SemaObjC/method-attributes.m2
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 69d9c1d998..f3b7ad713d 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -2321,11 +2321,15 @@ static inline
bool containsInvalidMethodImplAttribute(ObjCMethodDecl *IMD,
const AttrVec &A) {
// If method is only declared in implementation (private method),
- // or method declared in interface has no attribute.
// No need to issue any diagnostics on method definition with attributes.
- if (!IMD || !IMD->hasAttrs())
+ if (!IMD)
return false;
+ // method declared in interface has no attribute.
+ // But implementation has attributes. This is invalid
+ if (!IMD->hasAttrs())
+ return true;
+
const AttrVec &D = IMD->getAttrs();
if (D.size() != A.size())
return true;
diff --git a/test/SemaObjC/method-attributes.m b/test/SemaObjC/method-attributes.m
index f7f647bd46..a560e7432f 100644
--- a/test/SemaObjC/method-attributes.m
+++ b/test/SemaObjC/method-attributes.m
@@ -20,7 +20,7 @@
@end
@implementation INTF
-- (int) foo: (int)arg1 __attribute__((deprecated)){
+- (int) foo: (int)arg1 __attribute__((deprecated)){ // expected-warning {{method attribute can only be specified}}
return 10;
}
- (int) foo1: (int)arg1 {