1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

bug 88460

This commit is contained in:
Andrew Niefer 2005-03-22 20:08:49 +00:00
parent 5a64d3581a
commit 594abda89f
2 changed files with 17 additions and 6 deletions

View file

@ -3002,4 +3002,13 @@ public class AST2Tests extends AST2BaseTest {
assertTrue( col.getName(2).isDeclaration() );
assertFalse( col.getName(2).isReference() );
}
public void test88460() throws Exception {
IASTTranslationUnit tu = parse( "void f();", ParserLanguage.C ); //$NON-NLS-1$
CNameCollector col = new CNameCollector();
tu.accept( col );
IFunction f = (IFunction) col.getName(0).resolveBinding();
assertFalse( f.isStatic() );
}
}

View file

@ -27,7 +27,6 @@ import org.eclipse.cdt.core.dom.ast.IParameter;
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.gnu.c.ICASTKnRFunctionDeclarator;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.core.parser.util.CharArrayUtils;
@ -93,7 +92,7 @@ public class CFunction implements IFunction, ICInternalBinding {
if( tu != null ){
CPPVisitor.getDeclarations( tu, this );
}
declarators = (ICPPASTFunctionDeclarator[]) ArrayUtil.trim( ICPPASTFunctionDeclarator.class, declarators );
declarators = (IASTStandardFunctionDeclarator[]) ArrayUtil.trim( IASTStandardFunctionDeclarator.class, declarators );
bits |= FULLY_RESOLVED;
bits &= ~RESOLUTION_IN_PROGRESS;
}
@ -312,11 +311,14 @@ public class CFunction implements IFunction, ICInternalBinding {
IASTFunctionDeclarator dtor = definition;
IASTDeclSpecifier declSpec = ((IASTFunctionDefinition)dtor.getParent()).getDeclSpecifier();
IASTDeclSpecifier declSpec = null;
if( dtor != null ){
declSpec = ((IASTFunctionDefinition)dtor.getParent()).getDeclSpecifier();
if( declSpec.getStorageClass() == IASTDeclSpecifier.sc_static ){
bits |= 3 << 2;
return true;
}
}
for( int i = 0; i < declarators.length; i++ ){
IASTNode parent = declarators[i].getParent();