[cfe-commits] r50830 - in /cfe/trunk: include/clang/AST/DeclObjC.h lib/AST/DeclObjC.cpp lib/Sema/SemaDeclObjC.cpp
Fariborz Jahanian
fjahanian at apple.com
Wed May 7 13:53:44 PDT 2008
Author: fjahanian
Date: Wed May 7 15:53:44 2008
New Revision: 50830
URL: http://llvm.org/viewvc/llvm-project?rev=50830&view=rev
Log:
Synthesized getter/setter method declarations need not have
an implementation. This fixes couple of failing prperty tests
caused by my previous patch.
Modified:
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/lib/AST/DeclObjC.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=50830&r1=50829&r2=50830&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Wed May 7 15:53:44 2008
@@ -59,6 +59,9 @@
bool IsInstance : 1;
bool IsVariadic : 1;
+ // Synthesized declaration method for a property setter/getter
+ bool IsSynthesized : 1;
+
// NOTE: VC++ treats enums as signed, avoid using ImplementationControl enum
/// @required/@optional
unsigned DeclImplementation : 2;
@@ -95,10 +98,12 @@
Decl *contextDecl,
AttributeList *M = 0, bool isInstance = true,
bool isVariadic = false,
+ bool isSynthesized = false,
ImplementationControl impControl = None)
: Decl(ObjCMethod, beginLoc),
DeclContext(ObjCMethod),
IsInstance(isInstance), IsVariadic(isVariadic),
+ IsSynthesized(isSynthesized),
DeclImplementation(impControl), objcDeclQualifier(OBJC_TQ_None),
MethodContext(static_cast<NamedDecl*>(contextDecl)),
SelName(SelInfo), MethodDeclType(T),
@@ -113,6 +118,7 @@
QualType T, Decl *contextDecl,
AttributeList *M = 0, bool isInstance = true,
bool isVariadic = false,
+ bool isSynthesized = false,
ImplementationControl impControl = None);
ObjCDeclQualifier getObjCDeclQualifier() const {
@@ -158,6 +164,8 @@
bool isInstance() const { return IsInstance; }
bool isVariadic() const { return IsVariadic; }
+ bool isSynthesized() const { return IsSynthesized; }
+
// Related to protocols declared in @protocol
void setDeclImplementation(ImplementationControl ic) {
DeclImplementation = ic;
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=50830&r1=50829&r2=50830&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Wed May 7 15:53:44 2008
@@ -26,12 +26,13 @@
Decl *contextDecl,
AttributeList *M, bool isInstance,
bool isVariadic,
+ bool isSynthesized,
ImplementationControl impControl) {
void *Mem = C.getAllocator().Allocate<ObjCMethodDecl>();
return new (Mem) ObjCMethodDecl(beginLoc, endLoc,
SelInfo, T, contextDecl,
M, isInstance,
- isVariadic, impControl);
+ isVariadic, isSynthesized, impControl);
}
ObjCInterfaceDecl *ObjCInterfaceDecl::Create(ASTContext &C,
@@ -294,7 +295,7 @@
property->getLocation(),
property->getGetterName(), resultDeclType,
this, 0,
- true, false, ObjCMethodDecl::Required);
+ true, false, true, ObjCMethodDecl::Required);
property->setGetterMethodDecl(ObjCMethod);
insMethods.push_back(ObjCMethod);
}
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=50830&r1=50829&r2=50830&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Wed May 7 15:53:44 2008
@@ -636,7 +636,7 @@
bool IncompleteImpl = false;
for (ObjCInterfaceDecl::instmeth_iterator I = IDecl->instmeth_begin(),
E = IDecl->instmeth_end(); I != E; ++I)
- if (!InsMap.count((*I)->getSelector()))
+ if (!(*I)->isSynthesized() && !InsMap.count((*I)->getSelector()))
WarnUndefinedMethod(IMPDecl->getLocation(), *I, IncompleteImpl);
llvm::DenseSet<Selector> ClsMap;
@@ -964,6 +964,7 @@
ObjCMethodDecl::Create(Context, MethodLoc, EndLoc, Sel, resultDeclType,
ClassDecl, AttrList,
MethodType == tok::minus, isVariadic,
+ false,
MethodDeclKind == tok::objc_optional ?
ObjCMethodDecl::Optional :
ObjCMethodDecl::Required);
More information about the cfe-commits
mailing list