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:
parent
153639e016
commit
a31d84767b
6 changed files with 15 additions and 11 deletions
|
@ -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.ICPPMethod;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -193,7 +194,11 @@ public class IndexVisitorUtil {
|
|||
else if (functionBinding.isRegister()) {
|
||||
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;
|
||||
}
|
||||
else if (functionBinding.isInline()) {
|
||||
|
|
|
@ -128,7 +128,7 @@ public class CPPClassSpecialization extends CPPSpecialization implements
|
|||
*/
|
||||
public IBinding[] getFriends() throws DOMException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return IBinding.EMPTY_BINDING_ARRAY;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -274,8 +274,8 @@ public class CPPClassTemplate extends CPPTemplateDefinition implements
|
|||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType#getFriends()
|
||||
*/
|
||||
public IBinding[] getFriends() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
//TODO
|
||||
return IBinding.EMPTY_BINDING_ARRAY;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -64,8 +64,9 @@ public class CPPField extends CPPVariable implements ICPPField, ICPPInternalBind
|
|||
public IASTDeclaration getPrimaryDeclaration() throws DOMException{
|
||||
//first check if we already know it
|
||||
IASTName [] declarations = (IASTName[]) getDeclarations();
|
||||
if( declarations != null ){
|
||||
for( int i = -1; i < declarations.length; i++ ){
|
||||
if( declarations != null || getDefinition() != null ){
|
||||
int len = ( declarations != null ) ? declarations.length : 0;
|
||||
for( int i = -1; i < len; i++ ){
|
||||
IASTNode node = ( i == -1 ) ? getDefinition() : declarations[i];
|
||||
if( node != null ){
|
||||
while( !(node instanceof IASTDeclaration ) )
|
||||
|
|
|
@ -195,7 +195,7 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
|
|||
if( !(n instanceof ICPPASTFunctionDeclarator) )
|
||||
return;
|
||||
updateParameterBindings( (ICPPASTFunctionDeclarator) n );
|
||||
super.addDefinition( node );
|
||||
super.addDeclaration( node );
|
||||
}
|
||||
protected void updateParameterBindings( ICPPASTFunctionDeclarator fdtor ){
|
||||
IParameter [] params = null;
|
||||
|
|
|
@ -70,16 +70,14 @@ public class CPPTemplateParameter implements ICPPTemplateParameter, ICPPInternal
|
|||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#getQualifiedName()
|
||||
*/
|
||||
public String[] getQualifiedName() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return new String[] { getName() };
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPBinding#getQualifiedNameCharArray()
|
||||
*/
|
||||
public char[][] getQualifiedNameCharArray() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return new char [][] {getNameCharArray() };
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
Loading…
Add table
Reference in a new issue