mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
- strings for types that are template parameters
- a class template partial specialization is now also considered a specialization in general - fix collecting of content assist results to allow overloaded functions - implement the names for specializations - update CollectDeclarations/references to handle template parameters - use internal interace during CPPvisitor.getDeclarations to improve open declaration on template stuff
This commit is contained in:
parent
15c8faed14
commit
220206d7e9
8 changed files with 88 additions and 106 deletions
|
@ -18,6 +18,7 @@ import org.eclipse.cdt.core.dom.ast.c.ICQualifierType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPBasicType;
|
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPBasicType;
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPPointerType;
|
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPPointerType;
|
||||||
|
@ -204,9 +205,9 @@ public class ASTTypeUtil {
|
||||||
} else if (type instanceof ICPPReferenceType) {
|
} else if (type instanceof ICPPReferenceType) {
|
||||||
result.append(Keywords.cpAMPER);
|
result.append(Keywords.cpAMPER);
|
||||||
} else if (type instanceof ICPPTemplateTypeParameter) {
|
} else if (type instanceof ICPPTemplateTypeParameter) {
|
||||||
try {
|
result.append(((ICPPTemplateTypeParameter)type).getName());
|
||||||
result.append(getType(((ICPPTemplateTypeParameter)type).getDefault()));
|
} else if (type instanceof ICPPTemplateTemplateParameter) {
|
||||||
} catch (DOMException e) {}
|
result.append(((ICPPTemplateTemplateParameter)type).getName());
|
||||||
} else if (type instanceof IEnumeration) {
|
} else if (type instanceof IEnumeration) {
|
||||||
result.append(Keywords.ENUM);
|
result.append(Keywords.ENUM);
|
||||||
result.append(SPACE);
|
result.append(SPACE);
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class CharTable extends HashTable {
|
||||||
|
|
||||||
return keyTable[ idx ];
|
return keyTable[ idx ];
|
||||||
}
|
}
|
||||||
protected int lookup(char[] buffer ){
|
public int lookup(char[] buffer ){
|
||||||
return lookup(buffer, 0, buffer.length);
|
return lookup(buffer, 0, buffer.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IField;
|
import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
@ -119,8 +118,7 @@ public class CPPClassInstance extends CPPInstance implements ICPPClassType, ICPP
|
||||||
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getKey()
|
* @see org.eclipse.cdt.core.dom.ast.ICompositeType#getKey()
|
||||||
*/
|
*/
|
||||||
public int getKey() throws DOMException {
|
public int getKey() throws DOMException {
|
||||||
// TODO Auto-generated method stub
|
return ((ICPPClassType)getSpecializedBinding()).getKey();
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -133,30 +131,6 @@ public class CPPClassInstance extends CPPInstance implements ICPPClassType, ICPP
|
||||||
return instanceScope;
|
return instanceScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#getQualifiedName()
|
|
||||||
*/
|
|
||||||
public String[] getQualifiedName() throws DOMException {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#getQualifiedNameCharArray()
|
|
||||||
*/
|
|
||||||
public char[][] getQualifiedNameCharArray() throws DOMException {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#isGloballyQualified()
|
|
||||||
*/
|
|
||||||
public boolean isGloballyQualified() throws DOMException {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see java.lang.Object#clone()
|
* @see java.lang.Object#clone()
|
||||||
*/
|
*/
|
||||||
|
@ -165,21 +139,6 @@ public class CPPClassInstance extends CPPInstance implements ICPPClassType, ICPP
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#getDeclarations()
|
|
||||||
*/
|
|
||||||
public IASTNode[] getDeclarations() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#getDefinition()
|
|
||||||
*/
|
|
||||||
public IASTNode getDefinition() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
|
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#createDelegate(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
*/
|
*/
|
||||||
|
@ -187,12 +146,6 @@ public class CPPClassInstance extends CPPInstance implements ICPPClassType, ICPP
|
||||||
return new CPPClassType.CPPClassTypeDelegate( name, this );
|
return new CPPClassType.CPPClassTypeDelegate( name, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding#addDefinition(org.eclipse.cdt.core.dom.ast.IASTNode)
|
|
||||||
*/
|
|
||||||
public void addDefinition(IASTNode node) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
|
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.eclipse.cdt.core.parser.util.ObjectMap;
|
||||||
* @author aniefer
|
* @author aniefer
|
||||||
*/
|
*/
|
||||||
public class CPPClassTemplatePartialSpecialization extends CPPClassTemplate implements
|
public class CPPClassTemplatePartialSpecialization extends CPPClassTemplate implements
|
||||||
ICPPClassTemplatePartialSpecialization {
|
ICPPClassTemplatePartialSpecialization, ICPPSpecialization {
|
||||||
|
|
||||||
private IType [] arguments;
|
private IType [] arguments;
|
||||||
/**
|
/**
|
||||||
|
@ -99,4 +99,8 @@ public class CPPClassTemplatePartialSpecialization extends CPPClassTemplate impl
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IBinding getSpecializedBinding() {
|
||||||
|
return getPrimaryClassTemplate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBasicType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
|
||||||
|
@ -776,23 +775,24 @@ public class CPPSemantics {
|
||||||
objs = ArrayUtil.trim( Object.class, (Object[]) source );
|
objs = ArrayUtil.trim( Object.class, (Object[]) source );
|
||||||
|
|
||||||
int size = map != null ? map.size() : objs.length;
|
int size = map != null ? map.size() : objs.length;
|
||||||
|
int resultInitialSize = resultMap.size();
|
||||||
for( int i = 0; i < size; i ++ ) {
|
for( int i = 0; i < size; i ++ ) {
|
||||||
char [] key = ( map != null ) ? map.keyAt(i)
|
char [] key = ( map != null ) ? map.keyAt(i)
|
||||||
: ( objs[i] instanceof IBinding) ? ((IBinding)objs[i]).getNameCharArray()
|
: ( objs[i] instanceof IBinding) ? ((IBinding)objs[i]).getNameCharArray()
|
||||||
: ((IASTName)objs[i]).toCharArray();
|
: ((IASTName)objs[i]).toCharArray();
|
||||||
if( !resultMap.containsKey( key ) ){
|
int idx = resultMap.lookup( key );
|
||||||
|
if( idx == -1 ){
|
||||||
resultMap.put( key, (map != null ) ? map.get( key ) : objs[i] );
|
resultMap.put( key, (map != null ) ? map.get( key ) : objs[i] );
|
||||||
} else if( !scoped ) {
|
} else if( !scoped || idx >= resultInitialSize ) {
|
||||||
Object obj = resultMap.get( key );
|
Object obj = resultMap.get( key );
|
||||||
Object so = ( map != null ) ? map.get(key) : objs[i];
|
Object so = ( map != null ) ? map.get(key) : objs[i];
|
||||||
if( obj instanceof Object [] ) {
|
if( obj instanceof Object [] ) {
|
||||||
if( so instanceof IBinding )
|
if( so instanceof IBinding || so instanceof IASTName )
|
||||||
obj = ArrayUtil.append( Object.class, (Object[]) obj, so );
|
obj = ArrayUtil.append( Object.class, (Object[]) obj, so );
|
||||||
else
|
else
|
||||||
obj = ArrayUtil.addAll( Object.class, (Object[])obj, (Object[]) so );
|
obj = ArrayUtil.addAll( Object.class, (Object[])obj, (Object[]) so );
|
||||||
} else {
|
} else {
|
||||||
if( so instanceof IBinding )
|
if( so instanceof IBinding || so instanceof IASTName )
|
||||||
obj = new Object [] { obj, so };
|
obj = new Object [] { obj, so };
|
||||||
else {
|
else {
|
||||||
Object [] temp = new Object [ ((Object[])so).length + 1 ];
|
Object [] temp = new Object [ ((Object[])so).length + 1 ];
|
||||||
|
@ -800,6 +800,7 @@ public class CPPSemantics {
|
||||||
obj = ArrayUtil.addAll( Object.class, temp, (Object[]) so );
|
obj = ArrayUtil.addAll( Object.class, temp, (Object[]) so );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
resultMap.put( key, obj );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1675,8 +1676,8 @@ public class CPPSemantics {
|
||||||
(type instanceof ICPPDelegate && ((ICPPDelegate)type).getBinding() == temp) )
|
(type instanceof ICPPDelegate && ((ICPPDelegate)type).getBinding() == temp) )
|
||||||
{
|
{
|
||||||
//ok, delegates are synonyms
|
//ok, delegates are synonyms
|
||||||
} else if( type instanceof ICPPClassTemplate && temp instanceof ICPPClassTemplatePartialSpecialization &&
|
} else if( type instanceof ICPPClassTemplate && temp instanceof ICPPSpecialization &&
|
||||||
((ICPPClassTemplatePartialSpecialization)temp).getPrimaryClassTemplate() == type )
|
((ICPPSpecialization)temp).getSpecializedBinding() == type )
|
||||||
{
|
{
|
||||||
//ok, stay with the template, the specialization, if applicable, will come out during instantiation
|
//ok, stay with the template, the specialization, if applicable, will come out during instantiation
|
||||||
} else if( type != temp ) {
|
} else if( type != temp ) {
|
||||||
|
@ -2834,25 +2835,22 @@ public class CPPSemantics {
|
||||||
obj = map.get( key );
|
obj = map.get( key );
|
||||||
if( obj instanceof IBinding )
|
if( obj instanceof IBinding )
|
||||||
result = (IBinding[]) ArrayUtil.append( IBinding.class, result, obj );
|
result = (IBinding[]) ArrayUtil.append( IBinding.class, result, obj );
|
||||||
else {
|
else if( obj instanceof IASTName ) {
|
||||||
Object item = null;
|
IBinding binding = ((IASTName) obj).resolveBinding();
|
||||||
if( obj instanceof Object[] ){
|
if( binding != null && !(binding instanceof IProblemBinding))
|
||||||
Object[] objs = (Object[]) obj;
|
result = (IBinding[]) ArrayUtil.append( IBinding.class, result, binding );
|
||||||
if( objs.length > 1 && objs[1] != null )
|
} else if( obj instanceof Object [] ) {
|
||||||
continue;
|
Object[] objs = (Object[]) obj;
|
||||||
item = objs[0];
|
for (int j = 0; j < objs.length && objs[j] != null; j++) {
|
||||||
} else {
|
Object item = objs[j];
|
||||||
item = obj;
|
if( item instanceof IBinding )
|
||||||
}
|
result = (IBinding[]) ArrayUtil.append( IBinding.class, result, item );
|
||||||
|
else if( item instanceof IASTName ) {
|
||||||
if( item instanceof IBinding )
|
IBinding binding = ((IASTName) item).resolveBinding();
|
||||||
result = (IBinding[]) ArrayUtil.append( IBinding.class, result, item );
|
if( binding != null && !(binding instanceof IProblemBinding))
|
||||||
else {
|
result = (IBinding[]) ArrayUtil.append( IBinding.class, result, binding );
|
||||||
IBinding binding = ((IASTName) item).resolveBinding();
|
}
|
||||||
if( binding != null && !(binding instanceof IProblemBinding))
|
}
|
||||||
result = (IBinding[]) ArrayUtil.append( IBinding.class, result, binding );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,27 +95,22 @@ public abstract class CPPSpecialization implements ICPPSpecialization, ICPPInter
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
// TODO Auto-generated method stub
|
return specialized.getName();
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
public char[] getNameCharArray() {
|
public char[] getNameCharArray() {
|
||||||
// TODO Auto-generated method stub
|
return specialized.getNameCharArray();
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
public IScope getScope() {
|
public IScope getScope() {
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
public String[] getQualifiedName() throws DOMException {
|
public String[] getQualifiedName() {
|
||||||
// TODO Auto-generated method stub
|
return CPPVisitor.getQualifiedName( this );
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
public char[][] getQualifiedNameCharArray() throws DOMException {
|
public char[][] getQualifiedNameCharArray() {
|
||||||
// TODO Auto-generated method stub
|
return CPPVisitor.getQualifiedNameCharArray( this );
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
public boolean isGloballyQualified() throws DOMException {
|
public boolean isGloballyQualified() throws DOMException {
|
||||||
// TODO Auto-generated method stub
|
return ((ICPPInternalBinding)specialized).isGloballyQualified();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,10 +93,12 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTPointerToMember;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTReferenceOperator;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTReferenceOperator;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleDeclSpecifier;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateSpecialization;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateSpecialization;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplatedTypeTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypeIdExpression;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypeIdExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypenameExpression;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypenameExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDeclaration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDeclaration;
|
||||||
|
@ -115,7 +117,9 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
|
||||||
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.ICPPScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateNonTypeParameter;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
|
||||||
|
@ -974,6 +978,7 @@ public class CPPVisitor {
|
||||||
private static final int KIND_TYPE = 3;
|
private static final int KIND_TYPE = 3;
|
||||||
private static final int KIND_NAMESPACE = 4;
|
private static final int KIND_NAMESPACE = 4;
|
||||||
private static final int KIND_COMPOSITE = 5;
|
private static final int KIND_COMPOSITE = 5;
|
||||||
|
private static final int KIND_TEMPLATE_PARAMETER = 6;
|
||||||
|
|
||||||
|
|
||||||
public CollectDeclarationsAction( IBinding binding ){
|
public CollectDeclarationsAction( IBinding binding ){
|
||||||
|
@ -994,6 +999,8 @@ public class CPPVisitor {
|
||||||
}
|
}
|
||||||
else if( binding instanceof ICPPUsingDeclaration )
|
else if( binding instanceof ICPPUsingDeclaration )
|
||||||
kind = KIND_COMPOSITE;
|
kind = KIND_COMPOSITE;
|
||||||
|
else if( binding instanceof ICPPTemplateParameter )
|
||||||
|
kind = KIND_TEMPLATE_PARAMETER;
|
||||||
else
|
else
|
||||||
kind = KIND_OBJ_FN;
|
kind = KIND_OBJ_FN;
|
||||||
}
|
}
|
||||||
|
@ -1006,6 +1013,18 @@ public class CPPVisitor {
|
||||||
prop = name.getParent().getPropertyInParent();
|
prop = name.getParent().getPropertyInParent();
|
||||||
|
|
||||||
switch( kind ){
|
switch( kind ){
|
||||||
|
case KIND_TEMPLATE_PARAMETER:
|
||||||
|
if( prop == ICPPASTSimpleTypeTemplateParameter.PARAMETER_NAME ||
|
||||||
|
prop == ICPPASTTemplatedTypeTemplateParameter.PARAMETER_NAME )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
} else if( prop == IASTDeclarator.DECLARATOR_NAME ){
|
||||||
|
IASTNode d = name.getParent().getParent();
|
||||||
|
if( d.getPropertyInParent() == IASTParameterDeclaration.DECLARATOR ){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PROCESS_CONTINUE;
|
||||||
case KIND_LABEL:
|
case KIND_LABEL:
|
||||||
if( prop == IASTLabelStatement.NAME )
|
if( prop == IASTLabelStatement.NAME )
|
||||||
break;
|
break;
|
||||||
|
@ -1149,7 +1168,8 @@ public class CPPVisitor {
|
||||||
}
|
}
|
||||||
else if( binding instanceof ICPPNamespace) {
|
else if( binding instanceof ICPPNamespace) {
|
||||||
kind = KIND_NAMESPACE;
|
kind = KIND_NAMESPACE;
|
||||||
} else if( binding instanceof ICPPUsingDeclaration )
|
} else if( binding instanceof ICPPUsingDeclaration ||
|
||||||
|
binding instanceof ICPPTemplateParameter )
|
||||||
kind = KIND_COMPOSITE;
|
kind = KIND_COMPOSITE;
|
||||||
else
|
else
|
||||||
kind = KIND_OBJ_FN;
|
kind = KIND_OBJ_FN;
|
||||||
|
@ -1200,7 +1220,8 @@ public class CPPVisitor {
|
||||||
prop == IASTFunctionCallExpression.FUNCTION_NAME ||
|
prop == IASTFunctionCallExpression.FUNCTION_NAME ||
|
||||||
prop == ICPPASTUsingDeclaration.NAME ||
|
prop == ICPPASTUsingDeclaration.NAME ||
|
||||||
prop == IASTNamedTypeSpecifier.NAME ||
|
prop == IASTNamedTypeSpecifier.NAME ||
|
||||||
prop == ICPPASTConstructorChainInitializer.MEMBER_ID)
|
prop == ICPPASTConstructorChainInitializer.MEMBER_ID ||
|
||||||
|
prop == ICPPASTTemplateId.TEMPLATE_ID_ARGUMENT )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1736,7 +1757,27 @@ public class CPPVisitor {
|
||||||
public static IASTName[] getDeclarations( IASTTranslationUnit tu, IBinding binding ){
|
public static IASTName[] getDeclarations( IASTTranslationUnit tu, IBinding binding ){
|
||||||
CollectDeclarationsAction action = new CollectDeclarationsAction( binding );
|
CollectDeclarationsAction action = new CollectDeclarationsAction( binding );
|
||||||
tu.accept( action );
|
tu.accept( action );
|
||||||
return action.getDeclarations();
|
|
||||||
|
IASTName [] found = action.getDeclarations();
|
||||||
|
if( found.length == 0 && binding instanceof ICPPSpecialization && binding instanceof ICPPInternalBinding ){
|
||||||
|
IASTNode node = ((ICPPInternalBinding)binding).getDefinition();
|
||||||
|
if( node == null ){
|
||||||
|
IASTNode [] nds = ((ICPPInternalBinding)binding).getDeclarations();
|
||||||
|
if( nds != null && nds.length > 0 )
|
||||||
|
node = nds[0];
|
||||||
|
}
|
||||||
|
if( node != null ){
|
||||||
|
IASTName name = null;
|
||||||
|
if( node instanceof IASTDeclarator )
|
||||||
|
name = ((IASTDeclarator)node).getName();
|
||||||
|
else if( node instanceof IASTName )
|
||||||
|
name = (IASTName) node;
|
||||||
|
if( name != null )
|
||||||
|
found = new IASTName[] { name };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String [] getQualifiedName( IBinding binding ){
|
public static String [] getQualifiedName( IBinding binding ){
|
||||||
|
|
|
@ -41,7 +41,6 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
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.ICPPTemplateInstance;
|
|
||||||
import org.eclipse.cdt.core.filetype.ICFileType;
|
import org.eclipse.cdt.core.filetype.ICFileType;
|
||||||
import org.eclipse.cdt.core.filetype.ICFileTypeConstants;
|
import org.eclipse.cdt.core.filetype.ICFileTypeConstants;
|
||||||
import org.eclipse.cdt.core.parser.ParseError;
|
import org.eclipse.cdt.core.parser.ParseError;
|
||||||
|
@ -49,7 +48,6 @@ import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
import org.eclipse.cdt.core.search.ICSearchConstants.LimitTo;
|
import org.eclipse.cdt.core.search.ICSearchConstants.LimitTo;
|
||||||
import org.eclipse.cdt.core.search.ICSearchConstants.SearchFor;
|
import org.eclipse.cdt.core.search.ICSearchConstants.SearchFor;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPImplicitMethod;
|
|
||||||
import org.eclipse.cdt.internal.core.search.matching.CSearchPattern;
|
import org.eclipse.cdt.internal.core.search.matching.CSearchPattern;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
@ -351,15 +349,7 @@ public class DOMSearchUtil {
|
||||||
IBinding binding = searchName.resolveBinding();
|
IBinding binding = searchName.resolveBinding();
|
||||||
names = getNames(tu, binding, limitTo);
|
names = getNames(tu, binding, limitTo);
|
||||||
|
|
||||||
if (names == null || names.length == 0) { // try alternate strategies
|
if (names == null || names.length == 0) { // try alternate strategies
|
||||||
// fix for 92632
|
|
||||||
if (binding instanceof ICPPTemplateInstance) {
|
|
||||||
if (((ICPPTemplateInstance)binding).getTemplateDefinition() != null) {
|
|
||||||
binding = ((ICPPTemplateInstance)binding).getTemplateDefinition();
|
|
||||||
names = getNames(tu, binding, limitTo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// fix for 86829
|
// fix for 86829
|
||||||
try {
|
try {
|
||||||
if (binding instanceof ICPPConstructor && binding.getScope() instanceof ICPPClassScope) {
|
if (binding instanceof ICPPConstructor && binding.getScope() instanceof ICPPClassScope) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue