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
|
||||
ICPPPointerToMemberType spm = (ICPPPointerToMemberType) s;
|
||||
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 );
|
||||
cost.rank = ( temp > -1 ) ? Cost.CONVERSION_RANK : Cost.NO_MATCH_RANK;
|
||||
cost.conversion = ( temp > -1 ) ? temp : 0;
|
||||
|
|
|
@ -205,11 +205,15 @@ public class PDOMFile implements IIndexFragmentFile {
|
|||
}
|
||||
}
|
||||
|
||||
private PDOMName createPDOMName(IASTName name, PDOMName caller) throws CoreException {
|
||||
private PDOMName createPDOMName(IASTName name, PDOMName caller) {
|
||||
PDOMName result= null;
|
||||
PDOMBinding binding= ((WritablePDOM) pdom).addBinding(name);
|
||||
if (binding != null) {
|
||||
result= new PDOMName(pdom, name, this, binding, caller);
|
||||
try {
|
||||
PDOMBinding binding = ((WritablePDOM) pdom).addBinding(name);
|
||||
if (binding != null) {
|
||||
result= new PDOMName(pdom, name, this, binding, caller);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
CCorePlugin.log(e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -325,13 +329,12 @@ public class PDOMFile implements IIndexFragmentFile {
|
|||
}
|
||||
|
||||
public static IIndexFragmentFile findFile(PDOM pdom, BTree btree, IIndexFileLocation location, IIndexLocationConverter strategy)
|
||||
throws CoreException {
|
||||
throws CoreException {
|
||||
Finder finder = new Finder(pdom.getDB(), location, strategy);
|
||||
btree.accept(finder);
|
||||
int record = finder.getRecord();
|
||||
return record != 0 ? new PDOMFile(pdom, record) : null;
|
||||
}
|
||||
|
||||
private static class Finder implements IBTreeVisitor {
|
||||
private final Database db;
|
||||
private final String rawKey;
|
||||
|
@ -353,7 +356,7 @@ public class PDOMFile implements IIndexFragmentFile {
|
|||
this.record = record;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public int getRecord() {
|
||||
return record;
|
||||
}
|
||||
|
|
|
@ -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.ICPPNamespaceAlias;
|
||||
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.ICPPVariable;
|
||||
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)
|
||||
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);
|
||||
try {
|
||||
if (pdomBinding == null) {
|
||||
|
@ -140,16 +156,6 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -397,21 +403,25 @@ public class PDOMCPPLinkage extends PDOMLinkage {
|
|||
}
|
||||
|
||||
public PDOMNode addType(PDOMNode parent, IType type) throws CoreException {
|
||||
if (type instanceof IProblemBinding) {
|
||||
return null;
|
||||
}
|
||||
if (type instanceof ICPPBasicType) {
|
||||
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) {
|
||||
PDOMBinding binding= adaptBinding((IEnumeration) type);
|
||||
if (binding != null) {
|
||||
return binding;
|
||||
}
|
||||
} else if (type instanceof ICPPPointerToMemberType) {
|
||||
}
|
||||
if (type instanceof ICPPClassType) {
|
||||
return addBinding((ICPPClassType) type);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue