From bb4821dee343c3e19b8be790893fc427354fe268 Mon Sep 17 00:00:00 2001 From: John Camelon Date: Fri, 13 Feb 2004 22:03:10 +0000 Subject: [PATCH] Patch for Bogdan Gheorghe In this patch: - Improved error handling for Indexer - Improved error handling for MatchLocator - Bounds checking for mappings in IncudeEntry - Improved error handling for Merge operations - Source file name fitering for recreating an already existing index --- core/org.eclipse.cdt.core/index/ChangeLog | 25 +- .../org/eclipse/cdt/internal/core/Util.java | 6 +- .../core/index/impl/IncludeEntry.java | 6 +- .../core/index/impl/MergeFactory.java | 22 +- .../search/indexing/AddFolderToIndex.java | 7 +- .../core/search/indexing/IndexAllProject.java | 9 +- .../core/search/indexing/SourceIndexer.java | 72 +-- core/org.eclipse.cdt.core/search/ChangeLog | 534 +++++++++--------- .../core/search/matching/MatchLocator.java | 19 +- 9 files changed, 373 insertions(+), 327 deletions(-) diff --git a/core/org.eclipse.cdt.core/index/ChangeLog b/core/org.eclipse.cdt.core/index/ChangeLog index 784d524b020..b223cf5ad08 100644 --- a/core/org.eclipse.cdt.core/index/ChangeLog +++ b/core/org.eclipse.cdt.core/index/ChangeLog @@ -1,16 +1,27 @@ -2004-02-10 Bogdan Gheorghe +2004-02-13 Bogdan Gheorghe PR 51232 + + - Added mapping range checking to IncludeEntry to avoid out of bounds exceptions + - Added error handling to MergeFactory to handle problems during the save operation + - Added source file name filtering for the recreate an already existing index scenario in + IndexAllProject. + - Added more robust error handling to SourceIndexer + - Added error handling routine to Util.getFileCharContent() to deal with potential out of + memory crash + + * index/org/eclipse/cdt/internal/core/index/impl/IncludeEntry.java + * index/org/eclipse/cdt/internal/core/index/impl/MergeFactory.java + * index/org/eclipse/cdt/internal/core/index/search/Util.java + * index/org/eclipse/cdt/internal/core/index/search/indexing/IndexAllProject.java + * index/org/eclipse/cdt/internal/core/index/search/indexing/SourceIndexer.java + * index/org/eclipse/cdt/internal/core/index/search/indexing/AddFolderToIndex.java + +2004-02-10 Bogdan Gheorghe - - Added a layer of separation between the parser and the indexer: we now - create a worker thread to run the parser in. This allows the indexer to - finish all scheduled jobs regardless of how the parser performs on - individual files (i.e. indexing no longer affected by parser failures) - - Modified some of the stored index block reading routines to use separate counters, thus avoiding potential EOF exceptions. * index/org/eclipse/cdt/internal/core/index/impl/BlocksIndexInput.java - * index/org/eclipse/cdt/internal/core/index/search/indexing/SourceIndexer.java 2004-02-03 Alain Magloire diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/Util.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/Util.java index a384a3a3808..91d3de9592c 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/Util.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/Util.java @@ -148,7 +148,11 @@ public class Util { try { stream = new BufferedInputStream(new FileInputStream(file)); return Util.getInputStreamAsCharArray(stream, (int) file.length(), encoding); - } finally { + } + catch (OutOfMemoryError er){ + return null; + } + finally { if (stream != null) { try { stream.close(); diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/impl/IncludeEntry.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/impl/IncludeEntry.java index 7495ac6e54a..e762d1a4231 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/impl/IncludeEntry.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/impl/IncludeEntry.java @@ -157,8 +157,12 @@ public class IncludeEntry { */ public void mapRefs(int[] mappings) { int position= 0; + for (int i= 0; i < fNumRefs; i++) { - int map= mappings[fRefs[i]]; + //Take care that the reference is actually within the bounds of the mapping + int map= -1; + if(fRefs[i] >= 0 && fRefs[i] < mappings.length) + map= mappings[fRefs[i]]; if (map != -1 && map != 0) fRefs[position++]= map; } diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/impl/MergeFactory.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/impl/MergeFactory.java index 10d2a65497a..8d2e787f030 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/impl/MergeFactory.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/index/impl/MergeFactory.java @@ -13,6 +13,9 @@ package org.eclipse.cdt.internal.core.index.impl; import java.io.IOException; import java.util.Map; +import org.eclipse.cdt.internal.core.search.indexing.IndexManager; +import org.eclipse.cdt.internal.core.search.processing.JobManager; + /** * A mergeFactory is used to merge 2 indexes into one. One of the indexes * (oldIndex) is on the disk and the other(addsIndex) is in memory. @@ -81,7 +84,24 @@ public class MergeFactory { mergeReferences(); mergeIncludes(); mergeOutput.flush(); - } finally { + } + catch ( Exception ex ){ + if (ex instanceof IOException) + throw (IOException) ex; + else { + if (IndexManager.VERBOSE) { + JobManager.verbose("-> got the following exception during merge:"); //$NON-NLS-1$ + ex.printStackTrace(); + } + } + } + catch ( VirtualMachineError er ) { + if (IndexManager.VERBOSE) { + JobManager.verbose("-> got the following exception during merge:"); //$NON-NLS-1$ + er.printStackTrace(); + } + } + finally { //closes everything oldInput.close(); addsInput.close(); diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/AddFolderToIndex.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/AddFolderToIndex.java index 029aa05f285..5f225521c4b 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/AddFolderToIndex.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/AddFolderToIndex.java @@ -58,13 +58,12 @@ class AddFolderToIndex extends IndexRequest { public boolean visit(IResourceProxy proxy) throws CoreException { switch(proxy.getType()) { case IResource.FILE : -// TODO: BOG Put the file name checking back - //if (Util.isJavaFileName(proxy.getName())) { + if (Util.isCCFileName(proxy.getName())) { IResource resource = proxy.requestResource(); if (pattern == null || !Util.isExcluded(resource, pattern)) indexManager.addSource((IFile)resource, container); - //} - //return false; + } + return false; case IResource.FOLDER : if (pattern != null && Util.isExcluded(proxy.requestResource(), pattern)) return false; diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/IndexAllProject.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/IndexAllProject.java index bf4b4cf9b1d..8143a1767e6 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/IndexAllProject.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/IndexAllProject.java @@ -124,9 +124,8 @@ public class IndexAllProject extends IndexRequest { public boolean visit(IResourceProxy proxy) { if (isCancelled) return false; switch(proxy.getType()) { - case IResource.FILE : -// TODO: BOG Put the file name checking back - //if (Util.isCCFileName(proxy.getName())) { + case IResource.FILE : + if (Util.isCCFileName(proxy.getName())) { IResource resource = proxy.requestResource(); IPath path = resource.getLocation(); if (path != null && (patterns == null || !Util.isExcluded(resource, patterns))) { @@ -136,8 +135,8 @@ public class IndexAllProject extends IndexRequest { ? (Object) resource : (Object) OK); } - //} - //return false; + } + return false; case IResource.FOLDER : if (patterns != null && Util.isExcluded(proxy.requestResource(), patterns)) return false; diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexer.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexer.java index e1b089d3c4d..b10acb40b94 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexer.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexer.java @@ -88,28 +88,39 @@ public class SourceIndexer extends AbstractIndexer { ParserFactory.createScanner( new StringReader( document.getStringContent() ), resourceFile.getLocation().toOSString(), scanInfo, ParserMode.COMPLETE_PARSE, language, requestor ), requestor, ParserMode.COMPLETE_PARSE, language ); - ParserRunner p = new ParserRunner(parser); - Thread t = new Thread(p, "CDT Indexer Parser Runner"); - t.start(); - + try{ - t.join(); - } - catch (InterruptedException e){ - org.eclipse.cdt.internal.core.model.Util.log(null, "Parser Runner InterruptedException - file: " + resourceFile.getFullPath(), ICLogConstants.CDT); - } - - boolean retVal = p.getResult(); - - if (!retVal) - org.eclipse.cdt.internal.core.model.Util.log(null, "Failed to index " + resourceFile.getFullPath(), ICLogConstants.CDT); - - if (AbstractIndexer.VERBOSE){ + boolean retVal = parser.parse(); + if (!retVal) - AbstractIndexer.verbose("PARSE FAILED " + resourceFile.getName().toString()); - else - AbstractIndexer.verbose("PARSE SUCCEEDED " + resourceFile.getName().toString()); - } + org.eclipse.cdt.internal.core.model.Util.log(null, "Failed to index " + resourceFile.getFullPath(), ICLogConstants.CDT); + + if (AbstractIndexer.VERBOSE){ + if (!retVal) + AbstractIndexer.verbose("PARSE FAILED " + resourceFile.getName().toString()); + else + AbstractIndexer.verbose("PARSE SUCCEEDED " + resourceFile.getName().toString()); + } + } + catch ( VirtualMachineError vmErr){ + if (vmErr instanceof OutOfMemoryError){ + org.eclipse.cdt.internal.core.model.Util.log(null, "Out Of Memory error: " + vmErr.getMessage() + " on File: " + resourceFile.getName(), ICLogConstants.CDT); + } + } + catch ( Exception ex ){ + if (ex instanceof IOException) + throw (IOException) ex; + } + finally{ + //Release all resources + parser=null; + currentProject = null; + requestor = null; + provider = null; + scanInfo=null; + } + + } /** * Sets the document types the IIndexer handles. @@ -122,25 +133,4 @@ public class SourceIndexer extends AbstractIndexer { return resourceFile; } - class ParserRunner implements Runnable { - IParser parser; - boolean retVal; - ParserRunner(IParser parser){ - this.parser = parser; - } - /* (non-Javadoc) - * @see java.lang.Runnable#run() - */ - public void run() { - try{ - retVal=parser.parse(); - } - catch (Exception e){ - org.eclipse.cdt.internal.core.model.Util.log(null, "Parser Runner Exception " + resourceFile.getFullPath() + " Message: " + e.getMessage(), ICLogConstants.CDT); - } - } - - boolean getResult(){ return retVal;} - - } } diff --git a/core/org.eclipse.cdt.core/search/ChangeLog b/core/org.eclipse.cdt.core/search/ChangeLog index b8ee77e56f2..ebad85b4db3 100644 --- a/core/org.eclipse.cdt.core/search/ChangeLog +++ b/core/org.eclipse.cdt.core/search/ChangeLog @@ -1,266 +1,270 @@ -2004-02-05 Alain Magloire - PR 51221 - Reformat Patch from Bogdan base on Thomas Fletcher original patch - In a nutshell, it moves the search operation into a runnable which - can be passed to a progress dialog. - - * search/org/eclipse/cdt/core/search/BasicSearchResultCollector.java - -2003-10-23 Bogdan Gheorghe - - - Added AcceptMatchOperation to get around Bug 45324. The search - operation is no longer a WorkspaceModifyOperation (which used to - lock the workspace for the duration of search). Instead, we now - lock the workspace only when we tag the resources with markers. - - - Modified SearchEngine : we now receive a list of matches - from the search that we pass into the AcceptMatchOperation. - - - Modified MatchLocator to add matches to passed in list instead - of reporting them right away - - - Modified JobManager: -added in jobToIgnore parm to unblock dependency - jobs - - -2003-10-06 Bogdan Gheorghe - - added createCFileSearchScope() to SearchEngine.java to improve - code complete performance - -2003-10-01 Andrew Niefer - - fix bug 44026 by checking scope before reporting match in MatchLocator.report - -2003-10-01 Andrew Niefer - - fix BasicSearchMatch.equals() for bug43988 - -2003-09-30 Bogdan Gheorghe - - changed logging in JobManager to use new ICLogConstants - -2003-09-30 Andrew Niefer - -fix bug43862 - Cannot find macro delcarations using all occurences. - * modified CSearchPattern.createMacroPattern - -2003-09-29 Andrew Niefer - - fix bug 43062 outline is confused on operator methods containing spaces - - modify CSearchPattern.scanForNames to use same naming convention as TokenDuple.toString() - - modify MatchLocator.report to use IASTOffsetableNamedElement.getNameEndOffset() - -2003-09-29 Andrew Niefer - -bug42911 - Search: cannot find beyond use of data member - - fix NPE's in BasicSearchMatch.equals & hashCode - -2003-09-29 Andrew Niefer - -fix NPE if IScannerInfoProvider returns null IScannerInfo - -2003-09-25 Andrew Niefer - - bug43129 - Cannot search for definitions of global variables - - check definitions for variables, fields, enumerators and namespaces - - handle enter/exitLinkageSpecification - * search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java - * search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java - -2003-09-25 Bogdan Gheorghe - - added SearchFor INCLUDE in ICSearchConstants - - added acceptIncludeDeclaration to IIndexSearchRequestor - - modified PathCollector to acceptIncludeDeclarations - - modified CSearchPattern to create an IncludePattern - - added IncludePattern.java - -2003-09-25 Andrew Niefer - - partial fix for 43664 Modify Matchlocator to not try and create a link if we have no - resource, instead just use the path - -2003-09-23 Andrew Niefer - fix bug 43498 Search with ? fails on first letter of second word - -modifications to CSearchPattern.scanForNames() - -add getSimpleName to MethodDeclarationPattern - -2003-09-19 Andrew Niefer - fix bug 43327 Code Complete finds local variables - - modified MatchLocator to not report local declarations when boolean is set - - modified SearchEngine.search to take an additional parameter "excludeLocalDeclarations" - -2003-09-15 Andrew Niefer - - modify CSearchPattern to handle escaping wildcards (bug43063) - - modify enterFunctionBody and enterMethodBody to fix bug42979 - - search for Parameter References - -2003-09-13 Andrew Niefer - -Searching for Typedefs: (bug42902) - - modified setElementInfo in BasicSearchResultCollector - - added TYPEDEF to ICSearchConstants - - modified CSearchPattern & ClassDeclarationPattern - - implemented acceptTypedef* in MatchLocator - - modified BasicSearchMatch to implement Comparable - -2003-09-11 Andrew Niefer - - Modified ICSearchResultCollector.createMatch to not take a parent parameter - - modified BasicSearchResultCollector to create the parent string from the fully qualified name of the node - - modified MatchLocator to keep track of most recent declaration for reporting purposes - - modified MatchLocator.report to use the most recent declaration - -2003-09-09 Andrew Niefer - pattern matching on function parameters: - - modified scanForParameters in CSearchPattern - - added getParamString in CSearchPattern - - modified matchLevel in MethodDeclarationPattern - - Enumeration references - - modified acceptEnumeratorReference in MatchLocator - -2003-09-05 Andrew Niefer - - fix searching for enumerators - -2003-09-03 Andrew Niefer - - added CLASS_STRUCT to the SearchFor constants - - Modified CSearchPattern to handle CLASS_STRUCT - -2003-08-26 Bogdan Gheorghe - - Added debug tracing statements to SearchEngine - - Modified scanForNames in CSearchPattern to treat append - a token after "~" to allow for destructors search - - Added scope checking to MatchLocator - - Added debug trace statements to MatchLocator - -2003-08-20 Bogdan Gheorghe - - Changed matching and reporting functions to handle nodes - of type IElaboratedTypeSpecifier - -2003-08-12 Bogdan Gheorghe - - Rolled field and variable search patterns into one pattern, in - order to allow for qualified var searches - -2003-08-11 Andrew Niefer - - Added Macro ICSearchConstant - - Added acceptMacro to IIndexSearchRequestor and PathCollector - - Added MacroDeclaration Pattern - - Rolled method and function patterns into one method pattern - - Added WorkingCopy support to search - -2003-08-08 Bogdan Gheorghe - - Added CreateSearchScope to create a search scope out of - CElements - - Filled out CSearchScope to enable: - - adding a project to scope, include referenced projects - - adding individual CElements to scope - -2003-08-08 Andrew Niefer - - add function parameter information to search results - -2003-08-06 Andrew Niefer - - Create OrPattern which matches for search if any of its constituent patterns matches - - modified MatchLocator to support the OrPattern - - searching for All occurences now uses the OrPattern - -2003-08-01 Andrew Niefer - - Modified BasicSearchResultCollector to only accept matches it has not already seen - - fixed bug in finding a resource when entering includes - -2003-07-29 Andrew Niefer - Refactoring Search result collection: - - Modified ICSearchResultCollector - - Modified IMatch - - Modified MatchLocator to reflect changes in ICSearchResultCollector - - Created BasicSearchMatch implements IMatch - - Created BasicSearchResultCollector implements ICSearchResultCollector - -2003-07-28 Andrew Niefer - - added abstract CSearchPattern.resetIndexInfo fix bug with searching with globally - qualified names - - fixed bug in CSearchPattern.matchQualifications to do with globally qualified names - - fixed bug in CSearchPattern.createFunctionPattern to do with parameter lists. - -2003-07-25 Bogdan Gheorghe - - Added refs to PathCollector - - Filled in feedIndexRequestor for the new search patterns - - Fixed the FunctionDeclarationPattern to work with no parms - -2003-07-24 Andrew Niefer - - Implemented decodeIndexEntry & matchIndexEntry for all patterns - - changed MatchLocator to use a COMPLETE_PARSE. - -2003-07-23 Andrew Niefer - -Changed ICSearchPattern.matchLevel to take a ISourceElementCallbackDelegate - -Changed ICSearchResultCollector.createMatch to take a ISourceElementCallbackDelegate - -first implementations of: - -CSearchPattern.createFunctionPattern - -CSearchPattern.createVariablePattern - -CSearchPattern.createMethodPattern - -preliminary matching for remaining patterns - -handling of remaining parser callbacks - -generating index Prefixes for the patterns - -2003-07-14 Andrew Niefer - -Modified SearchFor instances in ICSearchConstants to more closely match what we are searching for - -added IMatch interface, it represents matches found by the search engine, implementors can store - whatever information they like, see ICSearchResultCollector::createMatch - -added createMatch to the ICSearchResultCollector interface, the result collector is responsible for - implementing IMatch to store whatever data they want out of the AST nodes. - -added skeleton patterns: - search/org/eclipse/cdt/internal/core/search/matching/FieldDeclarationPattern.java - search/org/eclipse/cdt/internal/core/search/matching/FunctionDeclarationPattern.java - search/org/eclipse/cdt/internal/core/search/matching/MethodDeclarationPattern.java - search/org/eclipse/cdt/internal/core/search/matching/NamespaceDeclarationPattern.java - search/org/eclipse/cdt/internal/core/search/matching/VariableDeclarationPattern.java - -added beginnings of CSearchPattern::create*Pattern functions - -modifications to MatchLocator to keep track of current scope - -added CSearchPattern::matchQualifications - -2003-07-10 Bogdan Gheorghe - Provided implementation for ICSearchScope.java, CSearchScope.java - - Hooked up new CWorkspaceScope, PathCollector, PatternSearchJob in SearchEngine.java - - Provided implementation for PatternSearchJob.java - PatternSearchJob is where the first part - of the search occurs - using an IndexSelector to filter the indexes, it gets the indexes from - the IndexManager and then uses the passed in pattern to find the index matched. Once it finds - an index match it adds the file path to the PathCollector. - - Modified CSearchPattern - added support to find index entries. - - Modified ClassDeclarationPattern - added support to decode, match and report - index entries. - - - Added: - * search/org/eclipse/cdt/internal/core/search/CWorkspaceScope.java - * search/org/eclipse/cdt/internal/core/search/IIndexSearchRequestor.java - * search/org/eclipse/cdt/internal/core/search/IndexSelector.java - * search/org/eclipse/cdt/internal/core/search/PathCollector.java - - Modified: - * search/org/eclipse/cdt/core/search/ICSearchScope.java - * search/org/eclipse/cdt/core/search/SearchEngine.java - * search/org/eclipse/cdt/internal/core/search/CSearchScope.java - * search/org/eclipse/cdt/internal/core/search/PatternSearchJob.java - * search/org/eclipse/cdt/internal/core/search/matching/ClassDeclarationPattern.java - * search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java - -2003-07-04 Andrew Niefer - Modified ICSearchConstants to use new nested classes SearchFor and LimitTo instead of int - for stronger type safety - - Updated MatchLocator to invoke parser to do actual search. - -2003-06-27 Andrew Niefer - Modified: - search/org.eclipse.cdt.core.search.matching/MatchLocator.java - - enter/exitInclusion - - enterClassSpecifier - search/org.eclipse.cdt.core.search.matching/CSearchPattern.java - - createClassPattern - - matchesName - search/org.eclipse.cdt.core.search.matching/ClassDeclarationPattern.java - - matchLevel - search/org.eclipse.cdt.core.search/ICSearchPattern.java - search/org.eclipse.cdt.core.search/ICSearchResultCollector.java - search/org.eclipse.cdt.core.search/SearchEngine.java - -2003-06-25 Bogdan Gheorghe - Modified: - * search/org/eclipse/cdt/core/search/ICSearchConstants.java - * search/org/eclipse/cdt/internal/core/search/Utils.java - - moved to index/org/eclipse/cdt/internal/core/search/Utils.java - * search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java - * search/org/eclipse/cdt/internal/core/search/processing/IJob.java +2004-02-13 Bogdan Gheorghe + - Added error handling to MatchLocator.locateMatches to handle possible + parser failures. + +2004-02-05 Alain Magloire + PR 51221 + Reformat Patch from Bogdan base on Thomas Fletcher original patch + In a nutshell, it moves the search operation into a runnable which + can be passed to a progress dialog. + + * search/org/eclipse/cdt/core/search/BasicSearchResultCollector.java + +2003-10-23 Bogdan Gheorghe + + - Added AcceptMatchOperation to get around Bug 45324. The search + operation is no longer a WorkspaceModifyOperation (which used to + lock the workspace for the duration of search). Instead, we now + lock the workspace only when we tag the resources with markers. + + - Modified SearchEngine : we now receive a list of matches + from the search that we pass into the AcceptMatchOperation. + + - Modified MatchLocator to add matches to passed in list instead + of reporting them right away + + - Modified JobManager: -added in jobToIgnore parm to unblock dependency + jobs + + +2003-10-06 Bogdan Gheorghe + - added createCFileSearchScope() to SearchEngine.java to improve + code complete performance + +2003-10-01 Andrew Niefer + - fix bug 44026 by checking scope before reporting match in MatchLocator.report + +2003-10-01 Andrew Niefer + - fix BasicSearchMatch.equals() for bug43988 + +2003-09-30 Bogdan Gheorghe + - changed logging in JobManager to use new ICLogConstants + +2003-09-30 Andrew Niefer + -fix bug43862 - Cannot find macro delcarations using all occurences. + * modified CSearchPattern.createMacroPattern + +2003-09-29 Andrew Niefer + - fix bug 43062 outline is confused on operator methods containing spaces + - modify CSearchPattern.scanForNames to use same naming convention as TokenDuple.toString() + - modify MatchLocator.report to use IASTOffsetableNamedElement.getNameEndOffset() + +2003-09-29 Andrew Niefer + -bug42911 - Search: cannot find beyond use of data member + - fix NPE's in BasicSearchMatch.equals & hashCode + +2003-09-29 Andrew Niefer + -fix NPE if IScannerInfoProvider returns null IScannerInfo + +2003-09-25 Andrew Niefer + - bug43129 - Cannot search for definitions of global variables + - check definitions for variables, fields, enumerators and namespaces + - handle enter/exitLinkageSpecification + * search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java + * search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java + +2003-09-25 Bogdan Gheorghe + - added SearchFor INCLUDE in ICSearchConstants + - added acceptIncludeDeclaration to IIndexSearchRequestor + - modified PathCollector to acceptIncludeDeclarations + - modified CSearchPattern to create an IncludePattern + - added IncludePattern.java + +2003-09-25 Andrew Niefer + - partial fix for 43664 Modify Matchlocator to not try and create a link if we have no + resource, instead just use the path + +2003-09-23 Andrew Niefer + fix bug 43498 Search with ? fails on first letter of second word + -modifications to CSearchPattern.scanForNames() + -add getSimpleName to MethodDeclarationPattern + +2003-09-19 Andrew Niefer + fix bug 43327 Code Complete finds local variables + - modified MatchLocator to not report local declarations when boolean is set + - modified SearchEngine.search to take an additional parameter "excludeLocalDeclarations" + +2003-09-15 Andrew Niefer + - modify CSearchPattern to handle escaping wildcards (bug43063) + - modify enterFunctionBody and enterMethodBody to fix bug42979 + - search for Parameter References + +2003-09-13 Andrew Niefer + -Searching for Typedefs: (bug42902) + - modified setElementInfo in BasicSearchResultCollector + - added TYPEDEF to ICSearchConstants + - modified CSearchPattern & ClassDeclarationPattern + - implemented acceptTypedef* in MatchLocator + - modified BasicSearchMatch to implement Comparable + +2003-09-11 Andrew Niefer + - Modified ICSearchResultCollector.createMatch to not take a parent parameter + - modified BasicSearchResultCollector to create the parent string from the fully qualified name of the node + - modified MatchLocator to keep track of most recent declaration for reporting purposes + - modified MatchLocator.report to use the most recent declaration + +2003-09-09 Andrew Niefer + pattern matching on function parameters: + - modified scanForParameters in CSearchPattern + - added getParamString in CSearchPattern + - modified matchLevel in MethodDeclarationPattern + + Enumeration references + - modified acceptEnumeratorReference in MatchLocator + +2003-09-05 Andrew Niefer + - fix searching for enumerators + +2003-09-03 Andrew Niefer + - added CLASS_STRUCT to the SearchFor constants + - Modified CSearchPattern to handle CLASS_STRUCT + +2003-08-26 Bogdan Gheorghe + - Added debug tracing statements to SearchEngine + - Modified scanForNames in CSearchPattern to treat append + a token after "~" to allow for destructors search + - Added scope checking to MatchLocator + - Added debug trace statements to MatchLocator + +2003-08-20 Bogdan Gheorghe + - Changed matching and reporting functions to handle nodes + of type IElaboratedTypeSpecifier + +2003-08-12 Bogdan Gheorghe + - Rolled field and variable search patterns into one pattern, in + order to allow for qualified var searches + +2003-08-11 Andrew Niefer + - Added Macro ICSearchConstant + - Added acceptMacro to IIndexSearchRequestor and PathCollector + - Added MacroDeclaration Pattern + - Rolled method and function patterns into one method pattern + - Added WorkingCopy support to search + +2003-08-08 Bogdan Gheorghe + - Added CreateSearchScope to create a search scope out of + CElements + - Filled out CSearchScope to enable: + - adding a project to scope, include referenced projects + - adding individual CElements to scope + +2003-08-08 Andrew Niefer + - add function parameter information to search results + +2003-08-06 Andrew Niefer + - Create OrPattern which matches for search if any of its constituent patterns matches + - modified MatchLocator to support the OrPattern + - searching for All occurences now uses the OrPattern + +2003-08-01 Andrew Niefer + - Modified BasicSearchResultCollector to only accept matches it has not already seen + - fixed bug in finding a resource when entering includes + +2003-07-29 Andrew Niefer + Refactoring Search result collection: + - Modified ICSearchResultCollector + - Modified IMatch + - Modified MatchLocator to reflect changes in ICSearchResultCollector + - Created BasicSearchMatch implements IMatch + - Created BasicSearchResultCollector implements ICSearchResultCollector + +2003-07-28 Andrew Niefer + - added abstract CSearchPattern.resetIndexInfo fix bug with searching with globally + qualified names + - fixed bug in CSearchPattern.matchQualifications to do with globally qualified names + - fixed bug in CSearchPattern.createFunctionPattern to do with parameter lists. + +2003-07-25 Bogdan Gheorghe + - Added refs to PathCollector + - Filled in feedIndexRequestor for the new search patterns + - Fixed the FunctionDeclarationPattern to work with no parms + +2003-07-24 Andrew Niefer + - Implemented decodeIndexEntry & matchIndexEntry for all patterns + - changed MatchLocator to use a COMPLETE_PARSE. + +2003-07-23 Andrew Niefer + -Changed ICSearchPattern.matchLevel to take a ISourceElementCallbackDelegate + -Changed ICSearchResultCollector.createMatch to take a ISourceElementCallbackDelegate + -first implementations of: + -CSearchPattern.createFunctionPattern + -CSearchPattern.createVariablePattern + -CSearchPattern.createMethodPattern + -preliminary matching for remaining patterns + -handling of remaining parser callbacks + -generating index Prefixes for the patterns + +2003-07-14 Andrew Niefer + -Modified SearchFor instances in ICSearchConstants to more closely match what we are searching for + -added IMatch interface, it represents matches found by the search engine, implementors can store + whatever information they like, see ICSearchResultCollector::createMatch + -added createMatch to the ICSearchResultCollector interface, the result collector is responsible for + implementing IMatch to store whatever data they want out of the AST nodes. + -added skeleton patterns: + search/org/eclipse/cdt/internal/core/search/matching/FieldDeclarationPattern.java + search/org/eclipse/cdt/internal/core/search/matching/FunctionDeclarationPattern.java + search/org/eclipse/cdt/internal/core/search/matching/MethodDeclarationPattern.java + search/org/eclipse/cdt/internal/core/search/matching/NamespaceDeclarationPattern.java + search/org/eclipse/cdt/internal/core/search/matching/VariableDeclarationPattern.java + -added beginnings of CSearchPattern::create*Pattern functions + -modifications to MatchLocator to keep track of current scope + -added CSearchPattern::matchQualifications + +2003-07-10 Bogdan Gheorghe + Provided implementation for ICSearchScope.java, CSearchScope.java + + Hooked up new CWorkspaceScope, PathCollector, PatternSearchJob in SearchEngine.java + + Provided implementation for PatternSearchJob.java - PatternSearchJob is where the first part + of the search occurs - using an IndexSelector to filter the indexes, it gets the indexes from + the IndexManager and then uses the passed in pattern to find the index matched. Once it finds + an index match it adds the file path to the PathCollector. + + Modified CSearchPattern - added support to find index entries. + + Modified ClassDeclarationPattern - added support to decode, match and report + index entries. + + + Added: + * search/org/eclipse/cdt/internal/core/search/CWorkspaceScope.java + * search/org/eclipse/cdt/internal/core/search/IIndexSearchRequestor.java + * search/org/eclipse/cdt/internal/core/search/IndexSelector.java + * search/org/eclipse/cdt/internal/core/search/PathCollector.java + + Modified: + * search/org/eclipse/cdt/core/search/ICSearchScope.java + * search/org/eclipse/cdt/core/search/SearchEngine.java + * search/org/eclipse/cdt/internal/core/search/CSearchScope.java + * search/org/eclipse/cdt/internal/core/search/PatternSearchJob.java + * search/org/eclipse/cdt/internal/core/search/matching/ClassDeclarationPattern.java + * search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java + +2003-07-04 Andrew Niefer + Modified ICSearchConstants to use new nested classes SearchFor and LimitTo instead of int + for stronger type safety + + Updated MatchLocator to invoke parser to do actual search. + +2003-06-27 Andrew Niefer + Modified: + search/org.eclipse.cdt.core.search.matching/MatchLocator.java + - enter/exitInclusion + - enterClassSpecifier + search/org.eclipse.cdt.core.search.matching/CSearchPattern.java + - createClassPattern + - matchesName + search/org.eclipse.cdt.core.search.matching/ClassDeclarationPattern.java + - matchLevel + search/org.eclipse.cdt.core.search/ICSearchPattern.java + search/org.eclipse.cdt.core.search/ICSearchResultCollector.java + search/org.eclipse.cdt.core.search/SearchEngine.java + +2003-06-25 Bogdan Gheorghe + Modified: + * search/org/eclipse/cdt/core/search/ICSearchConstants.java + * search/org/eclipse/cdt/internal/core/search/Utils.java + - moved to index/org/eclipse/cdt/internal/core/search/Utils.java + * search/org/eclipse/cdt/internal/core/search/matching/CSearchPattern.java + * search/org/eclipse/cdt/internal/core/search/processing/IJob.java * search/org/eclipse/cdt/internal/core/search/processing/JobManager.java \ No newline at end of file diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java index 83a0178c9f3..9d394be6238 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java @@ -16,6 +16,7 @@ package org.eclipse.cdt.internal.core.search.matching; import java.io.CharArrayReader; import java.io.FileNotFoundException; import java.io.FileReader; +import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.util.ArrayList; @@ -439,8 +440,22 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants if (VERBOSE) MatchLocator.verbose("*** New Search for path: " + pathString); - - parser.parse(); + + try{ + parser.parse(); + } + catch(Exception ex){ + if (VERBOSE){ + MatchLocator.verbose("MatchLocator Exception: "); + ex.printStackTrace(); + } + } + catch(VirtualMachineError vmErr){ + if (VERBOSE){ + MatchLocator.verbose("MatchLocator VM Error: "); + vmErr.printStackTrace(); + } + } } }