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

fix null pointer exceptions

This commit is contained in:
Andrew Niefer 2005-06-03 15:41:36 +00:00
parent 153639e016
commit a31d84767b
6 changed files with 15 additions and 11 deletions

View file

@ -31,6 +31,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMember;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable; import org.eclipse.cdt.core.dom.ast.cpp.ICPPVariable;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalFunction;
import org.eclipse.cdt.internal.core.index.IIndex; import org.eclipse.cdt.internal.core.index.IIndex;
/** /**
@ -193,7 +194,11 @@ public class IndexVisitorUtil {
else if (functionBinding.isRegister()) { else if (functionBinding.isRegister()) {
modifiers |= IIndex.registerSpecifier; modifiers |= IIndex.registerSpecifier;
} }
else if (functionBinding.isStatic()) { //For performance reasons, use internal interface if possible, since we know the
//index is resolving bindings in order.
else if ( (binding instanceof ICPPInternalFunction) ? ((ICPPInternalFunction)functionBinding).isStatic(false)
: functionBinding.isStatic() )
{
modifiers |= IIndex.staticSpecifier; modifiers |= IIndex.staticSpecifier;
} }
else if (functionBinding.isInline()) { else if (functionBinding.isInline()) {

View file

@ -128,7 +128,7 @@ public class CPPClassSpecialization extends CPPSpecialization implements
*/ */
public IBinding[] getFriends() throws DOMException { public IBinding[] getFriends() throws DOMException {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return IBinding.EMPTY_BINDING_ARRAY;
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -274,8 +274,8 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType#getFriends() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType#getFriends()
*/ */
public IBinding[] getFriends() { public IBinding[] getFriends() {
// TODO Auto-generated method stub //TODO
return null; return IBinding.EMPTY_BINDING_ARRAY;
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -64,8 +64,9 @@ public class CPPField extends CPPVariable implements ICPPField, ICPPInternalBind
public IASTDeclaration getPrimaryDeclaration() throws DOMException{ public IASTDeclaration getPrimaryDeclaration() throws DOMException{
//first check if we already know it //first check if we already know it
IASTName [] declarations = (IASTName[]) getDeclarations(); IASTName [] declarations = (IASTName[]) getDeclarations();
if( declarations != null ){ if( declarations != null || getDefinition() != null ){
for( int i = -1; i < declarations.length; i++ ){ int len = ( declarations != null ) ? declarations.length : 0;
for( int i = -1; i < len; i++ ){
IASTNode node = ( i == -1 ) ? getDefinition() : declarations[i]; IASTNode node = ( i == -1 ) ? getDefinition() : declarations[i];
if( node != null ){ if( node != null ){
while( !(node instanceof IASTDeclaration ) ) while( !(node instanceof IASTDeclaration ) )

View file

@ -195,7 +195,7 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
if( !(n instanceof ICPPASTFunctionDeclarator) ) if( !(n instanceof ICPPASTFunctionDeclarator) )
return; return;
updateParameterBindings( (ICPPASTFunctionDeclarator) n ); updateParameterBindings( (ICPPASTFunctionDeclarator) n );
super.addDefinition( node ); super.addDeclaration( node );
} }
protected void updateParameterBindings( ICPPASTFunctionDeclarator fdtor ){ protected void updateParameterBindings( ICPPASTFunctionDeclarator fdtor ){
IParameter [] params = null; IParameter [] params = null;

View file

@ -70,16 +70,14 @@ public class CPPTemplateParameter implements ICPPTemplateParameter, ICPPInternal
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#getQualifiedName() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#getQualifiedName()
*/ */
public String[] getQualifiedName() { public String[] getQualifiedName() {
// TODO Auto-generated method stub return new String[] { getName() };
return null;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#getQualifiedNameCharArray() * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#getQualifiedNameCharArray()
*/ */
public char[][] getQualifiedNameCharArray() { public char[][] getQualifiedNameCharArray() {
// TODO Auto-generated method stub return new char [][] {getNameCharArray() };
return null;
} }
/* (non-Javadoc) /* (non-Javadoc)