aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclObjC.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-04-18 04:59:38 +0000
committerTed Kremenek <kremenek@apple.com>2010-04-18 04:59:38 +0000
commit422bae76c7900101427e05895f315c1d22a237a5 (patch)
tree05395a18775acc547cc663536b55b62dafeee390 /lib/Sema/SemaDeclObjC.cpp
parent153b3ba7a61f3228fd3a8c67b9bff94db3e13a2e (diff)
Allow the 'ibaction' attribute to be attached to method declarations (and not issue a warning).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101699 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--lib/Sema/SemaDeclObjC.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index ba6c8bb886..cc1aab4d89 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -1492,6 +1492,16 @@ CvtQTToAstBitMask(ObjCDeclSpec::ObjCDeclQualifier PQTVal) {
return ret;
}
+static inline
+bool containsInvalidMethodImplAttribute(const AttributeList *A) {
+ // The 'ibaction' attribute is allowed on method definitions because of
+ // how the IBAction macro is used on both method declarations and definitions.
+ // If the method definitions contains any other attributes, return true.
+ while (A && A->getKind() == AttributeList::AT_IBAction)
+ A = A->getNext();
+ return A != NULL;
+}
+
Sema::DeclPtrTy Sema::ActOnMethodDeclaration(
SourceLocation MethodLoc, SourceLocation EndLoc,
tok::TokenKind MethodType, DeclPtrTy classDecl,
@@ -1618,7 +1628,7 @@ Sema::DeclPtrTy Sema::ActOnMethodDeclaration(
}
InterfaceMD = ImpDecl->getClassInterface()->getMethod(Sel,
MethodType == tok::minus);
- if (AttrList)
+ if (containsInvalidMethodImplAttribute(AttrList))
Diag(EndLoc, diag::warn_attribute_method_def);
} else if (ObjCCategoryImplDecl *CatImpDecl =
dyn_cast<ObjCCategoryImplDecl>(ClassDecl)) {
@@ -1629,7 +1639,7 @@ Sema::DeclPtrTy Sema::ActOnMethodDeclaration(
PrevMethod = CatImpDecl->getClassMethod(Sel);
CatImpDecl->addClassMethod(ObjCMethod);
}
- if (AttrList)
+ if (containsInvalidMethodImplAttribute(AttrList))
Diag(EndLoc, diag::warn_attribute_method_def);
}
if (PrevMethod) {