1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-26 02:15:31 +02:00

Add tracing for unresolved includes

This commit is contained in:
Markus Schorn 2007-04-04 15:37:26 +00:00
parent 49724e630c
commit 1152d73794
3 changed files with 21 additions and 2 deletions

View file

@ -217,6 +217,9 @@ abstract public class PDOMWriter {
stack.add(currentPath);
currentPath= findLocation(include.getPath());
}
else if (include.isActive()) {
reportProblem(include);
}
}
stack.add(currentPath);
while (!stack.isEmpty()) {
@ -286,10 +289,22 @@ abstract public class PDOMWriter {
}
private void reportProblem(IASTPreprocessorIncludeStatement problem) {
fStatistics.fUnresolvedIncludes++;
if (fShowProblems) {
String msg= "Indexer: unresolved include"; //$NON-NLS-1$
IASTFileLocation loc= problem.getFileLocation();
if (loc != null && loc.getFileName() != null) {
msg += " at " + loc.getFileName() + ": " + loc.getStartingLineNumber(); //$NON-NLS-1$ //$NON-NLS-2$
}
System.out.println(msg);
}
}
private void reportProblem(IProblemBinding problem) {
fStatistics.fProblemBindingCount++;
if (fShowProblems) {
String msg= "Indexer problem at "+ problem.getFileName() + ": " + problem.getLineNumber(); //$NON-NLS-1$//$NON-NLS-2$
String msg= "Indexer: problem at "+ problem.getFileName() + ": " + problem.getLineNumber(); //$NON-NLS-1$//$NON-NLS-2$
String pmsg= problem.getMessage();
if (pmsg != null && pmsg.length() > 0)
msg+= "; " + problem.getMessage(); //$NON-NLS-1$

View file

@ -19,4 +19,5 @@ public class IndexerStatistics {
public int fReferenceCount= 0;
public int fDeclarationCount= 0;
public int fProblemBindingCount= 0;
public int fUnresolvedIncludes= 0;
}

View file

@ -430,6 +430,10 @@ public abstract class PDOMIndexerTask extends PDOMWriter implements IPDOMIndexer
+ fStatistics.fParsingTime + " parser, " //$NON-NLS-1$
+ fStatistics.fResolutionTime + " resolution, " //$NON-NLS-1$
+ fStatistics.fAddToIndexTime + " index update."); //$NON-NLS-1$
System.out.println(name + " Errors: " //$NON-NLS-1$
+ fStatistics.fUnresolvedIncludes + " unresolved includes, " //$NON-NLS-1$
+ fStatistics.fErrorCount + " unexpected errors."); //$NON-NLS-1$
int sum= fStatistics.fDeclarationCount+fStatistics.fReferenceCount+fStatistics.fProblemBindingCount;
double problemPct= sum==0 ? 0.0 : (double) fStatistics.fProblemBindingCount / (double) sum;
NumberFormat nf= NumberFormat.getPercentInstance();
@ -438,7 +442,6 @@ public abstract class PDOMIndexerTask extends PDOMWriter implements IPDOMIndexer
System.out.println(name + " Result: " //$NON-NLS-1$
+ fStatistics.fDeclarationCount + " declarations, " //$NON-NLS-1$
+ fStatistics.fReferenceCount + " references, " //$NON-NLS-1$
+ fStatistics.fErrorCount + " errors, " //$NON-NLS-1$
+ fStatistics.fProblemBindingCount + "(" + nf.format(problemPct) + ") problems."); //$NON-NLS-1$ //$NON-NLS-2$
if (index != null) {