[cfe-commits] r147562 - in /cfe/trunk: include/clang/AST/DeclObjC.h include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaObjCProperty.cpp
Fariborz Jahanian
fjahanian at apple.com
Wed Jan 4 15:16:13 PST 2012
Author: fjahanian
Date: Wed Jan 4 17:16:13 2012
New Revision: 147562
URL: http://llvm.org/viewvc/llvm-project?rev=147562&view=rev
Log:
objc: When issuing warning for missing synthesis for
properties in classes declared with objc_suppress_autosynthesis
attribute, pinpoint location of the said class in a note.
Modified:
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=147562&r1=147561&r2=147562&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Wed Jan 4 17:16:13 2012
@@ -865,15 +865,16 @@
}
/// isObjCSuppressAutosynthesis - Checks that a class or one of its super
- /// classes must not be auto-synthesized. Returns true if it must not be.
- bool isObjCSuppressAutosynthesis() const {
+ /// classes must not be auto-synthesized. Returns class decl. if it must not be;
+ /// 0, otherwise.
+ const ObjCInterfaceDecl *isObjCSuppressAutosynthesis() const {
const ObjCInterfaceDecl *Class = this;
while (Class) {
if (Class->hasAttr<ObjCSuppressAutosynthesisAttr>())
- return true;
+ return Class;
Class = Class->getSuperClass();
}
- return false;
+ return 0;
}
ObjCIvarDecl *lookupInstanceVariable(IdentifierInfo *IVarName,
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=147562&r1=147561&r2=147562&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Jan 4 17:16:13 2012
@@ -379,6 +379,8 @@
"class implementation is declared here">;
def note_class_declared : Note<
"class is declared here">;
+def note_suppressed_class_declare : Note<
+ "class with specified objc_suppress_autosynthesis attribute is declared here">;
def warn_dup_category_def : Warning<
"duplicate definition of category %1 on interface %0">;
def err_conflicting_super_class : Error<"conflicting super class name %0">;
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=147562&r1=147561&r2=147562&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Wed Jan 4 17:16:13 2012
@@ -1394,6 +1394,11 @@
<< Prop->getDeclName() << Prop->getGetterName();
Diag(Prop->getLocation(),
diag::note_property_declare);
+ if (LangOpts.ObjCDefaultSynthProperties && LangOpts.ObjCNonFragileABI2)
+ if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(CDecl))
+ if (const ObjCInterfaceDecl *RID = ID->isObjCSuppressAutosynthesis())
+ Diag(RID->getLocation(), diag::note_suppressed_class_declare);
+
}
if (!Prop->isReadOnly() && !InsMap.count(Prop->getSetterName())) {
@@ -1404,6 +1409,10 @@
<< Prop->getDeclName() << Prop->getSetterName();
Diag(Prop->getLocation(),
diag::note_property_declare);
+ if (LangOpts.ObjCDefaultSynthProperties && LangOpts.ObjCNonFragileABI2)
+ if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(CDecl))
+ if (const ObjCInterfaceDecl *RID = ID->isObjCSuppressAutosynthesis())
+ Diag(RID->getLocation(), diag::note_suppressed_class_declare);
}
}
}
More information about the cfe-commits
mailing list