1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

More tracing for files indexed up front.

This commit is contained in:
Markus Schorn 2009-11-04 10:46:30 +00:00
parent 050f7ed2c8
commit 7ac0ae1e69
2 changed files with 21 additions and 5 deletions

View file

@ -24,6 +24,7 @@ import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIncludeStatement;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit.IDependencyTree;
@ -532,14 +533,14 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
final IPath path= new Path(filePath);
final String fileName = path.lastSegment();
try {
if (fShowActivity) {
trace("Indexer: parsing " + filePath + " up front"); //$NON-NLS-1$ //$NON-NLS-2$
}
monitor.subTask(getMessage(MessageKind.parsingFileTask,
fileName, path.removeLastSegments(1).toString()));
AbstractLanguage[] langs= getLanguages(fileName);
for (AbstractLanguage lang : langs) {
if (fShowActivity) {
trace("Indexer: " + lang.getName() + ": Parsing " + filePath + " up front"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
int linkageID= lang.getLinkageID();
String code= "#include \"" + filePath + "\"\n"; //$NON-NLS-1$ //$NON-NLS-2$
@ -548,8 +549,23 @@ public abstract class AbstractIndexerTask extends PDOMWriter {
long start= System.currentTimeMillis();
IASTTranslationUnit ast= createAST(code, lang, scanInfo, fASTOptions, monitor);
fStatistics.fParsingTime += System.currentTimeMillis()-start;
if (ast != null) {
if (fShowActivity || fShowInclusionProblems) {
IASTNode node= ast.getNodeSelector(null).findEnclosingNode(0,6);
if (node instanceof IASTPreprocessorIncludeStatement) {
IASTPreprocessorIncludeStatement p= (IASTPreprocessorIncludeStatement) node;
String found= p.getPath();
if (found != null) {
IIndexFileLocation ifl= fResolver.resolveASTPath(found);
FileContent fileinfo = getFileInfo(linkageID, ifl);
if (fileinfo != null) {
if (fileinfo.fIndexFile != null) {
trace(filePath + " was not properly parsed up front for " + lang.getName()); //$NON-NLS-1$
}
}
}
}
}
writeToIndex(linkageID, ast, computeHashCode(scanInfo), monitor);
updateFileCount(0, 0, 1);
}

View file

@ -80,7 +80,7 @@ abstract public class PDOMWriter {
ArrayList<IASTPreprocessorIncludeStatement> fIncludes= new ArrayList<IASTPreprocessorIncludeStatement>();
}
private boolean fShowProblems;
private boolean fShowInclusionProblems;
protected boolean fShowInclusionProblems;
private boolean fShowScannerProblems;
private boolean fShowSyntaxProblems;
protected boolean fShowActivity;