mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Code formatting.
This commit is contained in:
parent
e19a8cf4bc
commit
3a3a353075
3 changed files with 98 additions and 108 deletions
|
@ -39,58 +39,60 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
||||||
/**
|
/**
|
||||||
* @author aniefer
|
* @author aniefer
|
||||||
*/
|
*/
|
||||||
public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFunctionTemplate, ICPPFunction, ICPPInternalFunction {
|
public class CPPFunctionTemplate extends CPPTemplateDefinition
|
||||||
public static final class CPPFunctionTemplateProblem extends ProblemBinding implements ICPPFunctionTemplate, ICPPFunction {
|
implements ICPPFunctionTemplate, ICPPFunction, ICPPInternalFunction {
|
||||||
|
public static final class CPPFunctionTemplateProblem extends ProblemBinding
|
||||||
|
implements ICPPFunctionTemplate, ICPPFunction {
|
||||||
public CPPFunctionTemplateProblem(IASTNode node, int id, char[] arg) {
|
public CPPFunctionTemplateProblem(IASTNode node, int id, char[] arg) {
|
||||||
super(node, id, arg);
|
super(node, id, arg);
|
||||||
}
|
}
|
||||||
public ICPPTemplateParameter[] getTemplateParameters() throws DOMException {
|
public ICPPTemplateParameter[] getTemplateParameters() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
public ICPPClassTemplatePartialSpecialization[] getTemplateSpecializations() throws DOMException {
|
public ICPPClassTemplatePartialSpecialization[] getTemplateSpecializations() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
public String[] getQualifiedName() throws DOMException {
|
public String[] getQualifiedName() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
public char[][] getQualifiedNameCharArray() throws DOMException {
|
public char[][] getQualifiedNameCharArray() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
public boolean isGloballyQualified() throws DOMException {
|
public boolean isGloballyQualified() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
public boolean isMutable() throws DOMException {
|
public boolean isMutable() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
public boolean isInline() throws DOMException {
|
public boolean isInline() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
public boolean isExternC() throws DOMException {
|
public boolean isExternC() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
public IParameter[] getParameters() throws DOMException {
|
public IParameter[] getParameters() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
public IScope getFunctionScope() throws DOMException {
|
public IScope getFunctionScope() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
public IFunctionType getType() throws DOMException {
|
public IFunctionType getType() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
public boolean isStatic() throws DOMException {
|
public boolean isStatic() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
public boolean isExtern() throws DOMException {
|
public boolean isExtern() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
public boolean isAuto() throws DOMException {
|
public boolean isAuto() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
public boolean isRegister() throws DOMException {
|
public boolean isRegister() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
public boolean takesVarArgs() throws DOMException {
|
public boolean takesVarArgs() throws DOMException {
|
||||||
throw new DOMException( this );
|
throw new DOMException(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,57 +104,56 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addDefinition(IASTNode node) {
|
public void addDefinition(IASTNode node) {
|
||||||
if( !(node instanceof IASTName) )
|
if (!(node instanceof IASTName))
|
||||||
return;
|
return;
|
||||||
updateFunctionParameterBindings( (IASTName) node );
|
updateFunctionParameterBindings((IASTName) node);
|
||||||
super.addDefinition( node );
|
super.addDefinition(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addDeclaration(IASTNode node) {
|
public void addDeclaration(IASTNode node) {
|
||||||
if( !(node instanceof IASTName) )
|
if (!(node instanceof IASTName))
|
||||||
return;
|
return;
|
||||||
updateFunctionParameterBindings( (IASTName) node );
|
updateFunctionParameterBindings((IASTName) node);
|
||||||
super.addDeclaration( node );
|
super.addDeclaration(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
private void updateFunctionParameterBindings(IASTName paramName) {
|
private void updateFunctionParameterBindings(IASTName paramName) {
|
||||||
IASTName defName = definition != null ? definition : declarations[0];
|
IASTName defName = definition != null ? definition : declarations[0];
|
||||||
ICPPASTFunctionDeclarator orig = (ICPPASTFunctionDeclarator) defName.getParent();
|
ICPPASTFunctionDeclarator orig = (ICPPASTFunctionDeclarator) defName.getParent();
|
||||||
IASTParameterDeclaration [] ops = orig.getParameters();
|
IASTParameterDeclaration[] ops = orig.getParameters();
|
||||||
IASTParameterDeclaration [] nps = ((ICPPASTFunctionDeclarator)paramName.getParent()).getParameters();
|
IASTParameterDeclaration[] nps = ((ICPPASTFunctionDeclarator)paramName.getParent()).getParameters();
|
||||||
CPPParameter temp = null;
|
CPPParameter temp = null;
|
||||||
for( int i = 0; i < nps.length; i++ ){
|
for(int i = 0; i < nps.length; i++) {
|
||||||
temp = (CPPParameter) CPPVisitor.findInnermostDeclarator(ops[i].getDeclarator()).getName().getBinding();
|
temp = (CPPParameter) CPPVisitor.findInnermostDeclarator(ops[i].getDeclarator()).getName().getBinding();
|
||||||
if( temp != null ){
|
if (temp != null) {
|
||||||
IASTName name = CPPVisitor.findInnermostDeclarator(nps[i].getDeclarator()).getName();
|
IASTName name = CPPVisitor.findInnermostDeclarator(nps[i].getDeclarator()).getName();
|
||||||
name.setBinding( temp );
|
name.setBinding(temp);
|
||||||
temp.addDeclaration( name );
|
temp.addDeclaration(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IParameter[] getParameters() {
|
public IParameter[] getParameters() {
|
||||||
IASTName name = getTemplateName();
|
IASTName name = getTemplateName();
|
||||||
ICPPASTFunctionDeclarator fdecl= getDeclaratorByName(name);
|
ICPPASTFunctionDeclarator fdecl= getDeclaratorByName(name);
|
||||||
if (fdecl != null) {
|
if (fdecl != null) {
|
||||||
IASTParameterDeclaration[] params = fdecl.getParameters();
|
IASTParameterDeclaration[] params = fdecl.getParameters();
|
||||||
int size = params.length;
|
int size = params.length;
|
||||||
IParameter [] result = new IParameter[ size ];
|
IParameter[] result = new IParameter[size];
|
||||||
if( size > 0 ){
|
if (size > 0) {
|
||||||
for( int i = 0; i < size; i++ ){
|
for(int i = 0; i < size; i++) {
|
||||||
IASTParameterDeclaration p = params[i];
|
IASTParameterDeclaration p = params[i];
|
||||||
final IASTName pname = CPPVisitor.findInnermostDeclarator(p.getDeclarator()).getName();
|
final IASTName pname = CPPVisitor.findInnermostDeclarator(p.getDeclarator()).getName();
|
||||||
final IBinding binding= pname.resolveBinding();
|
final IBinding binding= pname.resolveBinding();
|
||||||
if (binding instanceof IParameter) {
|
if (binding instanceof IParameter) {
|
||||||
result[i]= (IParameter) binding;
|
result[i]= (IParameter) binding;
|
||||||
}
|
} else {
|
||||||
else {
|
result[i] = new CPPParameter.CPPParameterProblem(p,
|
||||||
result[i] = new CPPParameter.CPPParameterProblem(p, IProblemBinding.SEMANTIC_INVALID_TYPE, pname.toCharArray());
|
IProblemBinding.SEMANTIC_INVALID_TYPE, pname.toCharArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,91 +162,89 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IScope getFunctionScope() {
|
public IScope getFunctionScope() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IFunctionType getType() {
|
public IFunctionType getType() {
|
||||||
if( type == null ) {
|
if (type == null) {
|
||||||
IASTName name = getTemplateName();
|
IASTName name = getTemplateName();
|
||||||
IASTNode parent = name.getParent();
|
IASTNode parent = name.getParent();
|
||||||
while( parent.getParent() instanceof IASTDeclarator )
|
while(parent.getParent() instanceof IASTDeclarator)
|
||||||
parent = parent.getParent();
|
parent = parent.getParent();
|
||||||
|
|
||||||
IType temp = CPPVisitor.createType( (IASTDeclarator)parent );
|
IType temp = CPPVisitor.createType((IASTDeclarator)parent);
|
||||||
if( temp instanceof IFunctionType )
|
if (temp instanceof IFunctionType)
|
||||||
type = (IFunctionType) temp;
|
type = (IFunctionType) temp;
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasStorageClass( int storage){
|
public boolean hasStorageClass(int storage) {
|
||||||
IASTName name = (IASTName) getDefinition();
|
IASTName name = (IASTName) getDefinition();
|
||||||
IASTNode[] ns = getDeclarations();
|
IASTNode[] ns = getDeclarations();
|
||||||
int i = -1;
|
int i = -1;
|
||||||
do{
|
do {
|
||||||
if( name != null ){
|
if (name != null) {
|
||||||
IASTNode parent = name.getParent();
|
IASTNode parent = name.getParent();
|
||||||
while( !(parent instanceof IASTDeclaration) )
|
while(!(parent instanceof IASTDeclaration))
|
||||||
parent = parent.getParent();
|
parent = parent.getParent();
|
||||||
|
|
||||||
IASTDeclSpecifier declSpec = null;
|
IASTDeclSpecifier declSpec = null;
|
||||||
if( parent instanceof IASTSimpleDeclaration )
|
if (parent instanceof IASTSimpleDeclaration) {
|
||||||
declSpec = ((IASTSimpleDeclaration)parent).getDeclSpecifier();
|
declSpec = ((IASTSimpleDeclaration)parent).getDeclSpecifier();
|
||||||
else if( parent instanceof IASTFunctionDefinition )
|
} else if (parent instanceof IASTFunctionDefinition) {
|
||||||
declSpec = ((IASTFunctionDefinition)parent).getDeclSpecifier();
|
declSpec = ((IASTFunctionDefinition)parent).getDeclSpecifier();
|
||||||
if( declSpec != null && declSpec.getStorageClass() == storage ) {
|
}
|
||||||
|
if (declSpec != null && declSpec.getStorageClass() == storage) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( ns != null && ++i < ns.length )
|
if (ns != null && ++i < ns.length)
|
||||||
name = (IASTName) ns[i];
|
name = (IASTName) ns[i];
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
} while( name != null );
|
} while (name != null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IBinding resolveParameter(IASTParameterDeclaration param) {
|
public IBinding resolveParameter(IASTParameterDeclaration param) {
|
||||||
IASTName name = CPPVisitor.findInnermostDeclarator(param.getDeclarator()).getName();
|
IASTName name = CPPVisitor.findInnermostDeclarator(param.getDeclarator()).getName();
|
||||||
IBinding binding = name.getBinding();
|
IBinding binding = name.getBinding();
|
||||||
if( binding != null )
|
if (binding != null)
|
||||||
return binding;
|
return binding;
|
||||||
|
|
||||||
ICPPASTFunctionDeclarator fdtor = (ICPPASTFunctionDeclarator) param.getParent();
|
ICPPASTFunctionDeclarator fdtor = (ICPPASTFunctionDeclarator) param.getParent();
|
||||||
IASTParameterDeclaration [] ps = fdtor.getParameters();
|
IASTParameterDeclaration[] ps = fdtor.getParameters();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for( ; i < ps.length; i++ ){
|
for (; i < ps.length; i++) {
|
||||||
if( param == ps[i] )
|
if (param == ps[i])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//create a new binding and set it for the corresponding parameter in all known defns and decls
|
//create a new binding and set it for the corresponding parameter in all known defns and decls
|
||||||
binding = new CPPParameter( name );
|
binding = new CPPParameter(name);
|
||||||
IASTParameterDeclaration temp = null;
|
IASTParameterDeclaration temp = null;
|
||||||
if( definition != null ){
|
if (definition != null) {
|
||||||
ICPPASTFunctionDeclarator fdecl= getDeclaratorByName(definition);
|
ICPPASTFunctionDeclarator fdecl= getDeclaratorByName(definition);
|
||||||
if (fdecl != null) {
|
if (fdecl != null) {
|
||||||
temp = fdecl.getParameters()[i];
|
temp = fdecl.getParameters()[i];
|
||||||
IASTName n = CPPVisitor.findInnermostDeclarator(temp.getDeclarator()).getName();
|
IASTName n = CPPVisitor.findInnermostDeclarator(temp.getDeclarator()).getName();
|
||||||
if( n != name ) {
|
if (n != name) {
|
||||||
n.setBinding( binding );
|
n.setBinding(binding);
|
||||||
((CPPParameter)binding).addDeclaration( n );
|
((CPPParameter)binding).addDeclaration(n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( declarations != null ){
|
if (declarations != null) {
|
||||||
for( int j = 0; j < declarations.length && declarations[j] != null; j++ ){
|
for(int j = 0; j < declarations.length && declarations[j] != null; j++) {
|
||||||
ICPPASTFunctionDeclarator fdecl= getDeclaratorByName(declarations[j]);
|
ICPPASTFunctionDeclarator fdecl= getDeclaratorByName(declarations[j]);
|
||||||
if (fdecl != null) {
|
if (fdecl != null) {
|
||||||
temp = fdecl.getParameters()[i];
|
temp = fdecl.getParameters()[i];
|
||||||
IASTName n = CPPVisitor.findInnermostDeclarator(temp.getDeclarator()).getName();
|
IASTName n = CPPVisitor.findInnermostDeclarator(temp.getDeclarator()).getName();
|
||||||
if( n != name ) {
|
if (n != name) {
|
||||||
n.setBinding( binding );
|
n.setBinding(binding);
|
||||||
((CPPParameter)binding).addDeclaration( n );
|
((CPPParameter)binding).addDeclaration(n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -254,38 +253,38 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStatic() {
|
public boolean isStatic() {
|
||||||
return hasStorageClass( IASTDeclSpecifier.sc_static);
|
return hasStorageClass(IASTDeclSpecifier.sc_static);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMutable() {
|
public boolean isMutable() {
|
||||||
return hasStorageClass( ICPPASTDeclSpecifier.sc_mutable);
|
return hasStorageClass(ICPPASTDeclSpecifier.sc_mutable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isInline() throws DOMException {
|
public boolean isInline() throws DOMException {
|
||||||
IASTName name = (IASTName) getDefinition();
|
IASTName name = (IASTName) getDefinition();
|
||||||
IASTNode[] ns = getDeclarations();
|
IASTNode[] ns = getDeclarations();
|
||||||
int i = -1;
|
int i = -1;
|
||||||
do{
|
do {
|
||||||
if( name != null ){
|
if (name != null) {
|
||||||
IASTNode parent = name.getParent();
|
IASTNode parent = name.getParent();
|
||||||
while( !(parent instanceof IASTDeclaration) )
|
while(!(parent instanceof IASTDeclaration))
|
||||||
parent = parent.getParent();
|
parent = parent.getParent();
|
||||||
|
|
||||||
IASTDeclSpecifier declSpec = null;
|
IASTDeclSpecifier declSpec = null;
|
||||||
if( parent instanceof IASTSimpleDeclaration )
|
if (parent instanceof IASTSimpleDeclaration) {
|
||||||
declSpec = ((IASTSimpleDeclaration)parent).getDeclSpecifier();
|
declSpec = ((IASTSimpleDeclaration)parent).getDeclSpecifier();
|
||||||
else if( parent instanceof IASTFunctionDefinition )
|
} else if (parent instanceof IASTFunctionDefinition) {
|
||||||
declSpec = ((IASTFunctionDefinition)parent).getDeclSpecifier();
|
declSpec = ((IASTFunctionDefinition)parent).getDeclSpecifier();
|
||||||
|
}
|
||||||
|
|
||||||
if( declSpec != null && declSpec.isInline() )
|
if (declSpec != null && declSpec.isInline())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if( ns != null && ++i < ns.length )
|
if (ns != null && ++i < ns.length)
|
||||||
name = (IASTName) ns[i];
|
name = (IASTName) ns[i];
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
} while( name != null );
|
} while(name != null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,25 +303,24 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isExtern() {
|
public boolean isExtern() {
|
||||||
return hasStorageClass( IASTDeclSpecifier.sc_extern);
|
return hasStorageClass(IASTDeclSpecifier.sc_extern);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAuto() {
|
public boolean isAuto() {
|
||||||
return hasStorageClass( IASTDeclSpecifier.sc_auto );
|
return hasStorageClass(IASTDeclSpecifier.sc_auto);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRegister() {
|
public boolean isRegister() {
|
||||||
return hasStorageClass( IASTDeclSpecifier.sc_register);
|
return hasStorageClass(IASTDeclSpecifier.sc_register);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean takesVarArgs() {
|
public boolean takesVarArgs() {
|
||||||
ICPPASTFunctionDeclarator fdecl= getDeclaratorByName(getDefinition());
|
ICPPASTFunctionDeclarator fdecl= getDeclaratorByName(getDefinition());
|
||||||
if (fdecl == null) {
|
if (fdecl == null) {
|
||||||
IASTName [] ns = (IASTName[]) getDeclarations();
|
IASTName[] ns = (IASTName[]) getDeclarations();
|
||||||
if( ns != null && ns.length > 0 ){
|
if (ns != null && ns.length > 0) {
|
||||||
for (int i = 0; i < ns.length && fdecl==null; i++) {
|
for (int i = 0; i < ns.length && fdecl == null; i++) {
|
||||||
IASTName name = ns[i];
|
IASTName name = ns[i];
|
||||||
fdecl= getDeclaratorByName(name);
|
fdecl= getDeclaratorByName(name);
|
||||||
}
|
}
|
||||||
|
@ -345,8 +343,8 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStatic( boolean resolveAll ) {
|
public boolean isStatic(boolean resolveAll) {
|
||||||
return hasStorageClass( IASTDeclSpecifier.sc_static );
|
return hasStorageClass(IASTDeclSpecifier.sc_static);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class PDOMFile implements IIndexFragmentFile {
|
||||||
IString name2 = db.getString(db.getInt(record2 + LOCATION_REPRESENTATION));
|
IString name2 = db.getString(db.getInt(record2 + LOCATION_REPRESENTATION));
|
||||||
int cmp= name1.compare(name2, true);
|
int cmp= name1.compare(name2, true);
|
||||||
if (cmp == 0) {
|
if (cmp == 0) {
|
||||||
cmp= db.getInt(record1+LINKAGE_ID) - db.getInt(record2+LINKAGE_ID);
|
cmp= db.getInt(record1 + LINKAGE_ID) - db.getInt(record2 + LINKAGE_ID);
|
||||||
}
|
}
|
||||||
return cmp;
|
return cmp;
|
||||||
}
|
}
|
||||||
|
@ -243,8 +243,7 @@ public class PDOMFile implements IIndexFragmentFile {
|
||||||
IASTPreprocessorMacroDefinition macro= (IASTPreprocessorMacroDefinition) stmt;
|
IASTPreprocessorMacroDefinition macro= (IASTPreprocessorMacroDefinition) stmt;
|
||||||
PDOMMacroContainer container= linkage.getMacroContainer(macro.getName().toCharArray());
|
PDOMMacroContainer container= linkage.getMacroContainer(macro.getName().toCharArray());
|
||||||
pdomMacro = new PDOMMacro(pdom, container, macro, this);
|
pdomMacro = new PDOMMacro(pdom, container, macro, this);
|
||||||
}
|
} else if (stmt instanceof IASTPreprocessorUndefStatement) {
|
||||||
else if (stmt instanceof IASTPreprocessorUndefStatement) {
|
|
||||||
IASTPreprocessorUndefStatement undef= (IASTPreprocessorUndefStatement) stmt;
|
IASTPreprocessorUndefStatement undef= (IASTPreprocessorUndefStatement) stmt;
|
||||||
PDOMMacroContainer container= linkage.getMacroContainer(undef.getMacroName().toCharArray());
|
PDOMMacroContainer container= linkage.getMacroContainer(undef.getMacroName().toCharArray());
|
||||||
pdomMacro = new PDOMMacro(pdom, container, undef, this);
|
pdomMacro = new PDOMMacro(pdom, container, undef, this);
|
||||||
|
@ -287,13 +286,11 @@ public class PDOMFile implements IIndexFragmentFile {
|
||||||
nameCache.put(name[0], pdomName);
|
nameCache.put(name[0], pdomName);
|
||||||
if (lastName == null) {
|
if (lastName == null) {
|
||||||
setFirstName(pdomName);
|
setFirstName(pdomName);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
lastName.setNextInFile(pdomName);
|
lastName.setNextInFile(pdomName);
|
||||||
}
|
}
|
||||||
lastName= pdomName;
|
lastName= pdomName;
|
||||||
}
|
} else if (fname instanceof PDOMMacroReferenceName) {
|
||||||
else if (fname instanceof PDOMMacroReferenceName) {
|
|
||||||
PDOMMacroReferenceName macroName = (PDOMMacroReferenceName) fname;
|
PDOMMacroReferenceName macroName = (PDOMMacroReferenceName) fname;
|
||||||
if (lastMacroName == null) {
|
if (lastMacroName == null) {
|
||||||
setFirstMacroReference(macroName);
|
setFirstMacroReference(macroName);
|
||||||
|
@ -430,8 +427,7 @@ public class PDOMFile implements IIndexFragmentFile {
|
||||||
include.setPrevInIncludedBy(firstIncludedBy);
|
include.setPrevInIncludedBy(firstIncludedBy);
|
||||||
firstIncludedBy.setNextInIncludedBy(include);
|
firstIncludedBy.setNextInIncludedBy(include);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
setFirstIncludedBy(include);
|
setFirstIncludedBy(include);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,6 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
* Container for c++-entities.
|
* Container for c++-entities.
|
||||||
*/
|
*/
|
||||||
class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
|
|
||||||
public final static int CACHE_MEMBERS= 0;
|
public final static int CACHE_MEMBERS= 0;
|
||||||
public final static int CACHE_BASES= 1;
|
public final static int CACHE_BASES= 1;
|
||||||
public final static int CACHE_INSTANCES= 2;
|
public final static int CACHE_INSTANCES= 2;
|
||||||
|
@ -256,8 +255,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
pdomBinding = adaptBinding(parent, binding);
|
pdomBinding = adaptBinding(parent, binding);
|
||||||
if (pdomBinding != null) {
|
if (pdomBinding != null) {
|
||||||
pdom.putCachedResult(inputBinding, pdomBinding);
|
pdom.putCachedResult(inputBinding, pdomBinding);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
try {
|
try {
|
||||||
pdomBinding = createBinding(parent, binding);
|
pdomBinding = createBinding(parent, binding);
|
||||||
if (pdomBinding != null) {
|
if (pdomBinding != null) {
|
||||||
|
@ -646,7 +644,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
private final PDOMNode adaptOrAddParent(boolean add, IBinding binding) throws CoreException {
|
private final PDOMNode adaptOrAddParent(boolean add, IBinding binding) throws CoreException {
|
||||||
try {
|
try {
|
||||||
IBinding owner= binding.getOwner();
|
IBinding owner= binding.getOwner();
|
||||||
if (owner instanceof IFunction && binding instanceof ICPPTemplateParameter == false) {
|
if (owner instanceof IFunction && !(binding instanceof ICPPTemplateParameter)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -716,12 +714,10 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||||
return addBinding((ITypedef) type, null);
|
return addBinding((ITypedef) type, null);
|
||||||
}
|
}
|
||||||
if (type instanceof ICPPReferenceType) {
|
if (type instanceof ICPPReferenceType) {
|
||||||
return new PDOMCPPReferenceType(pdom, parent,
|
return new PDOMCPPReferenceType(pdom, parent, (ICPPReferenceType) type);
|
||||||
(ICPPReferenceType) type);
|
|
||||||
}
|
}
|
||||||
if (type instanceof ICPPPointerToMemberType) {
|
if (type instanceof ICPPPointerToMemberType) {
|
||||||
return new PDOMCPPPointerToMemberType(pdom, parent,
|
return new PDOMCPPPointerToMemberType(pdom, parent, (ICPPPointerToMemberType) type);
|
||||||
(ICPPPointerToMemberType) type);
|
|
||||||
}
|
}
|
||||||
if (type instanceof ICPPTemplateTypeParameter) {
|
if (type instanceof ICPPTemplateTypeParameter) {
|
||||||
return addBinding((ICPPTemplateTypeParameter) type, null);
|
return addBinding((ICPPTemplateTypeParameter) type, null);
|
||||||
|
|
Loading…
Add table
Reference in a new issue