Diag(AtLoc, diag::error_missing_property_context);
return 0;
}
+ if (PropertyIvarLoc.isInvalid())
+ PropertyIvarLoc = PropertyLoc;
ObjCPropertyDecl *property = 0;
ObjCInterfaceDecl* IDecl = 0;
// Find the class or category class where this property must have
}
Ivar = ObjCIvarDecl::Create(Context, ClassImpDecl,
- PropertyLoc, PropertyLoc, PropertyIvar,
+ PropertyIvarLoc,PropertyIvarLoc, PropertyIvar,
PropertyIvarType, /*Dinfo=*/0,
ObjCIvarDecl::Private,
(Expr *)0, true);
PropertyIvarType->getAs<ObjCObjectPointerType>(),
IvarType->getAs<ObjCObjectPointerType>());
else {
- SourceLocation Loc = PropertyIvarLoc;
- if (Loc.isInvalid())
- Loc = PropertyLoc;
- compat = (CheckAssignmentConstraints(Loc, PropertyIvarType, IvarType)
+ compat = (CheckAssignmentConstraints(PropertyIvarLoc, PropertyIvarType,
+ IvarType)
== Compatible);
}
if (!compat) {
if (ObjCMethodDecl *MD = PD->getGetterMethodDecl()) {
if (MD->isSynthesized())
- IndexCtx.handleSynthesizedObjCMethod(MD, D->getLocation());
+ IndexCtx.handleSynthesizedObjCMethod(MD, D->getLocation(),
+ D->getLexicalDeclContext());
}
if (ObjCMethodDecl *MD = PD->getSetterMethodDecl()) {
if (MD->isSynthesized())
- IndexCtx.handleSynthesizedObjCMethod(MD, D->getLocation());
+ IndexCtx.handleSynthesizedObjCMethod(MD, D->getLocation(),
+ D->getLexicalDeclContext());
}
return true;
}
bool IndexingContext::handleDecl(const NamedDecl *D,
SourceLocation Loc, CXCursor Cursor,
- DeclInfo &DInfo) {
+ DeclInfo &DInfo,
+ const DeclContext *LexicalDC) {
if (!CB.indexDeclaration || !D)
return false;
if (D->isImplicit() && shouldIgnoreIfImplicit(D))
|| Loc.isInvalid())
return false;
+ if (!LexicalDC)
+ LexicalDC = D->getLexicalDeclContext();
+
if (shouldSuppressRefs())
markEntityOccurrenceInFile(D, Loc);
getContainerInfo(D->getDeclContext(), DInfo.SemanticContainer);
DInfo.semanticContainer = &DInfo.SemanticContainer;
- if (D->getLexicalDeclContext() == D->getDeclContext()) {
+ if (LexicalDC == D->getDeclContext()) {
DInfo.lexicalContainer = &DInfo.SemanticContainer;
} else if (isTemplateImplicitInstantiation(D)) {
// Implicit instantiations have the lexical context of where they were
// information anyway.
DInfo.lexicalContainer = &DInfo.SemanticContainer;
} else {
- getContainerInfo(D->getLexicalDeclContext(), DInfo.LexicalContainer);
+ getContainerInfo(LexicalDC, DInfo.LexicalContainer);
DInfo.lexicalContainer = &DInfo.LexicalContainer;
}
}
bool IndexingContext::handleSynthesizedObjCMethod(const ObjCMethodDecl *D,
- SourceLocation Loc) {
+ SourceLocation Loc,
+ const DeclContext *LexicalDC) {
DeclInfo DInfo(/*isRedeclaration=*/true, /*isDefinition=*/true,
/*isContainer=*/false);
- return handleDecl(D, Loc, getCursor(D), DInfo);
+ return handleDecl(D, Loc, getCursor(D), DInfo, LexicalDC);
}
bool IndexingContext::handleObjCProperty(const ObjCPropertyDecl *D) {
bool handleObjCMethod(const ObjCMethodDecl *D);
bool handleSynthesizedObjCProperty(const ObjCPropertyImplDecl *D);
- bool handleSynthesizedObjCMethod(const ObjCMethodDecl *D, SourceLocation Loc);
+ bool handleSynthesizedObjCMethod(const ObjCMethodDecl *D, SourceLocation Loc,
+ const DeclContext *LexicalDC);
bool handleObjCProperty(const ObjCPropertyDecl *D);
private:
bool handleDecl(const NamedDecl *D,
SourceLocation Loc, CXCursor Cursor,
- DeclInfo &DInfo);
+ DeclInfo &DInfo,
+ const DeclContext *LexicalDC = 0);
bool handleObjCContainer(const ObjCContainerDecl *D,
SourceLocation Loc, CXCursor Cursor,