mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 03:45:35 +02:00
Using directives for fast indexer with cross references disabled, related to 200673+216527.
This commit is contained in:
parent
2e0d07d89b
commit
190c472757
2 changed files with 15 additions and 10 deletions
|
@ -33,6 +33,7 @@ import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDirective;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplate;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
|
||||||
|
@ -212,7 +213,7 @@ abstract public class PDOMWriter {
|
||||||
reportProblem((IProblemBinding) binding);
|
reportProblem((IProblemBinding) binding);
|
||||||
else if (name.isReference()) {
|
else if (name.isReference()) {
|
||||||
if (fSkipReferences == SKIP_TYPE_REFERENCES) {
|
if (fSkipReferences == SKIP_TYPE_REFERENCES) {
|
||||||
if (isTypeReferenceBinding(binding) && !isInheritanceSpec(name)) {
|
if (isTypeReferenceBinding(binding) && !isRequiredReference(name)) {
|
||||||
na[0]= null;
|
na[0]= null;
|
||||||
fStatistics.fReferenceCount--;
|
fStatistics.fReferenceCount--;
|
||||||
}
|
}
|
||||||
|
@ -284,10 +285,11 @@ abstract public class PDOMWriter {
|
||||||
|
|
||||||
// names
|
// names
|
||||||
ast.accept(new IndexerASTVisitor() {
|
ast.accept(new IndexerASTVisitor() {
|
||||||
|
@Override
|
||||||
public void visit(IASTName name, IASTName caller) {
|
public void visit(IASTName name, IASTName caller) {
|
||||||
if (fSkipReferences == SKIP_ALL_REFERENCES) {
|
if (fSkipReferences == SKIP_ALL_REFERENCES) {
|
||||||
if (name.isReference()) {
|
if (name.isReference()) {
|
||||||
if (!isInheritanceSpec(name)) {
|
if (!isRequiredReference(name)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -306,7 +308,7 @@ abstract public class PDOMWriter {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isInheritanceSpec(IASTName name) {
|
protected final boolean isRequiredReference(IASTName name) {
|
||||||
IASTNode parentNode= name.getParent();
|
IASTNode parentNode= name.getParent();
|
||||||
if (parentNode instanceof ICPPASTBaseSpecifier) {
|
if (parentNode instanceof ICPPASTBaseSpecifier) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -315,6 +317,9 @@ abstract public class PDOMWriter {
|
||||||
IASTDeclSpecifier ds= (IASTDeclSpecifier) parentNode;
|
IASTDeclSpecifier ds= (IASTDeclSpecifier) parentNode;
|
||||||
return ds.getStorageClass() == IASTDeclSpecifier.sc_typedef;
|
return ds.getStorageClass() == IASTDeclSpecifier.sc_typedef;
|
||||||
}
|
}
|
||||||
|
else if (parentNode instanceof ICPPASTUsingDirective) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,7 +427,7 @@ abstract public class PDOMWriter {
|
||||||
* Makes a copy of the current progress information and returns it.
|
* Makes a copy of the current progress information and returns it.
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
protected IndexerProgress getProgressInformation() {
|
public IndexerProgress getProgressInformation() {
|
||||||
synchronized (fInfo) {
|
synchronized (fInfo) {
|
||||||
return new IndexerProgress(fInfo);
|
return new IndexerProgress(fInfo);
|
||||||
}
|
}
|
||||||
|
@ -432,7 +437,7 @@ abstract public class PDOMWriter {
|
||||||
* Updates current progress information with the provided delta.
|
* Updates current progress information with the provided delta.
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
protected void updateInfo(int completedSources, int completedHeaders, int totalEstimate) {
|
protected final void updateInfo(int completedSources, int completedHeaders, int totalEstimate) {
|
||||||
synchronized(fInfo) {
|
synchronized(fInfo) {
|
||||||
fInfo.fCompletedHeaders+= completedHeaders;
|
fInfo.fCompletedHeaders+= completedHeaders;
|
||||||
fInfo.fCompletedSources+= completedSources;
|
fInfo.fCompletedSources+= completedSources;
|
||||||
|
|
|
@ -91,11 +91,6 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
traceEnd(start, fIndex);
|
traceEnd(start, fIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IndexerProgress getProgressInformation() {
|
|
||||||
return super.getProgressInformation();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether a given debug option is enabled. See {@link IPDOMIndexerTask}
|
* Checks whether a given debug option is enabled. See {@link IPDOMIndexerTask}
|
||||||
* for valid values.
|
* for valid values.
|
||||||
|
@ -116,6 +111,7 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
protected String getASTPathForParsingUpFront() {
|
protected String getASTPathForParsingUpFront() {
|
||||||
final IProject project = getProject().getProject();
|
final IProject project = getProject().getProject();
|
||||||
final IPath prjLocation= project.getLocation();
|
final IPath prjLocation= project.getLocation();
|
||||||
|
@ -125,6 +121,7 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
return prjLocation.append(super.getASTPathForParsingUpFront()).toString();
|
return prjLocation.append(super.getASTPathForParsingUpFront()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected AbstractLanguage[] getLanguages(String filename) {
|
protected AbstractLanguage[] getLanguages(String filename) {
|
||||||
IContentType ct= CCorePlugin.getContentType(filename);
|
IContentType ct= CCorePlugin.getContentType(filename);
|
||||||
if (ct != null) {
|
if (ct != null) {
|
||||||
|
@ -142,6 +139,7 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
return new AbstractLanguage[0];
|
return new AbstractLanguage[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected IScannerInfo createDefaultScannerConfig(int linkageID) {
|
protected IScannerInfo createDefaultScannerConfig(int linkageID) {
|
||||||
IProject project= getProject().getProject();
|
IProject project= getProject().getProject();
|
||||||
IScannerInfoProvider provider= CCorePlugin.getDefault().getScannerInfoProvider(project);
|
IScannerInfoProvider provider= CCorePlugin.getDefault().getScannerInfoProvider(project);
|
||||||
|
@ -159,6 +157,7 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
return getIndexer().getProject();
|
return getIndexer().getProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected final IWritableIndex createIndex() {
|
protected final IWritableIndex createIndex() {
|
||||||
try {
|
try {
|
||||||
return ((IWritableIndexManager) CCorePlugin.getIndexManager()).getWritableIndex(getProject());
|
return ((IWritableIndexManager) CCorePlugin.getIndexManager()).getWritableIndex(getProject());
|
||||||
|
@ -168,6 +167,7 @@ public abstract class PDOMIndexerTask extends AbstractIndexerTask implements IPD
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected final ITodoTaskUpdater createTodoTaskUpdater() {
|
protected final ITodoTaskUpdater createTodoTaskUpdater() {
|
||||||
return new TodoTaskUpdater();
|
return new TodoTaskUpdater();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue