forked from OSchip/llvm-project
Synthesized getter/setter method declarations need not have
an implementation. This fixes couple of failing prperty tests caused by my previous patch. llvm-svn: 50830
This commit is contained in:
parent
f958ec50c0
commit
8983f17ba0
|
@ -59,6 +59,9 @@ private:
|
||||||
bool IsInstance : 1;
|
bool IsInstance : 1;
|
||||||
bool IsVariadic : 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
|
// NOTE: VC++ treats enums as signed, avoid using ImplementationControl enum
|
||||||
/// @required/@optional
|
/// @required/@optional
|
||||||
unsigned DeclImplementation : 2;
|
unsigned DeclImplementation : 2;
|
||||||
|
@ -95,10 +98,12 @@ private:
|
||||||
Decl *contextDecl,
|
Decl *contextDecl,
|
||||||
AttributeList *M = 0, bool isInstance = true,
|
AttributeList *M = 0, bool isInstance = true,
|
||||||
bool isVariadic = false,
|
bool isVariadic = false,
|
||||||
|
bool isSynthesized = false,
|
||||||
ImplementationControl impControl = None)
|
ImplementationControl impControl = None)
|
||||||
: Decl(ObjCMethod, beginLoc),
|
: Decl(ObjCMethod, beginLoc),
|
||||||
DeclContext(ObjCMethod),
|
DeclContext(ObjCMethod),
|
||||||
IsInstance(isInstance), IsVariadic(isVariadic),
|
IsInstance(isInstance), IsVariadic(isVariadic),
|
||||||
|
IsSynthesized(isSynthesized),
|
||||||
DeclImplementation(impControl), objcDeclQualifier(OBJC_TQ_None),
|
DeclImplementation(impControl), objcDeclQualifier(OBJC_TQ_None),
|
||||||
MethodContext(static_cast<NamedDecl*>(contextDecl)),
|
MethodContext(static_cast<NamedDecl*>(contextDecl)),
|
||||||
SelName(SelInfo), MethodDeclType(T),
|
SelName(SelInfo), MethodDeclType(T),
|
||||||
|
@ -113,6 +118,7 @@ public:
|
||||||
QualType T, Decl *contextDecl,
|
QualType T, Decl *contextDecl,
|
||||||
AttributeList *M = 0, bool isInstance = true,
|
AttributeList *M = 0, bool isInstance = true,
|
||||||
bool isVariadic = false,
|
bool isVariadic = false,
|
||||||
|
bool isSynthesized = false,
|
||||||
ImplementationControl impControl = None);
|
ImplementationControl impControl = None);
|
||||||
|
|
||||||
ObjCDeclQualifier getObjCDeclQualifier() const {
|
ObjCDeclQualifier getObjCDeclQualifier() const {
|
||||||
|
@ -158,6 +164,8 @@ public:
|
||||||
bool isInstance() const { return IsInstance; }
|
bool isInstance() const { return IsInstance; }
|
||||||
bool isVariadic() const { return IsVariadic; }
|
bool isVariadic() const { return IsVariadic; }
|
||||||
|
|
||||||
|
bool isSynthesized() const { return IsSynthesized; }
|
||||||
|
|
||||||
// Related to protocols declared in @protocol
|
// Related to protocols declared in @protocol
|
||||||
void setDeclImplementation(ImplementationControl ic) {
|
void setDeclImplementation(ImplementationControl ic) {
|
||||||
DeclImplementation = ic;
|
DeclImplementation = ic;
|
||||||
|
|
|
@ -26,12 +26,13 @@ ObjCMethodDecl *ObjCMethodDecl::Create(ASTContext &C,
|
||||||
Decl *contextDecl,
|
Decl *contextDecl,
|
||||||
AttributeList *M, bool isInstance,
|
AttributeList *M, bool isInstance,
|
||||||
bool isVariadic,
|
bool isVariadic,
|
||||||
|
bool isSynthesized,
|
||||||
ImplementationControl impControl) {
|
ImplementationControl impControl) {
|
||||||
void *Mem = C.getAllocator().Allocate<ObjCMethodDecl>();
|
void *Mem = C.getAllocator().Allocate<ObjCMethodDecl>();
|
||||||
return new (Mem) ObjCMethodDecl(beginLoc, endLoc,
|
return new (Mem) ObjCMethodDecl(beginLoc, endLoc,
|
||||||
SelInfo, T, contextDecl,
|
SelInfo, T, contextDecl,
|
||||||
M, isInstance,
|
M, isInstance,
|
||||||
isVariadic, impControl);
|
isVariadic, isSynthesized, impControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjCInterfaceDecl *ObjCInterfaceDecl::Create(ASTContext &C,
|
ObjCInterfaceDecl *ObjCInterfaceDecl::Create(ASTContext &C,
|
||||||
|
@ -294,7 +295,7 @@ void ObjCInterfaceDecl::addPropertyMethods(
|
||||||
property->getLocation(),
|
property->getLocation(),
|
||||||
property->getGetterName(), resultDeclType,
|
property->getGetterName(), resultDeclType,
|
||||||
this, 0,
|
this, 0,
|
||||||
true, false, ObjCMethodDecl::Required);
|
true, false, true, ObjCMethodDecl::Required);
|
||||||
property->setGetterMethodDecl(ObjCMethod);
|
property->setGetterMethodDecl(ObjCMethod);
|
||||||
insMethods.push_back(ObjCMethod);
|
insMethods.push_back(ObjCMethod);
|
||||||
}
|
}
|
||||||
|
|
|
@ -636,7 +636,7 @@ void Sema::ImplMethodsVsClassMethods(ObjCImplementationDecl* IMPDecl,
|
||||||
bool IncompleteImpl = false;
|
bool IncompleteImpl = false;
|
||||||
for (ObjCInterfaceDecl::instmeth_iterator I = IDecl->instmeth_begin(),
|
for (ObjCInterfaceDecl::instmeth_iterator I = IDecl->instmeth_begin(),
|
||||||
E = IDecl->instmeth_end(); I != E; ++I)
|
E = IDecl->instmeth_end(); I != E; ++I)
|
||||||
if (!InsMap.count((*I)->getSelector()))
|
if (!(*I)->isSynthesized() && !InsMap.count((*I)->getSelector()))
|
||||||
WarnUndefinedMethod(IMPDecl->getLocation(), *I, IncompleteImpl);
|
WarnUndefinedMethod(IMPDecl->getLocation(), *I, IncompleteImpl);
|
||||||
|
|
||||||
llvm::DenseSet<Selector> ClsMap;
|
llvm::DenseSet<Selector> ClsMap;
|
||||||
|
@ -964,6 +964,7 @@ Sema::DeclTy *Sema::ActOnMethodDeclaration(
|
||||||
ObjCMethodDecl::Create(Context, MethodLoc, EndLoc, Sel, resultDeclType,
|
ObjCMethodDecl::Create(Context, MethodLoc, EndLoc, Sel, resultDeclType,
|
||||||
ClassDecl, AttrList,
|
ClassDecl, AttrList,
|
||||||
MethodType == tok::minus, isVariadic,
|
MethodType == tok::minus, isVariadic,
|
||||||
|
false,
|
||||||
MethodDeclKind == tok::objc_optional ?
|
MethodDeclKind == tok::objc_optional ?
|
||||||
ObjCMethodDecl::Optional :
|
ObjCMethodDecl::Optional :
|
||||||
ObjCMethodDecl::Required);
|
ObjCMethodDecl::Required);
|
||||||
|
|
Loading…
Reference in New Issue