mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Got more of the PDOM working. Able to do stdio.h and iostream.
This commit is contained in:
parent
083a674975
commit
8c41743dc7
4 changed files with 31 additions and 7 deletions
|
@ -124,7 +124,7 @@ public class CASTTranslationUnit extends CASTNode implements
|
|||
try {
|
||||
names = pdom.getDeclarations(binding);
|
||||
} catch (CoreException e) {
|
||||
names = null;
|
||||
names = new IASTName[0];
|
||||
}
|
||||
}
|
||||
return names;
|
||||
|
|
|
@ -916,7 +916,8 @@ public class CVisitor {
|
|||
|
||||
binding = scope.getBinding( name, false );
|
||||
if( binding != null ){
|
||||
((CStructure)binding).addDefinition( compositeTypeSpec );
|
||||
if (binding instanceof CStructure)
|
||||
((CStructure)binding).addDefinition( compositeTypeSpec );
|
||||
return binding;
|
||||
}
|
||||
} catch (DOMException e2) {
|
||||
|
|
|
@ -61,6 +61,7 @@ import org.eclipse.cdt.internal.core.dom.parser.IRequiresLocationInformation;
|
|||
import org.eclipse.cdt.internal.core.dom.parser.GCCBuiltinSymbolProvider.CPPBuiltinParameter;
|
||||
import org.eclipse.cdt.internal.core.parser.scanner2.ILocationResolver;
|
||||
import org.eclipse.cdt.internal.core.parser.scanner2.InvalidPreprocessorNodeException;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -177,7 +178,15 @@ public class CPPASTTranslationUnit extends CPPASTNode implements
|
|||
return EMPTY_NAME_ARRAY;
|
||||
return resolver.getDeclarations( (IMacroBinding)b );
|
||||
}
|
||||
return CPPVisitor.getDeclarations( this, b );
|
||||
IASTName[] names = CPPVisitor.getDeclarations( this, b );
|
||||
if (names.length == 0 && pdom != null) {
|
||||
try {
|
||||
names = pdom.getDeclarations(b);
|
||||
} catch (CoreException e) {
|
||||
names = new IASTName[0];
|
||||
}
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
*/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IPDOM;
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
|
||||
|
@ -124,6 +125,7 @@ import org.eclipse.cdt.core.parser.util.ArrayUtil.ArrayWrapper;
|
|||
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.ProblemBinding;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
* @author aniefer
|
||||
|
@ -744,10 +746,22 @@ public class CPPSemantics {
|
|||
}
|
||||
}
|
||||
if( binding == null ){
|
||||
if( name instanceof ICPPASTQualifiedName && data.forDefinition() )
|
||||
binding = new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_MEMBER_DECLARATION_NOT_FOUND, data.name() );
|
||||
else
|
||||
binding = new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_NAME_NOT_FOUND, data.name() );
|
||||
// Let's try the pdom
|
||||
IPDOM pdom = name.getTranslationUnit().getPDOM();
|
||||
if (pdom != null) {
|
||||
try {
|
||||
binding = pdom.resolveBinding(name);
|
||||
} catch (CoreException e) {
|
||||
binding = null;
|
||||
}
|
||||
}
|
||||
// If we're still null...
|
||||
if (binding == null) {
|
||||
if( name instanceof ICPPASTQualifiedName && data.forDefinition() )
|
||||
binding = new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_MEMBER_DECLARATION_NOT_FOUND, data.name() );
|
||||
else
|
||||
binding = new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_NAME_NOT_FOUND, data.name() );
|
||||
}
|
||||
}
|
||||
return binding;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue