summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-11-23 00:14:32 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-11-23 00:14:32 +0000
commit36129a953de3d1e88bd683f2de6fc32efee9ab4b (patch)
tree2e78213bf1816e17d87512c62a40c0477cbe96b5 /clang/lib/Sema/SemaDeclObjC.cpp
parent4751d701b743270db71f81e2f1bc31758eadc8d2 (diff)
downloadbcm5719-llvm-36129a953de3d1e88bd683f2de6fc32efee9ab4b.tar.gz
bcm5719-llvm-36129a953de3d1e88bd683f2de6fc32efee9ab4b.zip
ObjectiveC. Remove warning diagnostic which checks
attribute on method declaration and implementation match. This makes no sense. Most annotations are meant for declarations only and one is for implementation. This has been constant source of regresions and hackery to get around special cases. I am removing this check. Such checks must be done on a case by case basis and when it makes sense. For example, it makes sense for availability/deprecated and I will file a radar for that. // rdar://15531984 llvm-svn: 195524
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp67
1 files changed, 0 insertions, 67 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index f44fb325114..08556961109 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -2729,64 +2729,6 @@ CvtQTToAstBitMask(ObjCDeclSpec::ObjCDeclQualifier PQTVal) {
return (Decl::ObjCDeclQualifier) (unsigned) PQTVal;
}
-static inline
-unsigned countAlignAttr(const AttrVec &A) {
- unsigned count=0;
- for (AttrVec::const_iterator i = A.begin(), e = A.end(); i != e; ++i)
- if ((*i)->getKind() == attr::Aligned)
- ++count;
- return count;
-}
-
-static inline
-bool containsInvalidMethodImplAttribute(ObjCMethodDecl *IMD,
- const AttrVec &A) {
- // If method is only declared in implementation (private method),
- // No need to issue any diagnostics on method definition with attributes.
- if (!IMD)
- return false;
-
- // method declared in interface has no attribute.
- // But implementation has attributes. This is invalid.
- // Except when implementation has 'Align' attribute which is
- // immaterial to method declared in interface.
- if (!IMD->hasAttrs())
- return (A.size() > countAlignAttr(A));
-
- const AttrVec &D = IMD->getAttrs();
-
- unsigned countAlignOnImpl = countAlignAttr(A);
- if (!countAlignOnImpl && (A.size() != D.size()))
- return true;
- else if (countAlignOnImpl) {
- unsigned countAlignOnDecl = countAlignAttr(D);
- if (countAlignOnDecl && (A.size() != D.size()))
- return true;
- else if (!countAlignOnDecl &&
- ((A.size()-countAlignOnImpl) != D.size()))
- return true;
- }
-
- // attributes on method declaration and definition must match exactly.
- // Note that we have at most a couple of attributes on methods, so this
- // n*n search is good enough.
- for (AttrVec::const_iterator i = A.begin(), e = A.end(); i != e; ++i) {
- if ((*i)->getKind() == attr::Aligned)
- continue;
- bool match = false;
- for (AttrVec::const_iterator i1 = D.begin(), e1 = D.end(); i1 != e1; ++i1) {
- if ((*i)->getKind() == (*i1)->getKind()) {
- match = true;
- break;
- }
- }
- if (!match)
- return true;
- }
-
- return false;
-}
-
/// \brief Check whether the declared result type of the given Objective-C
/// method declaration is compatible with the method's class.
///
@@ -3224,15 +3166,6 @@ Decl *Sema::ActOnMethodDeclaration(
ObjCMethod->addAttr(
new (Context) ObjCRequiresSuperAttr(ObjCMethod->getLocation(), Context));
}
- if (ObjCMethod->hasAttrs() &&
- containsInvalidMethodImplAttribute(IMD, ObjCMethod->getAttrs())) {
- SourceLocation MethodLoc = IMD->getLocation();
- if (!getSourceManager().isInSystemHeader(MethodLoc)) {
- Diag(EndLoc, diag::warn_attribute_method_def);
- Diag(MethodLoc, diag::note_method_declared_at)
- << ObjCMethod->getDeclName();
- }
- }
} else {
cast<DeclContext>(ClassDecl)->addDecl(ObjCMethod);
}
OpenPOWER on IntegriCloud