mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-05 07:15:39 +02:00
reindent file
This commit is contained in:
parent
0abbd14d54
commit
b2114ce639
1 changed files with 27 additions and 27 deletions
|
@ -94,7 +94,7 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||||
protected volatile int fCompletedHeaders= 0;
|
protected volatile int fCompletedHeaders= 0;
|
||||||
protected Map/*<IIndexFileLocation, Object>*/ fContextMap = new HashMap/*<IIndexFileLocation, Object>*/();
|
protected Map/*<IIndexFileLocation, Object>*/ fContextMap = new HashMap/*<IIndexFileLocation, Object>*/();
|
||||||
protected volatile String fMessage;
|
protected volatile String fMessage;
|
||||||
|
|
||||||
private boolean fShowActivity;
|
private boolean fShowActivity;
|
||||||
private boolean fShowStatistics;
|
private boolean fShowStatistics;
|
||||||
private boolean fShowProblems;
|
private boolean fShowProblems;
|
||||||
|
@ -105,29 +105,29 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||||
private int fReferenceCount= 0;
|
private int fReferenceCount= 0;
|
||||||
private int fDeclarationCount= 0;
|
private int fDeclarationCount= 0;
|
||||||
private int fProblemBindingCount= 0;
|
private int fProblemBindingCount= 0;
|
||||||
|
|
||||||
protected PDOMIndexerTask() {
|
protected PDOMIndexerTask() {
|
||||||
fShowActivity= checkDebugOption("indexer/activity", "true"); //$NON-NLS-1$//$NON-NLS-2$
|
fShowActivity= checkDebugOption("indexer/activity", "true"); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
fShowStatistics= checkDebugOption("indexer/statistics", "true"); //$NON-NLS-1$//$NON-NLS-2$
|
fShowStatistics= checkDebugOption("indexer/statistics", "true"); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
fShowProblems= checkDebugOption("indexer/problems", "true"); //$NON-NLS-1$//$NON-NLS-2$
|
fShowProblems= checkDebugOption("indexer/problems", "true"); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkDebugOption(String option, String value) {
|
private boolean checkDebugOption(String option, String value) {
|
||||||
String trace = Platform.getDebugOption(CCorePlugin.PLUGIN_ID + "/debug/" + option); //$NON-NLS-1$
|
String trace = Platform.getDebugOption(CCorePlugin.PLUGIN_ID + "/debug/" + option); //$NON-NLS-1$
|
||||||
return (trace != null && trace.equalsIgnoreCase(value));
|
return (trace != null && trace.equalsIgnoreCase(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void processDelta(ICElementDelta delta, Collection added, Collection changed, Collection removed) throws CoreException {
|
protected void processDelta(ICElementDelta delta, Collection added, Collection changed, Collection removed) throws CoreException {
|
||||||
boolean allFiles= getIndexAllFiles();
|
boolean allFiles= getIndexAllFiles();
|
||||||
int flags = delta.getFlags();
|
int flags = delta.getFlags();
|
||||||
|
|
||||||
if ((flags & ICElementDelta.F_CHILDREN) != 0) {
|
if ((flags & ICElementDelta.F_CHILDREN) != 0) {
|
||||||
ICElementDelta[] children = delta.getAffectedChildren();
|
ICElementDelta[] children = delta.getAffectedChildren();
|
||||||
for (int i = 0; i < children.length; ++i) {
|
for (int i = 0; i < children.length; ++i) {
|
||||||
processDelta(children[i], added, changed, removed);
|
processDelta(children[i], added, changed, removed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ICElement element = delta.getElement();
|
ICElement element = delta.getElement();
|
||||||
switch (element.getElementType()) {
|
switch (element.getElementType()) {
|
||||||
case ICElement.C_UNIT:
|
case ICElement.C_UNIT:
|
||||||
|
@ -158,9 +158,9 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void collectSources(ICContainer container, final Collection sources, final Collection headers, final boolean allFiles) throws CoreException {
|
private void collectSources(ICContainer container, final Collection sources, final Collection headers, final boolean allFiles) throws CoreException {
|
||||||
container.accept(new TranslationUnitCollector(sources, headers, allFiles));
|
container.accept(new TranslationUnitCollector(sources, headers, allFiles));
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||||
index.releaseWriteLock(0);
|
index.releaseWriteLock(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void parseTUs(Collection sources, Collection headers, IProgressMonitor monitor) throws CoreException, InterruptedException {
|
protected void parseTUs(Collection sources, Collection headers, IProgressMonitor monitor) throws CoreException, InterruptedException {
|
||||||
// sources first
|
// sources first
|
||||||
for (Iterator iter = sources.iterator(); iter.hasNext();) {
|
for (Iterator iter = sources.iterator(); iter.hasNext();) {
|
||||||
|
@ -202,7 +202,7 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||||
iter.remove();
|
iter.remove();
|
||||||
} else {
|
} else {
|
||||||
ITranslationUnit context= findContext(getIndex(), location);
|
ITranslationUnit context= findContext(getIndex(), location);
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
parseTU(context, monitor);
|
parseTU(context, monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,15 +250,15 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||||
private void swallowError(IPath file, Throwable e) throws CoreException {
|
private void swallowError(IPath file, Throwable e) throws CoreException {
|
||||||
IStatus status= CCorePlugin.createStatus(
|
IStatus status= CCorePlugin.createStatus(
|
||||||
MessageFormat.format(Messages.PDOMIndexerTask_errorWhileParsing, new Object[]{file}), e);
|
MessageFormat.format(Messages.PDOMIndexerTask_errorWhileParsing, new Object[]{file}), e);
|
||||||
CCorePlugin.log(status);
|
CCorePlugin.log(status);
|
||||||
if (++fErrorCount > MAX_ERRORS) {
|
if (++fErrorCount > MAX_ERRORS) {
|
||||||
throw new CoreException(CCorePlugin.createStatus(
|
throw new CoreException(CCorePlugin.createStatus(
|
||||||
MessageFormat.format(Messages.PDOMIndexerTask_tooManyIndexProblems, new Object[]{getIndexer().getProject().getElementName()})));
|
MessageFormat.format(Messages.PDOMIndexerTask_tooManyIndexProblems, new Object[]{getIndexer().getProject().getElementName()})));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected void doParseTU(ITranslationUnit tu, IProgressMonitor pm) throws CoreException, InterruptedException;
|
abstract protected void doParseTU(ITranslationUnit tu, IProgressMonitor pm) throws CoreException, InterruptedException;
|
||||||
|
|
||||||
protected void clearIndex(IWritableIndex index) throws InterruptedException, CoreException {
|
protected void clearIndex(IWritableIndex index) throws InterruptedException, CoreException {
|
||||||
// reset error count
|
// reset error count
|
||||||
fErrorCount= 0;
|
fErrorCount= 0;
|
||||||
|
@ -271,17 +271,17 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||||
index.releaseWriteLock(0);
|
index.releaseWriteLock(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean getIndexAllFiles() {
|
protected boolean getIndexAllFiles() {
|
||||||
return getIndexer().getIndexAllFiles();
|
return getIndexer().getIndexAllFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ITranslationUnit findContext(IIndex index, IIndexFileLocation location) {
|
protected ITranslationUnit findContext(IIndex index, IIndexFileLocation location) {
|
||||||
Object cachedContext= fContextMap.get(location);
|
Object cachedContext= fContextMap.get(location);
|
||||||
if (cachedContext != null) {
|
if (cachedContext != null) {
|
||||||
return cachedContext == NO_CONTEXT ? null : (ITranslationUnit) cachedContext;
|
return cachedContext == NO_CONTEXT ? null : (ITranslationUnit) cachedContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
fContextMap.put(location, NO_CONTEXT); // prevent recursion
|
fContextMap.put(location, NO_CONTEXT); // prevent recursion
|
||||||
IIndexFile pdomFile;
|
IIndexFile pdomFile;
|
||||||
try {
|
try {
|
||||||
|
@ -316,12 +316,12 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMonitorMessageDetail() {
|
public String getMonitorMessageDetail() {
|
||||||
return fMessage;
|
return fMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final public int estimateRemainingSources() {
|
final public int estimateRemainingSources() {
|
||||||
return fTotalSourcesEstimate-fCompletedSources;
|
return fTotalSourcesEstimate-fCompletedSources;
|
||||||
}
|
}
|
||||||
|
@ -333,8 +333,8 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||||
public int getCompletedSourcesCount() {
|
public int getCompletedSourcesCount() {
|
||||||
return fCompletedSources;
|
return fCompletedSources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void addSymbols(IASTTranslationUnit ast, IProgressMonitor pm) throws InterruptedException, CoreException {
|
protected void addSymbols(IASTTranslationUnit ast, IProgressMonitor pm) throws InterruptedException, CoreException {
|
||||||
final Map symbolMap= new HashMap();
|
final Map symbolMap= new HashMap();
|
||||||
try {
|
try {
|
||||||
|
@ -359,8 +359,8 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||||
fReferenceCount++;
|
fReferenceCount++;
|
||||||
else
|
else
|
||||||
fDeclarationCount++;
|
fDeclarationCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
fResolutionTime += System.currentTimeMillis()-start;
|
fResolutionTime += System.currentTimeMillis()-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,7 +374,7 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||||
if (pm.isCanceled())
|
if (pm.isCanceled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IIndexFileLocation path = orderedPaths[i];
|
IIndexFileLocation path = orderedPaths[i];
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
if (fShowActivity) {
|
if (fShowActivity) {
|
||||||
System.out.println("Indexer: adding " + path.getURI()); //$NON-NLS-1$
|
System.out.println("Indexer: adding " + path.getURI()); //$NON-NLS-1$
|
||||||
|
@ -448,7 +448,7 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||||
orderedIncludes.add(currentPath);
|
orderedIncludes.add(currentPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// macros
|
// macros
|
||||||
IASTPreprocessorMacroDefinition[] macros = ast.getMacroDefinitions();
|
IASTPreprocessorMacroDefinition[] macros = ast.getMacroDefinitions();
|
||||||
for (int i2 = 0; i2 < macros.length; ++i2) {
|
for (int i2 = 0; i2 < macros.length; ++i2) {
|
||||||
|
@ -459,7 +459,7 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||||
addToMap(symbolMap, 1, path2, macro);
|
addToMap(symbolMap, 1, path2, macro);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// names
|
// names
|
||||||
ast.accept(new IndexerASTVisitor() {
|
ast.accept(new IndexerASTVisitor() {
|
||||||
public void visit(IASTName name, IASTName caller) {
|
public void visit(IASTName name, IASTName caller) {
|
||||||
|
@ -517,7 +517,7 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||||
}
|
}
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void traceEnd(long start) {
|
protected void traceEnd(long start) {
|
||||||
if (fShowStatistics) {
|
if (fShowStatistics) {
|
||||||
String name= getClass().getName();
|
String name= getClass().getName();
|
||||||
|
@ -544,13 +544,13 @@ public abstract class PDOMIndexerTask implements IPDOMIndexerTask {
|
||||||
+ fProblemBindingCount + "(" + nf.format(problemPct) + ") problems."); //$NON-NLS-1$ //$NON-NLS-2$
|
+ fProblemBindingCount + "(" + nf.format(problemPct) + ") problems."); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IIndexFileLocation getIndexFileLocation(ITranslationUnit tu) {
|
protected IIndexFileLocation getIndexFileLocation(ITranslationUnit tu) {
|
||||||
if(tu.getResource()!=null)
|
if(tu.getResource()!=null)
|
||||||
return IndexLocationFactory.getWorkspaceIFL((IFile)tu.getResource());
|
return IndexLocationFactory.getWorkspaceIFL((IFile)tu.getResource());
|
||||||
else
|
else
|
||||||
return IndexLocationFactory.getExternalIFL(tu.getLocation());
|
return IndexLocationFactory.getExternalIFL(tu.getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract IIndexFileLocation findLocation(String absolutePath);
|
protected abstract IIndexFileLocation findLocation(String absolutePath);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue