mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-05 07:15:39 +02:00
More preparation for language specific PDOM bindings. Including a fancy new language registary since language ID will be stored in the database.
This commit is contained in:
parent
fe67ae0785
commit
56254fd6f3
5 changed files with 138 additions and 100 deletions
|
@ -12,11 +12,13 @@
|
||||||
package org.eclipse.cdt.core.dom;
|
package org.eclipse.cdt.core.dom;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
||||||
import org.eclipse.cdt.internal.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.pdom.dom.PDOMBinding;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
|
@ -45,6 +47,22 @@ public interface ILanguage {
|
||||||
*/
|
*/
|
||||||
public static final int AST_SKIP_INDEXED_HEADERS = 4;
|
public static final int AST_SKIP_INDEXED_HEADERS = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the language id for this language. This is used in the PDOM database
|
||||||
|
* to differentiate languages from eachother.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int getId();
|
||||||
|
|
||||||
|
// Language ID registry. This is here mainly to avoid languages trampling
|
||||||
|
// over eachother. It is not critical that language ids be put here, but it
|
||||||
|
// is critical that two languages in a given installion do not have the same
|
||||||
|
// id.
|
||||||
|
public static final int GCC_ID = 1; // gnu C
|
||||||
|
public static final int GPP_ID = 2; // gnu C++
|
||||||
|
public static final int GNAT_ID = 3; // gnu Ada
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the AST for the given translation unit with the given style.
|
* Create the AST for the given translation unit with the given style.
|
||||||
*
|
*
|
||||||
|
@ -65,20 +83,23 @@ public interface ILanguage {
|
||||||
public ASTCompletionNode getCompletionNode(IWorkingCopy workingCopy, int offset);
|
public ASTCompletionNode getCompletionNode(IWorkingCopy workingCopy, int offset);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the PDOM Binding for the given AST binding.
|
* Return the PDOM Binding for the given name. Create a new one if necessary
|
||||||
|
* and store it in the PDOM.
|
||||||
*
|
*
|
||||||
* @param binding
|
* @param binding
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public PDOMBinding getPDOMBinding(IBinding binding);
|
public PDOMBinding getPDOMBinding(PDOMDatabase pdom, IASTName name) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a new PDOM Binding that has the given language specific type.
|
* Return a new PDOM Binding that has the given language specific type.
|
||||||
* The type id is extracted from the PDOM Database.
|
* The type id is extracted from the PDOM Database.
|
||||||
*
|
*
|
||||||
|
* @param pdom
|
||||||
* @param bindingType
|
* @param bindingType
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public PDOMBinding createPDOMBinding(int bindingType);
|
public PDOMBinding createPDOMBinding(PDOMDatabase pdom, int bindingType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,13 @@ package org.eclipse.cdt.core.dom.ast.gnu.c;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
||||||
import org.eclipse.cdt.core.dom.ILanguage;
|
import org.eclipse.cdt.core.dom.ILanguage;
|
||||||
import org.eclipse.cdt.core.dom.PDOM;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||||
import org.eclipse.cdt.core.parser.CodeReader;
|
import org.eclipse.cdt.core.parser.CodeReader;
|
||||||
|
@ -36,9 +39,14 @@ import org.eclipse.cdt.internal.core.dom.parser.c.GNUCSourceParser;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.DOMScanner;
|
import org.eclipse.cdt.internal.core.parser.scanner2.DOMScanner;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.GCCScannerExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.GCCScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerExtensionConfiguration;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
||||||
import org.eclipse.cdt.internal.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.pdom.dom.PDOMBinding;
|
||||||
|
import org.eclipse.cdt.internal.pdom.dom.PDOMName;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
|
@ -48,6 +56,10 @@ public class GCCLanguage implements ILanguage {
|
||||||
|
|
||||||
protected static final GCCScannerExtensionConfiguration C_GNU_SCANNER_EXTENSION = new GCCScannerExtensionConfiguration();
|
protected static final GCCScannerExtensionConfiguration C_GNU_SCANNER_EXTENSION = new GCCScannerExtensionConfiguration();
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return GCC_ID;
|
||||||
|
}
|
||||||
|
|
||||||
public IASTTranslationUnit getTranslationUnit(ITranslationUnit tu, int style) {
|
public IASTTranslationUnit getTranslationUnit(ITranslationUnit tu, int style) {
|
||||||
IFile file = (IFile)tu.getResource();
|
IFile file = (IFile)tu.getResource();
|
||||||
IProject project = file.getProject();
|
IProject project = file.getProject();
|
||||||
|
@ -90,12 +102,37 @@ public class GCCLanguage implements ILanguage {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMBinding getPDOMBinding(IBinding binding) {
|
public PDOMBinding getPDOMBinding(PDOMDatabase pdom, IASTName name) throws CoreException {
|
||||||
// TODO Auto-generated method stub
|
try {
|
||||||
return null;
|
IBinding binding = name.resolveBinding();
|
||||||
|
if (binding == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
IScope scope = binding.getScope();
|
||||||
|
if (scope == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
PDOMBinding pdomBinding = null;
|
||||||
|
IASTName scopeName = scope.getScopeName();
|
||||||
|
|
||||||
|
if (scopeName == null) {
|
||||||
|
pdomBinding = new PDOMBinding(pdom, name, binding);
|
||||||
|
new PDOMName(pdom, name, pdomBinding);
|
||||||
|
} else {
|
||||||
|
IBinding scopeBinding = scopeName.resolveBinding();
|
||||||
|
if (scopeBinding instanceof IType) {
|
||||||
|
pdomBinding = new PDOMBinding(pdom, name, binding);
|
||||||
|
new PDOMName(pdom, name, pdomBinding);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(new Status(IStatus.ERROR,
|
||||||
|
CCorePlugin.PLUGIN_ID, 0, "DOM Exception", e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMBinding createPDOMBinding(int bindingType) {
|
public PDOMBinding createPDOMBinding(PDOMDatabase pdom, int bindingType) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,12 @@ import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
||||||
import org.eclipse.cdt.core.dom.ILanguage;
|
import org.eclipse.cdt.core.dom.ILanguage;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
import org.eclipse.cdt.core.dom.ast.ASTCompletionNode;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||||
import org.eclipse.cdt.core.parser.CodeReader;
|
import org.eclipse.cdt.core.parser.CodeReader;
|
||||||
|
@ -35,9 +39,14 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.GPPParserExtensionConfigurat
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.DOMScanner;
|
import org.eclipse.cdt.internal.core.parser.scanner2.DOMScanner;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.GPPScannerExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.GPPScannerExtensionConfiguration;
|
||||||
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerExtensionConfiguration;
|
import org.eclipse.cdt.internal.core.parser.scanner2.IScannerExtensionConfiguration;
|
||||||
|
import org.eclipse.cdt.internal.core.pdom.PDOMDatabase;
|
||||||
import org.eclipse.cdt.internal.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.pdom.dom.PDOMBinding;
|
||||||
|
import org.eclipse.cdt.internal.pdom.dom.PDOMName;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
|
@ -47,6 +56,10 @@ public class GPPLanguage implements ILanguage {
|
||||||
|
|
||||||
protected static final GPPScannerExtensionConfiguration CPP_GNU_SCANNER_EXTENSION = new GPPScannerExtensionConfiguration();
|
protected static final GPPScannerExtensionConfiguration CPP_GNU_SCANNER_EXTENSION = new GPPScannerExtensionConfiguration();
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return GPP_ID;
|
||||||
|
}
|
||||||
|
|
||||||
public IASTTranslationUnit getTranslationUnit(ITranslationUnit tu, int style) {
|
public IASTTranslationUnit getTranslationUnit(ITranslationUnit tu, int style) {
|
||||||
IFile file = (IFile)tu.getResource();
|
IFile file = (IFile)tu.getResource();
|
||||||
IProject project = file.getProject();
|
IProject project = file.getProject();
|
||||||
|
@ -88,12 +101,37 @@ public class GPPLanguage implements ILanguage {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMBinding getPDOMBinding(IBinding binding) {
|
public PDOMBinding getPDOMBinding(PDOMDatabase pdom, IASTName name) throws CoreException {
|
||||||
// TODO Auto-generated method stub
|
try {
|
||||||
return null;
|
IBinding binding = name.resolveBinding();
|
||||||
|
if (binding == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
IScope scope = binding.getScope();
|
||||||
|
if (scope == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
PDOMBinding pdomBinding = null;
|
||||||
|
IASTName scopeName = scope.getScopeName();
|
||||||
|
|
||||||
|
if (scopeName == null) {
|
||||||
|
pdomBinding = new PDOMBinding(pdom, name, binding);
|
||||||
|
new PDOMName(pdom, name, pdomBinding);
|
||||||
|
} else {
|
||||||
|
IBinding scopeBinding = scopeName.resolveBinding();
|
||||||
|
if (scopeBinding instanceof IType) {
|
||||||
|
pdomBinding = new PDOMBinding(pdom, name, binding);
|
||||||
|
new PDOMName(pdom, name, pdomBinding);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
} catch (DOMException e) {
|
||||||
|
throw new CoreException(new Status(IStatus.ERROR,
|
||||||
|
CCorePlugin.PLUGIN_ID, 0, "DOM Exception", e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PDOMBinding createPDOMBinding(int bindingType) {
|
public PDOMBinding createPDOMBinding(PDOMDatabase pdom, int bindingType) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
import org.eclipse.cdt.core.dom.ICodeReaderFactory;
|
||||||
|
import org.eclipse.cdt.core.dom.ILanguage;
|
||||||
import org.eclipse.cdt.core.dom.IPDOM;
|
import org.eclipse.cdt.core.dom.IPDOM;
|
||||||
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
|
@ -23,11 +24,8 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
|
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.core.model.IWorkingCopy;
|
import org.eclipse.cdt.core.model.IWorkingCopy;
|
||||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.BTree;
|
import org.eclipse.cdt.internal.core.pdom.db.BTree;
|
||||||
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
import org.eclipse.cdt.internal.core.pdom.db.Database;
|
||||||
import org.eclipse.cdt.internal.pdom.dom.PDOMBinding;
|
import org.eclipse.cdt.internal.pdom.dom.PDOMBinding;
|
||||||
|
@ -104,68 +102,32 @@ public class PDOMDatabase implements IPDOM {
|
||||||
return bindingIndex;
|
return bindingIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSymbols(IASTTranslationUnit ast) {
|
public void addSymbols(ITranslationUnit tu) throws CoreException {
|
||||||
ParserLanguage language = ast.getParserLanguage();
|
final ILanguage language = tu.getLanguage();
|
||||||
ASTVisitor visitor;
|
if (language == null)
|
||||||
if (language == ParserLanguage.C)
|
|
||||||
visitor = new CASTVisitor() {
|
|
||||||
{
|
|
||||||
shouldVisitNames = true;
|
|
||||||
shouldVisitDeclarations = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int visit(IASTName name) {
|
|
||||||
if (name.toCharArray().length > 0)
|
|
||||||
addSymbol(name);
|
|
||||||
return PROCESS_CONTINUE;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
else if (language == ParserLanguage.CPP)
|
|
||||||
visitor = new CPPASTVisitor() {
|
|
||||||
{
|
|
||||||
shouldVisitNames = true;
|
|
||||||
shouldVisitDeclarations = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int visit(IASTName name) {
|
|
||||||
if (name.toCharArray().length > 0)
|
|
||||||
addSymbol(name);
|
|
||||||
return PROCESS_CONTINUE;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
else
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
IASTTranslationUnit ast = language.getTranslationUnit(tu,
|
||||||
|
ILanguage.AST_USE_INDEX |
|
||||||
|
ILanguage.AST_SKIP_INDEXED_HEADERS);
|
||||||
|
|
||||||
ast.accept(visitor);
|
ast.accept(new ASTVisitor() {
|
||||||
}
|
{
|
||||||
|
shouldVisitNames = true;
|
||||||
public void addSymbol(IASTName name) {
|
shouldVisitDeclarations = true;
|
||||||
try {
|
}
|
||||||
IBinding binding = name.resolveBinding();
|
|
||||||
if (binding == null)
|
public int visit(IASTName name) {
|
||||||
return;
|
try {
|
||||||
|
if (name.toCharArray().length > 0)
|
||||||
IScope scope = binding.getScope();
|
language.getPDOMBinding(PDOMDatabase.this, name);
|
||||||
if (scope == null)
|
return PROCESS_CONTINUE;
|
||||||
return;
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
IASTName scopeName = scope.getScopeName();
|
return PROCESS_ABORT;
|
||||||
|
}
|
||||||
if (scopeName == null) {
|
};
|
||||||
PDOMBinding pdomBinding = new PDOMBinding(this, name, binding);
|
});;
|
||||||
new PDOMName(this, name, pdomBinding);
|
|
||||||
} else {
|
|
||||||
IBinding scopeBinding = scopeName.resolveBinding();
|
|
||||||
if (scopeBinding instanceof IType) {
|
|
||||||
PDOMBinding pdomBinding = new PDOMBinding(this, name, binding);
|
|
||||||
new PDOMName(this, name, pdomBinding);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
CCorePlugin.log(e);
|
|
||||||
} catch (DOMException e) {
|
|
||||||
CCorePlugin.log(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeSymbols(ITranslationUnit ast) {
|
public void removeSymbols(ITranslationUnit ast) {
|
||||||
|
|
|
@ -187,20 +187,12 @@ public class PDOMUpdator extends Job {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processAddedTU(ITranslationUnit tu) throws CoreException {
|
private void processAddedTU(ITranslationUnit tu) throws CoreException {
|
||||||
ILanguage language = tu.getLanguage();
|
IPDOM pdom = tu.getCProject().getIndex();
|
||||||
if (language == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
IASTTranslationUnit ast = language.getTranslationUnit(tu,
|
|
||||||
ILanguage.AST_USE_INDEX |
|
|
||||||
ILanguage.AST_SKIP_INDEXED_HEADERS);
|
|
||||||
|
|
||||||
IPDOM pdom = ast.getIndex();
|
|
||||||
if (pdom == null || !(pdom instanceof PDOMDatabase))
|
if (pdom == null || !(pdom instanceof PDOMDatabase))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PDOMDatabase mypdom = (PDOMDatabase)pdom;
|
PDOMDatabase mypdom = (PDOMDatabase)pdom;
|
||||||
mypdom.addSymbols(ast);
|
mypdom.addSymbols(tu);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processRemovedTU(ITranslationUnit tu) {
|
private void processRemovedTU(ITranslationUnit tu) {
|
||||||
|
@ -219,20 +211,8 @@ public class PDOMUpdator extends Job {
|
||||||
return;
|
return;
|
||||||
PDOMDatabase mypdom = (PDOMDatabase)pdom;
|
PDOMDatabase mypdom = (PDOMDatabase)pdom;
|
||||||
|
|
||||||
ILanguage language = tu.getLanguage();
|
|
||||||
if (language == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
IASTTranslationUnit ast = language.getTranslationUnit(tu,
|
|
||||||
ILanguage.AST_SKIP_ALL_HEADERS |
|
|
||||||
ILanguage.AST_USE_INDEX);
|
|
||||||
|
|
||||||
if (pdom != ast.getIndex())
|
|
||||||
// weird
|
|
||||||
return;
|
|
||||||
|
|
||||||
mypdom.removeSymbols(tu);
|
mypdom.removeSymbols(tu);
|
||||||
mypdom.addSymbols(ast);
|
mypdom.addSymbols(tu);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue