mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-11 10:15:39 +02:00
Fix for PR 93786: DOM Indexer adds local variables to the index
Other smaller fixes in DOM Indexer domain.
This commit is contained in:
parent
072e9d936e
commit
30084a7e84
4 changed files with 104 additions and 68 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2005-06-03 Vladimir Hirsl
|
||||||
|
Fix for PR 93786: DOM Indexer adds local variables to the index
|
||||||
|
Other smaller fixes in DOM Indexer domain.
|
||||||
|
|
||||||
|
* index/org/eclipse/cdt/internal/core/index/domsourceindexer/CGenerateIndexVisitor.java
|
||||||
|
* index/org/eclipse/cdt/internal/core/index/domsourceindexer/CPPGenerateIndexVisitor.java
|
||||||
|
* index/org/eclipse/cdt/internal/core/index/domsourceindexer/IndexVisitorUtil.java
|
||||||
|
|
||||||
2005-06-01 Vladimir Hirsl
|
2005-06-01 Vladimir Hirsl
|
||||||
Modified DOM indexer to use IIndexEntry hierarchy to store index entries.
|
Modified DOM indexer to use IIndexEntry hierarchy to store index entries.
|
||||||
This enables more information to be stored during indexing (modifiers, function sigantures,...)
|
This enables more information to be stored during indexing (modifiers, function sigantures,...)
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.index.domsourceindexer;
|
package org.eclipse.cdt.internal.core.index.domsourceindexer;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.ICLogConstants;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
|
||||||
|
@ -24,6 +25,7 @@ import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
|
||||||
|
@ -31,6 +33,7 @@ import org.eclipse.cdt.internal.core.index.FunctionEntry;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndex;
|
import org.eclipse.cdt.internal.core.index.IIndex;
|
||||||
import org.eclipse.cdt.internal.core.index.NamedEntry;
|
import org.eclipse.cdt.internal.core.index.NamedEntry;
|
||||||
import org.eclipse.cdt.internal.core.index.TypeEntry;
|
import org.eclipse.cdt.internal.core.index.TypeEntry;
|
||||||
|
import org.eclipse.cdt.internal.core.model.Util;
|
||||||
|
|
||||||
public class CGenerateIndexVisitor extends CASTVisitor {
|
public class CGenerateIndexVisitor extends CASTVisitor {
|
||||||
private DOMSourceIndexerRunner indexer;
|
private DOMSourceIndexerRunner indexer;
|
||||||
|
@ -70,6 +73,11 @@ public class CGenerateIndexVisitor extends CASTVisitor {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
// TODO remove
|
||||||
|
e.printStackTrace();
|
||||||
|
Util.log(e, e.toString(), ICLogConstants.CDT);
|
||||||
|
}
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +103,8 @@ public class CGenerateIndexVisitor extends CASTVisitor {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IBinding binding = name.resolveBinding();
|
IBinding binding = name.resolveBinding();
|
||||||
|
if (binding == null) return;
|
||||||
|
|
||||||
// check for IProblemBinding
|
// check for IProblemBinding
|
||||||
if (binding instanceof IProblemBinding) {
|
if (binding instanceof IProblemBinding) {
|
||||||
IProblemBinding problem = (IProblemBinding) binding;
|
IProblemBinding problem = (IProblemBinding) binding;
|
||||||
|
@ -126,8 +136,8 @@ public class CGenerateIndexVisitor extends CASTVisitor {
|
||||||
*/
|
*/
|
||||||
private void processNameBinding(IASTName name, IBinding binding, IASTFileLocation loc, int fileNumber) throws DOMException {
|
private void processNameBinding(IASTName name, IBinding binding, IASTFileLocation loc, int fileNumber) throws DOMException {
|
||||||
char[][] qualifiedName = getFullyQualifiedName(name);
|
char[][] qualifiedName = getFullyQualifiedName(name);
|
||||||
IASTFileLocation fileLoc = IndexEncoderUtil.getFileLocation(name);
|
if (qualifiedName == null)
|
||||||
|
return;
|
||||||
// determine entryKind
|
// determine entryKind
|
||||||
int entryKind = IIndex.UNKNOWN;
|
int entryKind = IIndex.UNKNOWN;
|
||||||
if (name.isDefinition()){
|
if (name.isDefinition()){
|
||||||
|
@ -139,6 +149,9 @@ public class CGenerateIndexVisitor extends CASTVisitor {
|
||||||
else if (name.isReference()) {
|
else if (name.isReference()) {
|
||||||
entryKind = IIndex.REFERENCE;
|
entryKind = IIndex.REFERENCE;
|
||||||
}
|
}
|
||||||
|
else return;
|
||||||
|
|
||||||
|
IASTFileLocation fileLoc = IndexEncoderUtil.getFileLocation(name);
|
||||||
|
|
||||||
// determine type
|
// determine type
|
||||||
if (binding instanceof ICompositeType) {
|
if (binding instanceof ICompositeType) {
|
||||||
|
@ -198,8 +211,11 @@ public class CGenerateIndexVisitor extends CASTVisitor {
|
||||||
|
|
||||||
indexEntry.serialize(indexer.getOutput());
|
indexEntry.serialize(indexer.getOutput());
|
||||||
}
|
}
|
||||||
else if (binding instanceof IParameter ||
|
else if (binding instanceof IVariable &&
|
||||||
binding instanceof IVariable) {
|
!(binding instanceof IParameter)) {
|
||||||
|
// exclude local variables
|
||||||
|
IScope definingScope = binding.getScope();
|
||||||
|
if (definingScope == name.getTranslationUnit().getScope()) {
|
||||||
int modifiers = 0;
|
int modifiers = 0;
|
||||||
if (entryKind != IIndex.REFERENCE) {
|
if (entryKind != IIndex.REFERENCE) {
|
||||||
modifiers = IndexVisitorUtil.getModifiers(name, binding);
|
modifiers = IndexVisitorUtil.getModifiers(name, binding);
|
||||||
|
@ -209,6 +225,7 @@ public class CGenerateIndexVisitor extends CASTVisitor {
|
||||||
|
|
||||||
indexEntry.serialize(indexer.getOutput());
|
indexEntry.serialize(indexer.getOutput());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (binding instanceof IFunction) {
|
else if (binding instanceof IFunction) {
|
||||||
int modifiers = 0;
|
int modifiers = 0;
|
||||||
if (entryKind != IIndex.REFERENCE) {
|
if (entryKind != IIndex.REFERENCE) {
|
||||||
|
@ -217,6 +234,7 @@ public class CGenerateIndexVisitor extends CASTVisitor {
|
||||||
FunctionEntry indexEntry = new FunctionEntry(IIndex.FUNCTION, entryKind, qualifiedName, modifiers, fileNumber);
|
FunctionEntry indexEntry = new FunctionEntry(IIndex.FUNCTION, entryKind, qualifiedName, modifiers, fileNumber);
|
||||||
indexEntry.setNameOffset(fileLoc.getNodeOffset(), fileLoc.getNodeLength(), IIndex.OFFSET);
|
indexEntry.setNameOffset(fileLoc.getNodeOffset(), fileLoc.getNodeLength(), IIndex.OFFSET);
|
||||||
indexEntry.setSignature(IndexVisitorUtil.getParameters((IFunction) binding));
|
indexEntry.setSignature(IndexVisitorUtil.getParameters((IFunction) binding));
|
||||||
|
indexEntry.setReturnType(IndexVisitorUtil.getReturnType((IFunction) binding));
|
||||||
|
|
||||||
indexEntry.serialize(indexer.getOutput());
|
indexEntry.serialize(indexer.getOutput());
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core.index.domsourceindexer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.ICLogConstants;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||||
|
@ -31,6 +32,7 @@ import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
||||||
|
@ -39,6 +41,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
|
||||||
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.ICPPBase;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBase;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
|
||||||
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.ICPPDelegate;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPDelegate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||||
|
@ -50,6 +53,7 @@ import org.eclipse.cdt.internal.core.index.IIndex;
|
||||||
import org.eclipse.cdt.internal.core.index.IIndexEntry;
|
import org.eclipse.cdt.internal.core.index.IIndexEntry;
|
||||||
import org.eclipse.cdt.internal.core.index.NamedEntry;
|
import org.eclipse.cdt.internal.core.index.NamedEntry;
|
||||||
import org.eclipse.cdt.internal.core.index.TypeEntry;
|
import org.eclipse.cdt.internal.core.index.TypeEntry;
|
||||||
|
import org.eclipse.cdt.internal.core.model.Util;
|
||||||
|
|
||||||
public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
||||||
private DOMSourceIndexerRunner indexer;
|
private DOMSourceIndexerRunner indexer;
|
||||||
|
@ -92,6 +96,11 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
// TODO remove
|
||||||
|
e.printStackTrace();
|
||||||
|
Util.log(e, e.toString(), ICLogConstants.CDT);
|
||||||
|
}
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +126,8 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IBinding binding = name.resolveBinding();
|
IBinding binding = name.resolveBinding();
|
||||||
|
if (binding == null) return;
|
||||||
|
|
||||||
// check for IProblemBinding
|
// check for IProblemBinding
|
||||||
if (binding instanceof IProblemBinding) {
|
if (binding instanceof IProblemBinding) {
|
||||||
IProblemBinding problem = (IProblemBinding) binding;
|
IProblemBinding problem = (IProblemBinding) binding;
|
||||||
|
@ -149,8 +160,8 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
||||||
*/
|
*/
|
||||||
private void processNameBinding(IASTName name, IBinding binding, IASTFileLocation loc, int fileNumber, int entryKind) throws DOMException {
|
private void processNameBinding(IASTName name, IBinding binding, IASTFileLocation loc, int fileNumber, int entryKind) throws DOMException {
|
||||||
char[][] qualifiedName = getFullyQualifiedName(binding);
|
char[][] qualifiedName = getFullyQualifiedName(binding);
|
||||||
IASTFileLocation fileLoc = IndexEncoderUtil.getFileLocation(name);
|
if (qualifiedName == null)
|
||||||
|
return;
|
||||||
// determine entryKind
|
// determine entryKind
|
||||||
if (entryKind == IIndex.UNKNOWN) {
|
if (entryKind == IIndex.UNKNOWN) {
|
||||||
if (name.isDefinition()){
|
if (name.isDefinition()){
|
||||||
|
@ -162,8 +173,11 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
||||||
else if (name.isReference()) {
|
else if (name.isReference()) {
|
||||||
entryKind = IIndex.REFERENCE;
|
entryKind = IIndex.REFERENCE;
|
||||||
}
|
}
|
||||||
|
else return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IASTFileLocation fileLoc = IndexEncoderUtil.getFileLocation(name);
|
||||||
|
|
||||||
// determine type
|
// determine type
|
||||||
if (binding instanceof ICompositeType) {
|
if (binding instanceof ICompositeType) {
|
||||||
int iEntryType = 0;
|
int iEntryType = 0;
|
||||||
|
@ -241,8 +255,11 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
||||||
|
|
||||||
indexEntry.serialize(indexer.getOutput());
|
indexEntry.serialize(indexer.getOutput());
|
||||||
}
|
}
|
||||||
else if (binding instanceof IParameter ||
|
else if (binding instanceof IVariable &&
|
||||||
binding instanceof IVariable) {
|
!(binding instanceof IParameter)) {
|
||||||
|
// exclude local variables
|
||||||
|
IScope definingScope = binding.getScope();
|
||||||
|
if (!(definingScope instanceof ICPPBlockScope)) {
|
||||||
int modifiers = 0;
|
int modifiers = 0;
|
||||||
if (entryKind != IIndex.REFERENCE) {
|
if (entryKind != IIndex.REFERENCE) {
|
||||||
modifiers = IndexVisitorUtil.getModifiers(name, binding);
|
modifiers = IndexVisitorUtil.getModifiers(name, binding);
|
||||||
|
@ -252,6 +269,7 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
||||||
|
|
||||||
indexEntry.serialize(indexer.getOutput());
|
indexEntry.serialize(indexer.getOutput());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (binding instanceof ICPPMethod) {
|
else if (binding instanceof ICPPMethod) {
|
||||||
int modifiers = 0;
|
int modifiers = 0;
|
||||||
if (entryKind != IIndex.REFERENCE) {
|
if (entryKind != IIndex.REFERENCE) {
|
||||||
|
@ -276,6 +294,7 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
||||||
FunctionEntry indexEntry = new FunctionEntry(IIndex.FUNCTION, entryKind, qualifiedName, modifiers, fileNumber);
|
FunctionEntry indexEntry = new FunctionEntry(IIndex.FUNCTION, entryKind, qualifiedName, modifiers, fileNumber);
|
||||||
indexEntry.setNameOffset(fileLoc.getNodeOffset(), fileLoc.getNodeLength(), IIndex.OFFSET);
|
indexEntry.setNameOffset(fileLoc.getNodeOffset(), fileLoc.getNodeLength(), IIndex.OFFSET);
|
||||||
indexEntry.setSignature(IndexVisitorUtil.getParameters((IFunction) binding));
|
indexEntry.setSignature(IndexVisitorUtil.getParameters((IFunction) binding));
|
||||||
|
indexEntry.setReturnType(IndexVisitorUtil.getReturnType((IFunction) binding));
|
||||||
|
|
||||||
indexEntry.serialize(indexer.getOutput());
|
indexEntry.serialize(indexer.getOutput());
|
||||||
// TODO In case we want to add friend function declarations to index
|
// TODO In case we want to add friend function declarations to index
|
||||||
|
@ -318,6 +337,9 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
||||||
for (int i = 0; i < baseClasses.length; i++) {
|
for (int i = 0; i < baseClasses.length; i++) {
|
||||||
ICPPBase base = baseClasses[i];
|
ICPPBase base = baseClasses[i];
|
||||||
ICPPClassType baseClass = baseClasses[i].getBaseClass();
|
ICPPClassType baseClass = baseClasses[i].getBaseClass();
|
||||||
|
// skip problem bindings
|
||||||
|
if (baseClass instanceof IProblemBinding)
|
||||||
|
continue;
|
||||||
int modifiers = 0;
|
int modifiers = 0;
|
||||||
int vis = base.getVisibility();
|
int vis = base.getVisibility();
|
||||||
if (vis == ICPPBase.v_public) {
|
if (vis == ICPPBase.v_public) {
|
||||||
|
@ -366,9 +388,6 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
||||||
* @param fileNumber
|
* @param fileNumber
|
||||||
*/
|
*/
|
||||||
private void addFriendDeclarations(IASTName name, ICPPClassType cppClassBinding, TypeEntry typeEntry, int fileNumber) {
|
private void addFriendDeclarations(IASTName name, ICPPClassType cppClassBinding, TypeEntry typeEntry, int fileNumber) {
|
||||||
try {
|
|
||||||
IBinding[] friends = cppClassBinding.getFriends();
|
|
||||||
if (friends.length > 0) {
|
|
||||||
IASTNode parent = name.getParent();
|
IASTNode parent = name.getParent();
|
||||||
if (parent instanceof ICPPASTCompositeTypeSpecifier) {
|
if (parent instanceof ICPPASTCompositeTypeSpecifier) {
|
||||||
ICPPASTCompositeTypeSpecifier parentClass = (ICPPASTCompositeTypeSpecifier) parent;
|
ICPPASTCompositeTypeSpecifier parentClass = (ICPPASTCompositeTypeSpecifier) parent;
|
||||||
|
@ -381,13 +400,11 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
||||||
IASTDeclSpecifier declSpec = simplDecl.getDeclSpecifier();
|
IASTDeclSpecifier declSpec = simplDecl.getDeclSpecifier();
|
||||||
if (declSpec instanceof ICPPASTElaboratedTypeSpecifier) {
|
if (declSpec instanceof ICPPASTElaboratedTypeSpecifier) {
|
||||||
ICPPASTElaboratedTypeSpecifier elabTypeSpec = (ICPPASTElaboratedTypeSpecifier) declSpec;
|
ICPPASTElaboratedTypeSpecifier elabTypeSpec = (ICPPASTElaboratedTypeSpecifier) declSpec;
|
||||||
// sanity check
|
|
||||||
if (elabTypeSpec.isFriend()) {
|
if (elabTypeSpec.isFriend()) {
|
||||||
IASTName friendName = elabTypeSpec.getName();
|
IASTName friendName = elabTypeSpec.getName();
|
||||||
|
|
||||||
for (int i = 0; i < friends.length; i++) {
|
IBinding friend = friendName.resolveBinding();
|
||||||
IBinding friend = friends[i];
|
if (friend != null && !(friend instanceof IProblemBinding)) {
|
||||||
if (friend.equals(friendName.resolveBinding())) {
|
|
||||||
int modifiers = IndexVisitorUtil.getModifiers(friendName, friend);
|
int modifiers = IndexVisitorUtil.getModifiers(friendName, friend);
|
||||||
|
|
||||||
NamedEntry namedEntry = new NamedEntry(IIndex.TYPE_FRIEND, IIndex.DECLARATION,
|
NamedEntry namedEntry = new NamedEntry(IIndex.TYPE_FRIEND, IIndex.DECLARATION,
|
||||||
|
@ -395,8 +412,6 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
||||||
IASTFileLocation fileLoc = IndexEncoderUtil.getFileLocation(friendName);
|
IASTFileLocation fileLoc = IndexEncoderUtil.getFileLocation(friendName);
|
||||||
namedEntry.setNameOffset(fileLoc.getNodeOffset(), fileLoc.getNodeLength(), IIndex.OFFSET);
|
namedEntry.setNameOffset(fileLoc.getNodeOffset(), fileLoc.getNodeLength(), IIndex.OFFSET);
|
||||||
friendEntries.add(namedEntry);
|
friendEntries.add(namedEntry);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -407,10 +422,6 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (DOMException e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param binding
|
* @param binding
|
||||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core.index.domsourceindexer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
@ -196,14 +197,12 @@ public class IndexVisitorUtil {
|
||||||
}
|
}
|
||||||
//For performance reasons, use internal interface if possible, since we know the
|
//For performance reasons, use internal interface if possible, since we know the
|
||||||
//index is resolving bindings in order.
|
//index is resolving bindings in order.
|
||||||
else if ( (binding instanceof ICPPInternalFunction) ? ((ICPPInternalFunction)functionBinding).isStatic(false)
|
else if ((binding instanceof ICPPInternalFunction) ? ((ICPPInternalFunction)functionBinding).isStatic(false)
|
||||||
: functionBinding.isStatic() )
|
: functionBinding.isStatic()) {
|
||||||
{
|
|
||||||
modifiers |= IIndex.staticSpecifier;
|
modifiers |= IIndex.staticSpecifier;
|
||||||
}
|
}
|
||||||
else if (functionBinding.isInline()) {
|
else if (functionBinding.isInline()) {
|
||||||
|
modifiers |= IIndex.inlineSpecifier;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (functionBinding instanceof ICPPFunction) {
|
if (functionBinding instanceof ICPPFunction) {
|
||||||
ICPPFunction cppFunction = (ICPPFunction) functionBinding;
|
ICPPFunction cppFunction = (ICPPFunction) functionBinding;
|
||||||
|
@ -255,7 +254,7 @@ public class IndexVisitorUtil {
|
||||||
IType[] parameterTypes = functionType.getParameterTypes();
|
IType[] parameterTypes = functionType.getParameterTypes();
|
||||||
for (int i = 0; i < parameterTypes.length; i++) {
|
for (int i = 0; i < parameterTypes.length; i++) {
|
||||||
IType parameterType = parameterTypes[i];
|
IType parameterType = parameterTypes[i];
|
||||||
parameterList.add(parameterType.toString().toCharArray());
|
parameterList.add(ASTTypeUtil.getType(parameterType).toCharArray());
|
||||||
}
|
}
|
||||||
if (parameterList.isEmpty()) {
|
if (parameterList.isEmpty()) {
|
||||||
parameterList.add("void".toCharArray()); //$NON-NLS-1$
|
parameterList.add("void".toCharArray()); //$NON-NLS-1$
|
||||||
|
@ -274,7 +273,7 @@ public class IndexVisitorUtil {
|
||||||
try {
|
try {
|
||||||
IFunctionType functionType = function.getType();
|
IFunctionType functionType = function.getType();
|
||||||
IType returnType = functionType.getReturnType();
|
IType returnType = functionType.getReturnType();
|
||||||
return returnType.toString().toCharArray();
|
return ASTTypeUtil.getType(returnType).toCharArray();
|
||||||
}
|
}
|
||||||
catch (DOMException e) {
|
catch (DOMException e) {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue