mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Patch for Chris Wiebe.
Type Cache fix for bug 69872.
This commit is contained in:
parent
7f0142b2e8
commit
c19d0b2050
1 changed files with 8 additions and 16 deletions
|
@ -121,6 +121,7 @@ public class TypeParser implements ISourceElementRequestor {
|
||||||
private ITypeInfo fSuperTypeToFind;
|
private ITypeInfo fSuperTypeToFind;
|
||||||
private Set fProcessedTypes = new HashSet();
|
private Set fProcessedTypes = new HashSet();
|
||||||
private boolean fFoundType;
|
private boolean fFoundType;
|
||||||
|
IParser fParser = null;
|
||||||
|
|
||||||
public TypeParser(ITypeCache typeCache, IWorkingCopyProvider provider) {
|
public TypeParser(ITypeCache typeCache, IWorkingCopyProvider provider) {
|
||||||
fTypeCache = typeCache;
|
fTypeCache = typeCache;
|
||||||
|
@ -501,8 +502,8 @@ public class TypeParser implements ISourceElementRequestor {
|
||||||
fProgressMonitor = progressMonitor;
|
fProgressMonitor = progressMonitor;
|
||||||
IScanner scanner = ParserFactory.createScanner(reader, scanInfo,
|
IScanner scanner = ParserFactory.createScanner(reader, scanInfo,
|
||||||
ParserMode.STRUCTURAL_PARSE, language, this, ParserUtil.getScannerLogService(), null);
|
ParserMode.STRUCTURAL_PARSE, language, this, ParserUtil.getScannerLogService(), null);
|
||||||
IParser parser = ParserFactory.createParser(scanner, this, ParserMode.STRUCTURAL_PARSE, language, ParserUtil.getParserLogService());
|
fParser = ParserFactory.createParser(scanner, this, ParserMode.STRUCTURAL_PARSE, language, ParserUtil.getParserLogService());
|
||||||
parser.parse();
|
fParser.parse();
|
||||||
} catch (ParserFactoryError e) {
|
} catch (ParserFactoryError e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
} catch (ParseError e) {
|
} catch (ParseError e) {
|
||||||
|
@ -514,6 +515,7 @@ public class TypeParser implements ISourceElementRequestor {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
} finally {
|
} finally {
|
||||||
fProgressMonitor = null;
|
fProgressMonitor = null;
|
||||||
|
fParser = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -770,14 +772,16 @@ public class TypeParser implements ISourceElementRequestor {
|
||||||
if ((fTypeToFind.getCElementType() == nodeInfo.type || fTypeToFind.isUndefinedType()) && nodeInfo.name.equals(fTypeToFind.getName())) {
|
if ((fTypeToFind.getCElementType() == nodeInfo.type || fTypeToFind.isUndefinedType()) && nodeInfo.name.equals(fTypeToFind.getName())) {
|
||||||
QualifiedTypeName qualifiedName = new QualifiedTypeName(nodeInfo.name, nodeInfo.enclosingNames);
|
QualifiedTypeName qualifiedName = new QualifiedTypeName(nodeInfo.name, nodeInfo.enclosingNames);
|
||||||
if (qualifiedName.equals(fTypeToFind.getQualifiedTypeName())) {
|
if (qualifiedName.equals(fTypeToFind.getQualifiedTypeName())) {
|
||||||
fFoundType = true;
|
|
||||||
|
|
||||||
// add types to cache
|
// add types to cache
|
||||||
ITypeInfo newType = addType(nodeInfo.type, qualifiedName, originalLocation, resolvedLocation);
|
ITypeInfo newType = addType(nodeInfo.type, qualifiedName, originalLocation, resolvedLocation);
|
||||||
if (newType != null && node instanceof IASTClassSpecifier) {
|
if (newType != null && node instanceof IASTClassSpecifier) {
|
||||||
addSuperClasses(newType, (IASTClassSpecifier)node, originalLocation, fProcessedTypes);
|
addSuperClasses(newType, (IASTClassSpecifier)node, originalLocation, fProcessedTypes);
|
||||||
}
|
}
|
||||||
fProgressMonitor.worked(1);
|
fProgressMonitor.worked(1);
|
||||||
|
|
||||||
|
fFoundType = true;
|
||||||
|
// terminate the parser
|
||||||
|
fParser.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -897,16 +901,4 @@ public class TypeParser implements ISourceElementRequestor {
|
||||||
public CodeReader createReader(String finalPath, Iterator workingCopies) {
|
public CodeReader createReader(String finalPath, Iterator workingCopies) {
|
||||||
return ParserUtil.createReader(finalPath, workingCopies);
|
return ParserUtil.createReader(finalPath, workingCopies);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#parserTimeout()
|
|
||||||
*/
|
|
||||||
public boolean parserTimeout() {
|
|
||||||
//TODO - Chris Wiebe - Need to resturcture how you cancel the parser now that
|
|
||||||
//IParser.cancel() is available, this method is no longer being called.
|
|
||||||
if (fFoundType || fProgressMonitor.isCanceled())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue