mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for 166954, proper adding of subtypes to index.
This commit is contained in:
parent
0e4828878f
commit
2e2a574918
3 changed files with 46 additions and 31 deletions
|
@ -3113,7 +3113,9 @@ public class CPPSemantics {
|
||||||
//derived class of B
|
//derived class of B
|
||||||
ICPPPointerToMemberType spm = (ICPPPointerToMemberType) s;
|
ICPPPointerToMemberType spm = (ICPPPointerToMemberType) s;
|
||||||
ICPPPointerToMemberType tpm = (ICPPPointerToMemberType) t;
|
ICPPPointerToMemberType tpm = (ICPPPointerToMemberType) t;
|
||||||
if( spm.getType().isSameType( tpm.getType() ) ){
|
IType st = spm.getType();
|
||||||
|
IType tt = tpm.getType();
|
||||||
|
if( st != null && tt != null && st.isSameType( tt ) ){
|
||||||
temp = hasBaseClass( tpm.getMemberOfClass(), spm.getMemberOfClass(), false );
|
temp = hasBaseClass( tpm.getMemberOfClass(), spm.getMemberOfClass(), false );
|
||||||
cost.rank = ( temp > -1 ) ? Cost.CONVERSION_RANK : Cost.NO_MATCH_RANK;
|
cost.rank = ( temp > -1 ) ? Cost.CONVERSION_RANK : Cost.NO_MATCH_RANK;
|
||||||
cost.conversion = ( temp > -1 ) ? temp : 0;
|
cost.conversion = ( temp > -1 ) ? temp : 0;
|
||||||
|
|
|
@ -205,12 +205,16 @@ public class PDOMFile implements IIndexFragmentFile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private PDOMName createPDOMName(IASTName name, PDOMName caller) throws CoreException {
|
private PDOMName createPDOMName(IASTName name, PDOMName caller) {
|
||||||
PDOMName result= null;
|
PDOMName result= null;
|
||||||
PDOMBinding binding= ((WritablePDOM) pdom).addBinding(name);
|
try {
|
||||||
|
PDOMBinding binding = ((WritablePDOM) pdom).addBinding(name);
|
||||||
if (binding != null) {
|
if (binding != null) {
|
||||||
result= new PDOMName(pdom, name, this, binding, caller);
|
result= new PDOMName(pdom, name, this, binding, caller);
|
||||||
}
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,7 +335,6 @@ public class PDOMFile implements IIndexFragmentFile {
|
||||||
int record = finder.getRecord();
|
int record = finder.getRecord();
|
||||||
return record != 0 ? new PDOMFile(pdom, record) : null;
|
return record != 0 ? new PDOMFile(pdom, record) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Finder implements IBTreeVisitor {
|
private static class Finder implements IBTreeVisitor {
|
||||||
private final Database db;
|
private final Database db;
|
||||||
private final String rawKey;
|
private final String rawKey;
|
||||||
|
|
|
@ -44,6 +44,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||||
|
@ -128,6 +129,21 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
// Skip parameters (TODO and others I'm sure)
|
// Skip parameters (TODO and others I'm sure)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
PDOMBinding pdomBinding = addBinding(binding);
|
||||||
|
if (pdomBinding instanceof PDOMCPPClassType) {
|
||||||
|
PDOMCPPClassType pdomClassType= (PDOMCPPClassType) pdomBinding;
|
||||||
|
IASTNode baseNode= name.getParent();
|
||||||
|
if (baseNode instanceof ICPPASTBaseSpecifier)
|
||||||
|
addBaseClasses(pdomClassType, (ICPPASTBaseSpecifier) baseNode);
|
||||||
|
|
||||||
|
if (binding instanceof ICPPClassType && name.isDefinition()) {
|
||||||
|
addImplicitMethods(pdomClassType, (ICPPClassType) binding);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pdomBinding;
|
||||||
|
}
|
||||||
|
|
||||||
|
private PDOMBinding addBinding(IBinding binding) throws CoreException {
|
||||||
PDOMBinding pdomBinding = adaptBinding(binding);
|
PDOMBinding pdomBinding = adaptBinding(binding);
|
||||||
try {
|
try {
|
||||||
if (pdomBinding == null) {
|
if (pdomBinding == null) {
|
||||||
|
@ -140,16 +156,6 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
throw new CoreException(Util.createStatus(e));
|
throw new CoreException(Util.createStatus(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pdomBinding instanceof PDOMCPPClassType) {
|
|
||||||
PDOMCPPClassType pdomClassType= (PDOMCPPClassType) pdomBinding;
|
|
||||||
IASTNode baseNode= name.getParent();
|
|
||||||
if (baseNode instanceof ICPPASTBaseSpecifier)
|
|
||||||
addBaseClasses(pdomClassType, (ICPPASTBaseSpecifier) baseNode);
|
|
||||||
|
|
||||||
if (binding instanceof ICPPClassType && name.isDefinition()) {
|
|
||||||
addImplicitMethods(pdomClassType, (ICPPClassType) binding);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return pdomBinding;
|
return pdomBinding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,21 +403,25 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMNode addType(PDOMNode parent, IType type) throws CoreException {
|
public PDOMNode addType(PDOMNode parent, IType type) throws CoreException {
|
||||||
|
if (type instanceof IProblemBinding) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (type instanceof ICPPBasicType) {
|
if (type instanceof ICPPBasicType) {
|
||||||
return new PDOMCPPBasicType(pdom, parent, (ICPPBasicType)type);
|
return new PDOMCPPBasicType(pdom, parent, (ICPPBasicType)type);
|
||||||
} else if (type instanceof ICPPClassType) {
|
|
||||||
// aftodo: please review, the binding may be nested in a namespace bug 162011
|
|
||||||
// it might be necessary to create the binding for the class here.
|
|
||||||
PDOMBinding binding= adaptBinding((ICPPClassType) type);
|
|
||||||
if (binding != null) {
|
|
||||||
return binding;
|
|
||||||
}
|
}
|
||||||
} else if(type instanceof IEnumeration) {
|
if (type instanceof ICPPClassType) {
|
||||||
PDOMBinding binding= adaptBinding((IEnumeration) type);
|
return addBinding((ICPPClassType) type);
|
||||||
if (binding != null) {
|
|
||||||
return binding;
|
|
||||||
}
|
}
|
||||||
} else if (type instanceof ICPPPointerToMemberType) {
|
if (type instanceof IEnumeration) {
|
||||||
|
return addBinding((IEnumeration) type);
|
||||||
|
}
|
||||||
|
if (type instanceof ITypedef) {
|
||||||
|
return addBinding((ITypedef) type);
|
||||||
|
}
|
||||||
|
if (type instanceof ICPPReferenceType) {
|
||||||
|
return new PDOMCPPReferenceType(pdom, parent, (ICPPReferenceType)type);
|
||||||
|
}
|
||||||
|
if (type instanceof ICPPPointerToMemberType) {
|
||||||
return new PDOMCPPPointerToMemberType(pdom, parent, (ICPPPointerToMemberType)type);
|
return new PDOMCPPPointerToMemberType(pdom, parent, (ICPPPointerToMemberType)type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue