mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Fix for NPE in IndexerTypesJob2
Patch for Dave Daoust - change Var encoding in index Test refactoring
This commit is contained in:
parent
71ecce9bed
commit
7026a99e32
15 changed files with 81 additions and 95 deletions
|
@ -172,7 +172,7 @@ public class DOMSourceIndexerTests extends TestCase implements IIndexChangeListe
|
|||
|
||||
suite.addTest(new DOMSourceIndexerTests("testAddNewFileToIndex")); //$NON-NLS-1$
|
||||
suite.addTest(new DOMSourceIndexerTests("testForwardDeclarations")); //$NON-NLS-1$
|
||||
suite.addTest(new FailingTest(new DOMSourceIndexerTests("testIndexAll"))); //$NON-NLS-1$
|
||||
suite.addTest(new DOMSourceIndexerTests("testIndexAll")); //$NON-NLS-1$
|
||||
suite.addTest(new FailingTest(new DOMSourceIndexerTests("testIndexContents"))); //$NON-NLS-1$
|
||||
suite.addTest(new DOMSourceIndexerTests("testMacros")); //$NON-NLS-1$
|
||||
suite.addTest(new FailingTest(new DOMSourceIndexerTests("testRefs"))); //$NON-NLS-1$
|
||||
|
@ -228,26 +228,21 @@ public class DOMSourceIndexerTests extends TestCase implements IIndexChangeListe
|
|||
assertTrue("Entry Results exist", eresults != null); //$NON-NLS-1$
|
||||
|
||||
String [] queryResultModel = {"IndexedFile(1: /IndexerTestProject/mail.cpp)"}; //$NON-NLS-1$
|
||||
String [] entryResultModel ={"EntryResult: word=typeDecl/C/Mail, refs={ 1 }, offsets={ [ 294] }", //$NON-NLS-1$
|
||||
String [] entryResultModel ={"EntryResult: word=typeDefn/C/Mail, refs={ 1 }, offsets={ [ 294] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDefn/C/Unknown, refs={ 1 }, offsets={ [ 2738] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDefn/C/container, refs={ 1 }, offsets={ [ 21084] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDefn/C/first_class, refs={ 1 }, offsets={ [ 2506] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDefn/C/postcard, refs={ 1 }, offsets={ [ 2298] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDefn/V/PO_Box, refs={ 1 }, offsets={ [ 21371] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDefn/V/size, refs={ 1 }, offsets={ [ 21927] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDefn/V/temp, refs={ 1 }, offsets={ [ 21964] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDefn/V/x, refs={ 1 }, offsets={ [ 21201, 21526] }"}; //$NON-NLS-1$
|
||||
};
|
||||
|
||||
String [] entryResultDeclsModel = {
|
||||
"EntryResult: word=typeDecl/D/Mail, refs={ 1 }, offsets={ [ 294] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDecl/D/first_class, refs={ 1 }, offsets={ [ 2506] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDecl/D/postcard, refs={ 1 }, offsets={ [ 2298] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDecl/V/index, refs={ 1 }, offsets={ [ 21303, 21846] }", //$NON-NLS-1$
|
||||
"EntryResult: word=typeDecl/V/mail, refs={ 1 }, offsets={ [ 21336, 21912] }", //$NON-NLS-1$
|
||||
};
|
||||
String[] entryResultNameModel = {"Mail","Unknown","container","first_class","postcard","PO_Box","size","temp","x"};
|
||||
String[] entryResultNameModel = {"Mail","Unknown","container","first_class","postcard"};
|
||||
int[] entryResultMetaModel = {IIndex.TYPE};
|
||||
int[] entryResultTypeModel = {IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR};
|
||||
int[] entryResultTypeModel = {IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS};
|
||||
int[] entryResultRefModel = {IIndex.DEFINITION};
|
||||
|
||||
if (qresults.length != queryResultModel.length)
|
||||
|
@ -386,7 +381,7 @@ public class DOMSourceIndexerTests extends TestCase implements IIndexChangeListe
|
|||
|
||||
String[] entryResultNameModel = {"CDocumentManager","Mail","Unknown","container","first_class","postcard","PO_Box", "size","temp","x"};
|
||||
int[] entryResultMetaModel = {IIndex.TYPE};
|
||||
int[] entryResultTypeModel = {IIndex.TYPE_CLASS, IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR, IIndex.TYPE_VAR};
|
||||
int[] entryResultTypeModel = {IIndex.TYPE_CLASS, IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS,IIndex.TYPE_CLASS, IIndex.TYPE, IIndex.TYPE, IIndex.VAR, IIndex.VAR};
|
||||
int[] entryResultRefModel = {IIndex.DEFINITION};
|
||||
|
||||
if (eresults.length != entryResultNameModel.length)
|
||||
|
@ -449,8 +444,8 @@ public class DOMSourceIndexerTests extends TestCase implements IIndexChangeListe
|
|||
String[] entryResultDefnNameModel = {"Mail/Y/X/Z", "Unknown/Y/X/Z", "container/Y/X/Z", "first_class/Y/X/Z", "postcard/Y/X/Z", "PO_Box", "size", "temp", "x", "x/Z" };
|
||||
int[] entryResultMetaModel = {IIndex.TYPE};
|
||||
int[] entryResultDefnTypeModel = {IIndex.TYPE_CLASS, IIndex.TYPE_CLASS, IIndex.TYPE_CLASS, IIndex.TYPE_CLASS, IIndex.TYPE_CLASS,
|
||||
IIndex.TYPE_VAR,IIndex.TYPE_VAR,IIndex.TYPE_VAR,IIndex.TYPE_VAR,IIndex.TYPE_VAR};
|
||||
int[] entryResultDeclTypeModel = {IIndex.TYPE_DERIVED, IIndex.TYPE_DERIVED, IIndex.TYPE_DERIVED, IIndex.TYPE_ENUM, IIndex.TYPE_TYPEDEF,IIndex.TYPE_VAR,IIndex.TYPE_VAR};
|
||||
IIndex.VAR,IIndex.VAR,IIndex.VAR,IIndex.VAR,IIndex.VAR};
|
||||
int[] entryResultDeclTypeModel = {IIndex.TYPE_DERIVED, IIndex.TYPE_DERIVED, IIndex.TYPE_DERIVED, IIndex.TYPE_ENUM, IIndex.TYPE_TYPEDEF,IIndex.VAR,IIndex.VAR};
|
||||
|
||||
|
||||
IEntryResult[] typedeclresults =ind.getEntries(IIndex.TYPE, IIndex.ANY, IIndex.DECLARATION);
|
||||
|
@ -593,7 +588,7 @@ public class DOMSourceIndexerTests extends TestCase implements IIndexChangeListe
|
|||
|
||||
String[] entryResultNameModel = {"C/B/A","ForwardA/A", "e1/B/A", "x/B/A"};
|
||||
int[] entryResultMetaModel = {IIndex.TYPE};
|
||||
int[] entryResultTypeModel = {IIndex.TYPE_CLASS, IIndex.TYPE_CLASS, IIndex.TYPE_ENUM, IIndex.TYPE_VAR};
|
||||
int[] entryResultTypeModel = {IIndex.TYPE_CLASS, IIndex.TYPE_CLASS, IIndex.TYPE_ENUM, IIndex.VAR};
|
||||
int[] entryResultRefModel = {IIndex.REFERENCE};
|
||||
|
||||
|
||||
|
|
|
@ -65,16 +65,16 @@ public class OtherPatternTests extends BaseSearchTest {
|
|||
assertTrue( pattern instanceof FieldDeclarationPattern );
|
||||
|
||||
FieldDeclarationPattern variablePattern = (FieldDeclarationPattern)pattern;
|
||||
assertEquals( getSearchPattern(IIndex.TYPE, IIndex.TYPE_VAR, IIndex.DECLARATION, "c"), variablePattern.indexEntryPrefix() ); //$NON-NLS-1$
|
||||
assertEquals( getSearchPattern(IIndex.VAR, IIndex.ANY, IIndex.DECLARATION, "c"), variablePattern.indexEntryPrefix() ); //$NON-NLS-1$
|
||||
|
||||
variablePattern = (FieldDeclarationPattern) SearchEngine.createSearchPattern( "rt*", VAR, DECLARATIONS, true ); //$NON-NLS-1$
|
||||
assertEquals( getSearchPattern(IIndex.TYPE, IIndex.TYPE_VAR, IIndex.DECLARATION, "rt"), variablePattern.indexEntryPrefix() ); //$NON-NLS-1$
|
||||
assertEquals( getSearchPattern(IIndex.VAR, IIndex.ANY, IIndex.DECLARATION, "rt"), variablePattern.indexEntryPrefix() ); //$NON-NLS-1$
|
||||
|
||||
variablePattern = (FieldDeclarationPattern) SearchEngine.createSearchPattern( "Ac", VAR, REFERENCES, false ); //$NON-NLS-1$
|
||||
assertEquals( getSearchPattern(IIndex.TYPE, IIndex.TYPE_VAR, IIndex.REFERENCE, ""), variablePattern.indexEntryPrefix() ); //$NON-NLS-1$
|
||||
assertEquals( getSearchPattern(IIndex.VAR, IIndex.ANY, IIndex.REFERENCE, ""), variablePattern.indexEntryPrefix() ); //$NON-NLS-1$
|
||||
|
||||
variablePattern = (FieldDeclarationPattern) SearchEngine.createSearchPattern( "A?c", VAR, REFERENCES, true ); //$NON-NLS-1$
|
||||
assertEquals( getSearchPattern(IIndex.TYPE, IIndex.TYPE_VAR, IIndex.REFERENCE, "A"), variablePattern.indexEntryPrefix() ); //$NON-NLS-1$
|
||||
assertEquals( getSearchPattern(IIndex.VAR, IIndex.ANY, IIndex.REFERENCE, "A"), variablePattern.indexEntryPrefix() ); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public void testFieldIndexPrefix(){
|
||||
|
|
|
@ -107,23 +107,25 @@ public class IndexerTypesJob2 extends IndexerJob2 {
|
|||
}
|
||||
|
||||
IEntryResult[] typeEntries = fProjectIndex.getEntries( IIndex.TYPE, IIndex.TYPE_DERIVED, IIndex.ANY );
|
||||
for( int j = 0; j < typeEntries.length; ++j )
|
||||
{
|
||||
if (monitor.isCanceled())
|
||||
throw new InterruptedException();
|
||||
|
||||
IEntryResult entry = typeEntries[j];
|
||||
String name = entry.extractSimpleName();
|
||||
switch( entry.getKind() )
|
||||
{
|
||||
case IIndex.TYPE_DERIVED :
|
||||
if (name.length() != 0) { // skip anonymous structs
|
||||
addSuperTypeReference(entry, name, entry.getEnclosingNames(), monitor);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (typeEntries != null){
|
||||
for( int j = 0; j < typeEntries.length; ++j )
|
||||
{
|
||||
if (monitor.isCanceled())
|
||||
throw new InterruptedException();
|
||||
|
||||
IEntryResult entry = typeEntries[j];
|
||||
String name = entry.extractSimpleName();
|
||||
switch( entry.getKind() )
|
||||
{
|
||||
case IIndex.TYPE_DERIVED :
|
||||
if (name.length() != 0) { // skip anonymous structs
|
||||
addSuperTypeReference(entry, name, entry.getEnclosingNames(), monitor);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,16 +41,16 @@ public interface IIndex {
|
|||
final static int NAMESPACE = 6;
|
||||
final static int ENUMTOR = 7;
|
||||
final static int INCLUDE = 8;
|
||||
final static int VAR = 9;
|
||||
|
||||
// kind
|
||||
final static int TYPE_CLASS = 1;
|
||||
final static int TYPE_STRUCT = 2;
|
||||
final static int TYPE_UNION = 3;
|
||||
final static int TYPE_ENUM = 4;
|
||||
final static int TYPE_VAR = 5;
|
||||
final static int TYPE_TYPEDEF = 6;
|
||||
final static int TYPE_DERIVED = 7;
|
||||
final static int TYPE_FRIEND = 8;
|
||||
final static int TYPE_TYPEDEF = 5;
|
||||
final static int TYPE_DERIVED = 6;
|
||||
final static int TYPE_FRIEND = 7;
|
||||
|
||||
|
||||
// type
|
||||
|
|
|
@ -26,19 +26,6 @@ public interface ICIndexStorageConstants {
|
|||
|
||||
final public static char SEPARATOR= '/';
|
||||
|
||||
// TODO: Remove these constants.
|
||||
static final public char CLASS_SUFFIX = 'C'; // CLASS
|
||||
static final public char DERIVED_SUFFIX = 'D'; // DERIVED
|
||||
static final public char ENUM_SUFFIX = 'E'; // ENUM
|
||||
static final public char FRIEND_SUFFIX = 'F'; // FRIEND
|
||||
static final public char FWD_CLASS_SUFFIX = 'G'; // FWD_CLASS
|
||||
static final public char FWD_STRUCT_SUFFIX = 'H'; // FWD_STRUCT
|
||||
static final public char FWD_UNION_SUFFIX = 'I'; // FWD_UNION
|
||||
static final public char STRUCT_SUFFIX = 'S'; // STRUCT
|
||||
static final public char TYPEDEF_SUFFIX = 'T'; // TYPEDEF
|
||||
static final public char UNION_SUFFIX = 'U'; // UNION
|
||||
static final public char VAR_SUFFIX = 'V'; // VAR
|
||||
|
||||
final static char [][] encodings = {
|
||||
"".toCharArray(), // not used //$NON-NLS-1$
|
||||
"type".toCharArray(), // TYPES //$NON-NLS-1$
|
||||
|
@ -48,7 +35,8 @@ public interface ICIndexStorageConstants {
|
|||
"macro".toCharArray(), // MACROS //$NON-NLS-1$
|
||||
"namespace".toCharArray(), // NAMESPACES //$NON-NLS-1$
|
||||
"enumtor".toCharArray(), // ENUMERATORS //$NON-NLS-1$
|
||||
"include" .toCharArray() // INCLUDES //$NON-NLS-1$
|
||||
"include" .toCharArray(), // INCLUDES //$NON-NLS-1$
|
||||
"variable" .toCharArray() // VARIABLE //$NON-NLS-1$
|
||||
};
|
||||
|
||||
final static char [][] encodingTypes = {
|
||||
|
@ -62,8 +50,7 @@ public interface ICIndexStorageConstants {
|
|||
'C', // CLASS
|
||||
'S', // STRUCT
|
||||
'U', // UNION
|
||||
'E', // ENUM
|
||||
'V', // VAR
|
||||
'E', // ENUM
|
||||
'T', // TYPEDEF
|
||||
'D', // DERIVED
|
||||
'F' // FRIEND
|
||||
|
@ -74,7 +61,6 @@ public interface ICIndexStorageConstants {
|
|||
"Struct", //$NON-NLS-1$
|
||||
"Union", //$NON-NLS-1$
|
||||
"Enum", //$NON-NLS-1$
|
||||
"Variable", //$NON-NLS-1$
|
||||
"Typedef", //$NON-NLS-1$
|
||||
"Derived", //$NON-NLS-1$
|
||||
"Friend", //$NON-NLS-1$
|
||||
|
|
|
@ -488,19 +488,19 @@ public class Index implements IIndex, ICIndexStorageConstants, ICSearchConstants
|
|||
char classType = 0;
|
||||
|
||||
if( searchFor == ICSearchConstants.CLASS ){
|
||||
classType = CLASS_SUFFIX;
|
||||
classType = typeConstants[IIndex.TYPE_CLASS];
|
||||
} else if ( searchFor == ICSearchConstants.STRUCT ){
|
||||
classType = STRUCT_SUFFIX;
|
||||
classType = typeConstants[IIndex.TYPE_STRUCT];
|
||||
} else if ( searchFor == ICSearchConstants.UNION ){
|
||||
classType = UNION_SUFFIX;
|
||||
classType = typeConstants[IIndex.TYPE_UNION];
|
||||
} else if ( searchFor == ICSearchConstants.ENUM ){
|
||||
classType = ENUM_SUFFIX;
|
||||
classType = typeConstants[IIndex.TYPE_ENUM];
|
||||
} else if ( searchFor == ICSearchConstants.TYPEDEF ){
|
||||
classType = TYPEDEF_SUFFIX;
|
||||
classType = typeConstants[IIndex.TYPE_TYPEDEF];
|
||||
} else if ( searchFor == ICSearchConstants.DERIVED){
|
||||
classType = DERIVED_SUFFIX;
|
||||
classType = typeConstants[IIndex.TYPE_DERIVED];
|
||||
} else if ( searchFor == ICSearchConstants.FRIEND){
|
||||
classType = FRIEND_SUFFIX;
|
||||
classType = typeConstants[IIndex.TYPE_FRIEND];
|
||||
} else {
|
||||
//could be TYPE or CLASS_STRUCT, best we can do for these is the prefix
|
||||
return prefix;
|
||||
|
@ -525,16 +525,16 @@ public class Index implements IIndex, ICIndexStorageConstants, ICSearchConstants
|
|||
public static final char[] bestVariablePrefix( LimitTo limitTo, char[] varName, char[][] containingTypes, int matchMode, boolean isCaseSenstive ){
|
||||
char [] prefix = null;
|
||||
if( limitTo == REFERENCES ){
|
||||
prefix = encodeEntry(IIndex.TYPE, ANY, REFERENCE);
|
||||
prefix = encodeEntry(IIndex.VAR, ANY, REFERENCE);
|
||||
} else if( limitTo == DECLARATIONS ){
|
||||
prefix = encodeEntry(IIndex.TYPE, ANY, DECLARATION);
|
||||
prefix = encodeEntry(IIndex.VAR, ANY, DECLARATION);
|
||||
} else if( limitTo == DEFINITIONS ){
|
||||
prefix = encodeEntry(IIndex.TYPE, ANY, DEFINITION);
|
||||
prefix = encodeEntry(IIndex.VAR, ANY, DEFINITION);
|
||||
} else {
|
||||
return encodeEntry(IIndex.TYPE, ANY, ANY);
|
||||
return encodeEntry(IIndex.VAR, ANY, ANY);
|
||||
}
|
||||
|
||||
return bestPrefix( prefix, VAR_SUFFIX, varName, containingTypes, matchMode, isCaseSenstive );
|
||||
return bestPrefix( prefix, (char)0, varName, containingTypes, matchMode, isCaseSenstive );
|
||||
}
|
||||
|
||||
public static final char[] bestFieldPrefix( LimitTo limitTo, char[] fieldName,char[][] containingTypes, int matchMode, boolean isCaseSensitive) {
|
||||
|
|
|
@ -167,7 +167,12 @@ public class IndexerOutput implements ICIndexStorageConstants, IIndexerOutput {
|
|||
}
|
||||
//char[] has to be of size - [type length + length of the name (including qualifiers) +
|
||||
//separators (need one less than fully qualified name length)
|
||||
try {
|
||||
pos = encodings[meta_kind].length + encodingTypes[ref].length;
|
||||
}
|
||||
catch (ArrayIndexOutOfBoundsException x) {
|
||||
throw x;
|
||||
}
|
||||
char[] result = new char[pos + nameLength + elementName.length - 1 ];
|
||||
System.arraycopy(encodings[meta_kind], 0, result, 0, encodings[meta_kind].length);
|
||||
System.arraycopy(encodingTypes[ref], 0, result, encodings[meta_kind].length, encodingTypes[ref].length);
|
||||
|
@ -226,7 +231,7 @@ public class IndexerOutput implements ICIndexStorageConstants, IIndexerOutput {
|
|||
baseClasses.length > 0){
|
||||
for (int i=0; i<baseClasses.length; i++){
|
||||
char[][] baseName= ((INamedEntry) baseClasses[i]).getFullName();
|
||||
addRef(indexedFileNumber, baseName, ICIndexStorageConstants.DERIVED_SUFFIX, IIndex.DECLARATION, nameOffset,nameOffsetLength, nameOffsetType, 1);
|
||||
addRef(indexedFileNumber, baseName, ICIndexStorageConstants.typeConstants[IIndex.TYPE_DERIVED], IIndex.DECLARATION, nameOffset,nameOffsetLength, nameOffsetType, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,16 +200,16 @@ class CTagEntry{
|
|||
typeEntry.setNameOffset(lineNumber, 1, IIndex.LINE);
|
||||
typeEntry.serialize(output);
|
||||
} else if (kind.equals(CTagsConsoleParser.VARIABLE)){
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_VAR,IIndex.DECLARATION, fullName, getModifiers(), fileNum);
|
||||
typeEntry.setNameOffset(lineNumber, 1, IIndex.LINE);
|
||||
typeEntry.serialize(output);
|
||||
NamedEntry namedEntry = new NamedEntry(IIndex.VAR,IIndex.DECLARATION, fullName, getModifiers(), fileNum);
|
||||
namedEntry.setNameOffset(lineNumber, 1, IIndex.LINE);
|
||||
namedEntry.serialize(output);
|
||||
} else if (kind.equals(CTagsConsoleParser.EXTERNALVAR)){
|
||||
//Have to specifically set external bit flag in modifier;
|
||||
int modifiers = getModifiers();
|
||||
modifiers |= 1 << 6;
|
||||
TypeEntry typeEntry = new TypeEntry(IIndex.TYPE_VAR,IIndex.DECLARATION, fullName, modifiers, fileNum);
|
||||
typeEntry.setNameOffset(lineNumber, 1, IIndex.LINE);
|
||||
typeEntry.serialize(output);
|
||||
NamedEntry namedEntry = new NamedEntry(IIndex.VAR,IIndex.DECLARATION, fullName, modifiers, fileNum);
|
||||
namedEntry.setNameOffset(lineNumber, 1, IIndex.LINE);
|
||||
namedEntry.serialize(output);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ public class CGenerateIndexVisitor extends CASTVisitor {
|
|||
if (entryKind != IIndex.REFERENCE) {
|
||||
modifiers = IndexVisitorUtil.getModifiers(name, binding);
|
||||
}
|
||||
TypeEntry indexEntry = new TypeEntry(IIndex.TYPE_VAR, entryKind, qualifiedName, modifiers, fileNumber);
|
||||
NamedEntry indexEntry = new NamedEntry(IIndex.VAR, entryKind, qualifiedName, modifiers, fileNumber);
|
||||
indexEntry.setNameOffset(fileLoc.getNodeOffset(), fileLoc.getNodeLength(), IIndex.OFFSET);
|
||||
|
||||
indexEntry.serialize(indexer.getOutput());
|
||||
|
|
|
@ -284,7 +284,7 @@ public class CPPGenerateIndexVisitor extends CPPASTVisitor {
|
|||
if (entryKind != IIndex.REFERENCE) {
|
||||
modifiers = IndexVisitorUtil.getModifiers(name, binding);
|
||||
}
|
||||
TypeEntry indexEntry = new TypeEntry(IIndex.TYPE_VAR, entryKind, qualifiedName, modifiers, fileNumber);
|
||||
NamedEntry indexEntry = new NamedEntry(IIndex.VAR, entryKind, qualifiedName, modifiers, fileNumber);
|
||||
indexEntry.setNameOffset(fileLoc.getNodeOffset(), fileLoc.getNodeLength(), IIndex.OFFSET);
|
||||
|
||||
serialize(indexEntry);
|
||||
|
|
|
@ -114,9 +114,9 @@ class IndexerOutputWrapper {
|
|||
typeEntry.serialize(indexerOutput);
|
||||
break;
|
||||
case VAR_CONST:
|
||||
typeEntry = new TypeEntry(IIndex.TYPE_VAR ,entryKind, name, 0 /*getModifiers()*/, fileNumber);
|
||||
typeEntry.setNameOffset(offset, length, offsetType);
|
||||
typeEntry.serialize(indexerOutput);
|
||||
namedEntry = new TypeEntry(IIndex.VAR ,entryKind, name, 0 /*getModifiers()*/, fileNumber);
|
||||
namedEntry.setNameOffset(offset, length, offsetType);
|
||||
namedEntry.serialize(indexerOutput);
|
||||
break;
|
||||
case TYPEDEF_CONST:
|
||||
typeEntry = new TypeEntry(IIndex.TYPE_TYPEDEF, entryKind, name, 0 /*getModifiers()*/, fileNumber);
|
||||
|
|
|
@ -254,10 +254,6 @@ public class ClassDeclarationPattern extends CSearchPattern {
|
|||
if( searchFor == TYPEDEF && decodedType != IIndex.TYPE_TYPEDEF ){
|
||||
return false;
|
||||
}
|
||||
//don't match variable entries
|
||||
if( decodedType == IIndex.TYPE_VAR ){
|
||||
return false;
|
||||
}
|
||||
} else if( classKind == ASTClassKind.CLASS ) {
|
||||
if( decodedType != IIndex.TYPE_CLASS ){
|
||||
return false;
|
||||
|
|
|
@ -124,7 +124,7 @@ public class FilterIndexerViewDialog extends Dialog {
|
|||
{IIndex.TYPE, IIndex.ANY, IIndex.REFERENCE},
|
||||
{IIndex.TYPE, IIndex.TYPE_TYPEDEF, IIndex.DECLARATION},
|
||||
{IIndex.TYPE, IIndex.TYPE_CLASS, IIndex.DECLARATION},
|
||||
{IIndex.TYPE, IIndex.TYPE_VAR, IIndex.DECLARATION},
|
||||
{IIndex.VAR, IIndex.ANY, IIndex.DECLARATION},
|
||||
{IIndex.TYPE, IIndex.TYPE_STRUCT, IIndex.DECLARATION},
|
||||
{IIndex.TYPE, IIndex.TYPE_ENUM, IIndex.DECLARATION},
|
||||
{IIndex.TYPE, IIndex.TYPE_UNION, IIndex.DECLARATION},
|
||||
|
|
|
@ -583,6 +583,7 @@ public class IndexerView extends ViewPart {
|
|||
case IIndex.NAMESPACE : return FilterIndexerViewDialog.ENTRY_NAMESPACE_REF;
|
||||
case IIndex.ENUMTOR : return FilterIndexerViewDialog.ENTRY_ENUMTOR_REF;
|
||||
case IIndex.INCLUDE : return FilterIndexerViewDialog.ENTRY_INCLUDE_REF;
|
||||
case IIndex.VAR : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_VAR;
|
||||
}
|
||||
break;
|
||||
case IIndex.DEFINITION :
|
||||
|
@ -594,7 +595,6 @@ public class IndexerView extends ViewPart {
|
|||
case IIndex.TYPE_STRUCT : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_STRUCT;
|
||||
case IIndex.TYPE_UNION : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_UNION;
|
||||
case IIndex.TYPE_ENUM : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_ENUM;
|
||||
case IIndex.TYPE_VAR : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_VAR;
|
||||
case IIndex.TYPE_TYPEDEF : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_TYPEDEF;
|
||||
case IIndex.TYPE_DERIVED : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_DERIVED;
|
||||
case IIndex.TYPE_FRIEND : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_FRIEND;
|
||||
|
@ -606,6 +606,7 @@ public class IndexerView extends ViewPart {
|
|||
case IIndex.NAMESPACE : return FilterIndexerViewDialog.ENTRY_NAMESPACE_DECL;
|
||||
case IIndex.ENUMTOR : return FilterIndexerViewDialog.ENTRY_ENUMTOR_DECL;
|
||||
case IIndex.INCLUDE : return -1;
|
||||
case IIndex.VAR : return FilterIndexerViewDialog.ENTRY_TYPE_DECL_VAR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -450,6 +450,8 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
|
|||
}else {
|
||||
orPattern.addPattern(SearchEngine.createSearchPattern( searchPrefix,
|
||||
ICSearchConstants.TYPE, ICSearchConstants.DECLARATIONS, false ));
|
||||
orPattern.addPattern(SearchEngine.createSearchPattern( searchPrefix,
|
||||
ICSearchConstants.TYPE, ICSearchConstants.DEFINITIONS, false ));
|
||||
}
|
||||
IStructure structure = (IStructure) fCElement;
|
||||
orPattern.addPattern(SearchEngine.createSearchPattern( searchPrefix + QUALIFIER + structure.getElementName(),
|
||||
|
@ -494,9 +496,7 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
|
|||
ICSearchConstants.METHOD, ICSearchConstants.ALL_OCCURRENCES, false ));
|
||||
}else {
|
||||
orPattern.addPattern(SearchEngine.createSearchPattern( searchPrefix,
|
||||
ICSearchConstants.FUNCTION, ICSearchConstants.DEFINITIONS, false ));
|
||||
orPattern.addPattern(SearchEngine.createSearchPattern( searchPrefix,
|
||||
ICSearchConstants.METHOD, ICSearchConstants.DEFINITIONS, false ));
|
||||
ICSearchConstants.FUNCTION, ICSearchConstants.DECLARATIONS_DEFINITIONS, false ));
|
||||
}
|
||||
}
|
||||
else if(fCElement instanceof IFunctionDeclaration){
|
||||
|
@ -514,7 +514,7 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
|
|||
ICSearchConstants.ENUM, ICSearchConstants.ALL_OCCURRENCES, false ));
|
||||
}else {
|
||||
orPattern.addPattern(SearchEngine.createSearchPattern( searchPrefix,
|
||||
ICSearchConstants.ENUM, ICSearchConstants.DECLARATIONS, false ));
|
||||
ICSearchConstants.ENUM, ICSearchConstants.DECLARATIONS_DEFINITIONS, false ));
|
||||
}
|
||||
}
|
||||
else if(fCElement instanceof IEnumerator){
|
||||
|
@ -523,7 +523,7 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
|
|||
ICSearchConstants.ENUMTOR, ICSearchConstants.ALL_OCCURRENCES, false ));
|
||||
}else {
|
||||
orPattern.addPattern(SearchEngine.createSearchPattern( searchPrefix,
|
||||
ICSearchConstants.ENUMTOR, ICSearchConstants.DECLARATIONS, false ));
|
||||
ICSearchConstants.ENUMTOR, ICSearchConstants.DECLARATIONS_DEFINITIONS, false ));
|
||||
}
|
||||
}
|
||||
else if(fCElement instanceof IField){
|
||||
|
@ -532,7 +532,7 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
|
|||
ICSearchConstants.FIELD, ICSearchConstants.ALL_OCCURRENCES, false ));
|
||||
}else {
|
||||
orPattern.addPattern(SearchEngine.createSearchPattern( searchPrefix,
|
||||
ICSearchConstants.FIELD, ICSearchConstants.DECLARATIONS, false ));
|
||||
ICSearchConstants.FIELD, ICSearchConstants.DECLARATIONS_DEFINITIONS, false ));
|
||||
}
|
||||
}
|
||||
else if(fCElement instanceof IVariable){
|
||||
|
@ -541,7 +541,7 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
|
|||
ICSearchConstants.VAR, ICSearchConstants.ALL_OCCURRENCES, false ));
|
||||
}else {
|
||||
orPattern.addPattern(SearchEngine.createSearchPattern( searchPrefix,
|
||||
ICSearchConstants.VAR, ICSearchConstants.DECLARATIONS, false ));
|
||||
ICSearchConstants.VAR, ICSearchConstants.DECLARATIONS_DEFINITIONS, false ));
|
||||
}
|
||||
}
|
||||
else if(fCElement instanceof INamespace){
|
||||
|
@ -550,7 +550,7 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
|
|||
ICSearchConstants.NAMESPACE, ICSearchConstants.ALL_OCCURRENCES, false ));
|
||||
}else {
|
||||
orPattern.addPattern(SearchEngine.createSearchPattern( searchPrefix,
|
||||
ICSearchConstants.NAMESPACE, ICSearchConstants.DECLARATIONS, false ));
|
||||
ICSearchConstants.NAMESPACE, ICSearchConstants.DECLARATIONS_DEFINITIONS, false ));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -559,7 +559,8 @@ public class RenameElementProcessor extends RenameProcessor implements IReferenc
|
|||
ICSearchConstants.UNKNOWN_SEARCH_FOR, ICSearchConstants.ALL_OCCURRENCES, false ));
|
||||
}else {
|
||||
orPattern.addPattern(SearchEngine.createSearchPattern( searchPrefix,
|
||||
ICSearchConstants.UNKNOWN_SEARCH_FOR, ICSearchConstants.DECLARATIONS, false ));
|
||||
ICSearchConstants.UNKNOWN_SEARCH_FOR, ICSearchConstants.DECLARATIONS, false ));
|
||||
|
||||
}
|
||||
}
|
||||
return orPattern;
|
||||
|
|
Loading…
Add table
Reference in a new issue