From 594abda89f2bb7068b5fc591faba0e1ebcd6b9ea Mon Sep 17 00:00:00 2001 From: Andrew Niefer Date: Tue, 22 Mar 2005 20:08:49 +0000 Subject: [PATCH] bug 88460 --- .../cdt/core/parser/tests/ast2/AST2Tests.java | 9 +++++++++ .../cdt/internal/core/dom/parser/c/CFunction.java | 14 ++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java index 4cfb54ec962..32a0e1e6a6c 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java @@ -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() ); + } } \ No newline at end of file diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunction.java index b4a7faebd72..aa262b27665 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CFunction.java @@ -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,10 +311,13 @@ public class CFunction implements IFunction, ICInternalBinding { IASTFunctionDeclarator dtor = definition; - IASTDeclSpecifier declSpec = ((IASTFunctionDefinition)dtor.getParent()).getDeclSpecifier(); - if( declSpec.getStorageClass() == IASTDeclSpecifier.sc_static ){ - bits |= 3 << 2; - return true; + 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++ ){