summaryrefslogtreecommitdiffstats
path: root/clang
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
commite96f9c816b92d360679b4dd99351d91d36fa68f5 (patch)
treefc62e22841f46a87034982ec60255246560622cb /clang
parentbc7748b7d33723c9df9622b31d027ec8fdce5350 (diff)
downloadbcm5719-llvm-e96f9c816b92d360679b4dd99351d91d36fa68f5.tar.gz
bcm5719-llvm-e96f9c816b92d360679b4dd99351d91d36fa68f5.zip
Fixes a minor hick up to my last patch.
llvm-svn: 142711
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp8
-rw-r--r--clang/test/SemaObjC/method-attributes.m2
2 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 69d9c1d9980..f3b7ad713dc 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/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/clang/test/SemaObjC/method-attributes.m b/clang/test/SemaObjC/method-attributes.m
index f7f647bd460..a560e7432fc 100644
--- a/clang/test/SemaObjC/method-attributes.m
+++ b/clang/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 {
OpenPOWER on IntegriCloud