[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Applied [HEAD] First pass of fixing type-id's
|
CORE
Fixed Bug 42840 : Search: Cannot find things after double
declarations
Fixed Bug 42798 : Selected #include <Angled> off by 1 char
Fixed Bug 42872 : dynamic cast not parsed properly
Partially fixed Bug 39504 : sizeof-expressions are not handled
properly
* Updated SourceElementRequestor callbacks to include
IASTParameterReference callbacks.
UI
* Updated SourceElementRequestor callbacks to include
IASTParameterReference callbacks.
TESTS
Added CompleteParseASTTest::testBug42840() & testBug42872().
Moved testBug39504B(), testBug39505A() & testBug39505B() from
failed to QuickParse tests.
* Search/Indexer minions : integrate into your features as they make sense
JohnC
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.167
diff -u -r1.167 ChangeLog
--- ChangeLog 11 Sep 2003 14:58:30 -0000 1.167
+++ ChangeLog 11 Sep 2003 17:39:12 -0000
@@ -1,3 +1,6 @@
+2003-09-11 John Camelon
+ Updated SourceElementRequestor callbacks to include IASTParameterReference callbacks.
+
2003-09-10 Sean Evoy
Work completed to resolve [Bug 41412] Restore Default in Managed Build
project's settings Not Working. Added an event handler to reset the selected
Index: src/org/eclipse/cdt/internal/ui/compare/SourceElementRequestorAdapter.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/SourceElementRequestorAdapter.java,v
retrieving revision 1.3
diff -u -r1.3 SourceElementRequestorAdapter.java
--- src/org/eclipse/cdt/internal/ui/compare/SourceElementRequestorAdapter.java 8 Sep 2003 19:17:40 -0000 1.3
+++ src/org/eclipse/cdt/internal/ui/compare/SourceElementRequestorAdapter.java 11 Sep 2003 17:39:14 -0000
@@ -34,7 +34,6 @@
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
@@ -44,6 +43,7 @@
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.core.parser.ast.IASTVariableReference;
+import org.eclipse.cdt.internal.core.parser.ast.complete.ASTParameterReference;
/**
*
@@ -318,6 +318,14 @@
{
// TODO Auto-generated method stub
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptParameterReference(org.eclipse.cdt.internal.core.parser.ast.complete.ASTParameterReference)
+ */
+ public void acceptParameterReference(ASTParameterReference reference)
+ {
+ // TODO Auto-generated method stub
}
}
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.89
diff -u -r1.89 ChangeLog
--- ChangeLog 11 Sep 2003 14:46:08 -0000 1.89
+++ ChangeLog 11 Sep 2003 17:38:48 -0000
@@ -1,3 +1,7 @@
+2003-09-11 John Camelon
+ Added CompleteParseASTTest::testBug42840() & testBug42872().
+ Moved testBug39504B(), testBug39505A() & testBug39505B() from failed to QuickParse tests.
+
2003-09-10 Sean Evoy
Added a test for resetting the value of a configuration to the defaults defined in the
plugin file. Work completed to resolve [Bug 41412] Restore Default in Managed Build
Index: failures/org/eclipse/cdt/core/parser/failedTests/ASTFailedTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/failures/org/eclipse/cdt/core/parser/failedTests/ASTFailedTests.java,v
retrieving revision 1.12
diff -u -r1.12 ASTFailedTests.java
--- failures/org/eclipse/cdt/core/parser/failedTests/ASTFailedTests.java 4 Sep 2003 20:47:05 -0000 1.12
+++ failures/org/eclipse/cdt/core/parser/failedTests/ASTFailedTests.java 11 Sep 2003 17:38:48 -0000
@@ -41,18 +41,6 @@
{
assertCodeFailsParse("int y = sizeof(x[0]);");
}
- public void testBug39504B() throws Exception
- {
- assertCodeFailsParse("int y = sizeof (int*);");
- }
- public void testBug39505A() throws Exception
- {
- assertCodeFailsParse("int AD::* gp_down = static_cast<int AD::*>(gp_stat);");
- }
- public void testBug39505B() throws Exception
- {
- assertCodeFailsParse("int* gp_down = static_cast<int*>(gp_stat);");
- }
public void testBug39525() throws Exception
{
Index: failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTExpressionTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTExpressionTest.java,v
retrieving revision 1.2
diff -u -r1.2 FailedCompleteParseASTExpressionTest.java
--- failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTExpressionTest.java 10 Sep 2003 13:21:53 -0000 1.2
+++ failures/org/eclipse/cdt/core/parser/failedTests/FailedCompleteParseASTExpressionTest.java 11 Sep 2003 17:38:48 -0000
@@ -10,11 +10,6 @@
***********************************************************************/
package org.eclipse.cdt.core.parser.failedTests;
-import java.util.Iterator;
-
-import org.eclipse.cdt.core.parser.ast.IASTFunction;
-import org.eclipse.cdt.core.parser.ast.IASTReference;
-import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.core.parser.tests.CompleteParseBaseTest;
/**
Index: parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java,v
retrieving revision 1.27
diff -u -r1.27 CompleteParseASTTest.java
--- parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java 9 Sep 2003 20:01:06 -0000 1.27
+++ parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java 11 Sep 2003 17:38:49 -0000
@@ -713,4 +713,35 @@
assertEquals( ((IASTReference)callback.getReferences().get(0)).getReferencedElement(), enumE );
assertEquals( ((IASTReference)callback.getReferences().get(1)).getReferencedElement(), e1 );
}
+
+ public void testBug42840() throws Exception
+ {
+ Iterator i = parse( "void foo(); void foo() { } class SearchMe { };").getDeclarations();
+ IASTFunction fooDeclaration = (IASTFunction)i.next();
+ IASTFunction fooDefinition = (IASTFunction)i.next();
+ IASTClassSpecifier classSpec = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+ assertFalse( i.hasNext() );
+ assertTrue( callback.getReferences().isEmpty());
+
+ i = parse( "class A { void f ( A ); }; void A::f( A ){ return; }" ).getDeclarations();
+ classSpec = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+ IASTMethod fooMethodDefinition = (IASTMethod)i.next();
+ assertFalse( i.hasNext() );
+ Iterator subIterator = getDeclarations( classSpec );
+ IASTMethod fooMethodDeclaration = (IASTMethod)subIterator.next();
+ assertFalse( subIterator.hasNext());
+ assertEquals( callback.getReferences().size(), 3 );
+ for( int j = 0; j < 3; ++j)
+ assertEquals( ((IASTReference)callback.getReferences().get( j )).getReferencedElement(), classSpec );
+
+ }
+
+ public void testBug42872() throws Exception
+ {
+ Iterator i = parse( "struct B {}; struct D : B {}; void foo(D* dp) { B* bp = dynamic_cast<B*>(dp); }" ).getDeclarations();
+ IASTClassSpecifier structB = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+ IASTClassSpecifier structD = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
+ IASTFunction foo = (IASTFunction)i.next();
+ assertFalse( i.hasNext() );
+ }
}
Index: parser/org/eclipse/cdt/core/parser/tests/CompleteParseBaseTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseBaseTest.java,v
retrieving revision 1.4
diff -u -r1.4 CompleteParseBaseTest.java
--- parser/org/eclipse/cdt/core/parser/tests/CompleteParseBaseTest.java 8 Sep 2003 19:17:45 -0000 1.4
+++ parser/org/eclipse/cdt/core/parser/tests/CompleteParseBaseTest.java 11 Sep 2003 17:38:49 -0000
@@ -59,6 +59,7 @@
import org.eclipse.cdt.core.parser.ast.IASTVariableReference;
import org.eclipse.cdt.internal.core.parser.ParserException;
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
+import org.eclipse.cdt.internal.core.parser.ast.complete.ASTParameterReference;
/**
* @author jcamelon
@@ -617,6 +618,14 @@
public void acceptEnumeratorReference(IASTEnumeratorReference reference)
{
references.add( reference );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptParameterReference(org.eclipse.cdt.internal.core.parser.ast.complete.ASTParameterReference)
+ */
+ public void acceptParameterReference(ASTParameterReference reference)
+ {
+ references.add( reference );
}
}
Index: parser/org/eclipse/cdt/core/parser/tests/QuickParseASTTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/QuickParseASTTests.java,v
retrieving revision 1.16
diff -u -r1.16 QuickParseASTTests.java
--- parser/org/eclipse/cdt/core/parser/tests/QuickParseASTTests.java 4 Sep 2003 14:39:07 -0000 1.16
+++ parser/org/eclipse/cdt/core/parser/tests/QuickParseASTTests.java 11 Sep 2003 17:38:51 -0000
@@ -1156,7 +1156,7 @@
assertEquals( i.getName(), "stdio.h");
assertEquals( i.getStartingOffset(), 0 );
- assertEquals( i.getNameOffset(), 9 );
+ assertEquals( i.getNameOffset(), 10 );
assertEquals( i.getEndingOffset(), 19 );
@@ -1779,5 +1779,17 @@
parse("namespace bar = foo;");
}
+ public void testBug39504B() throws Exception
+ {
+ parse("int y = sizeof (int*);");
+ }
+ public void testBug39505A() throws Exception
+ {
+ parse("int AD::* gp_down = static_cast<int AD::*>(gp_stat);");
+ }
+ public void testBug39505B() throws Exception
+ {
+ parse("int* gp_down = static_cast<int*>(gp_stat);");
+ }
}
Index: index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexerRequestor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexerRequestor.java,v
retrieving revision 1.15
diff -u -r1.15 SourceIndexerRequestor.java
--- index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexerRequestor.java 9 Sep 2003 15:46:38 -0000 1.15
+++ index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexerRequestor.java 11 Sep 2003 17:38:17 -0000
@@ -50,6 +50,7 @@
import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.core.parser.ast.IASTVariableReference;
import org.eclipse.cdt.internal.core.index.IDocument;
+import org.eclipse.cdt.internal.core.parser.ast.complete.ASTParameterReference;
/**
* @author bgheorgh
@@ -440,6 +441,14 @@
{
if( reference.getReferencedElement() instanceof IASTEnumerator )
indexer.addEnumeratorReference( (IASTEnumerator)reference.getReferencedElement() );
+
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptParameterReference(org.eclipse.cdt.internal.core.parser.ast.complete.ASTParameterReference)
+ */
+ public void acceptParameterReference(ASTParameterReference reference)
+ {
+ // TODO Auto-generated method stub
}
}
Index: parser/ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/ChangeLog,v
retrieving revision 1.120
diff -u -r1.120 ChangeLog
--- parser/ChangeLog 10 Sep 2003 13:21:48 -0000 1.120
+++ parser/ChangeLog 11 Sep 2003 17:38:18 -0000
@@ -1,3 +1,10 @@
+2003-09-11 John Camelon
+ Fixed Bug 42840 : Search: Cannot find things after double declarations
+ Fixed Bug 42798 : Selected #include <Angled> off by 1 char
+ Fixed Bug 42872 : dynamic cast not parsed properly
+ Partially fixed Bug 39504 : sizeof-expressions are not handled properly
+ Updated SourceElementRequestor callbacks to include IASTParameterReference callbacks.
+
2003-09-09 Hoda Amer
- Solved the double reference problem
- solution to bugs #42822, #42823, & #42822B
Index: parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java,v
retrieving revision 1.12
diff -u -r1.12 ISourceElementRequestor.java
--- parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java 8 Sep 2003 19:17:53 -0000 1.12
+++ parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java 11 Sep 2003 17:38:18 -0000
@@ -40,6 +40,7 @@
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.core.parser.ast.IASTVariableReference;
+import org.eclipse.cdt.internal.core.parser.ast.complete.ASTParameterReference;
/**
* @author jcamelon
@@ -90,6 +91,7 @@
public void acceptFieldReference( IASTFieldReference reference );
public void acceptMethodReference( IASTMethodReference reference );
public void acceptEnumeratorReference( IASTEnumeratorReference reference );
+ public void acceptParameterReference(ASTParameterReference reference);
public void exitTemplateDeclaration( IASTTemplateDeclaration declaration );
public void exitTemplateSpecialization( IASTTemplateSpecialization specialization );
Index: parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java,v
retrieving revision 1.29
diff -u -r1.29 IASTFactory.java
--- parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java 4 Sep 2003 20:46:57 -0000 1.29
+++ parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java 11 Sep 2003 17:38:18 -0000
@@ -147,7 +147,7 @@
boolean isVirtual,
boolean isExplicit,
boolean isPureVirtual,
- ASTAccessVisibility visibility, List constructorChain) throws ASTSemanticException;
+ ASTAccessVisibility visibility, List constructorChain, boolean isDefinition ) throws ASTSemanticException;
public IASTAbstractDeclaration createAbstractDeclaration(
boolean isConst,
boolean isVolatile,
@@ -170,7 +170,7 @@
boolean isVirtual,
boolean isExplicit,
boolean isPureVirtual,
- ASTAccessVisibility visibility, List constructorChain) throws ASTSemanticException;
+ ASTAccessVisibility visibility, List constructorChain, boolean isDefinition) throws ASTSemanticException;
public IASTVariable createVariable(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression,
IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, IASTExpression constructorExpression ) throws ASTSemanticException;
Index: parser/org/eclipse/cdt/core/parser/ast/IASTParameterReference.java
===================================================================
RCS file: parser/org/eclipse/cdt/core/parser/ast/IASTParameterReference.java
diff -N parser/org/eclipse/cdt/core/parser/ast/IASTParameterReference.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/core/parser/ast/IASTParameterReference.java 11 Sep 2003 17:38:18 -0000
@@ -0,0 +1,19 @@
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.core.parser.ast;
+
+/**
+ * @author jcamelon
+ *
+ */
+public interface IASTParameterReference extends IASTReference
+{
+}
Index: parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java,v
retrieving revision 1.16
diff -u -r1.16 DeclarationWrapper.java
--- parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java 28 Aug 2003 15:50:31 -0000 1.16
+++ parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java 11 Sep 2003 17:38:19 -0000
@@ -37,7 +37,7 @@
*
*/
public class DeclarationWrapper implements IDeclaratorOwner
-{
+{
private ITokenDuple name;
private Type simpleType =
IASTSimpleTypeSpecifier.Type.UNSPECIFIED;
@@ -435,7 +435,8 @@
virtual,
explicit,
declarator.isPureVirtual(),
- ((IASTClassSpecifier)scope).getCurrentVisibilityMode(), declarator.getConstructorMemberInitializers());
+ ((IASTClassSpecifier)scope).getCurrentVisibilityMode(), declarator.getConstructorMemberInitializers(),
+ declarator.hasFunctionBody());
}
/**
* @param declarator
@@ -465,7 +466,8 @@
explicit,
declarator.isPureVirtual(),
ASTAccessVisibility.PUBLIC,
- declarator.getConstructorMemberInitializers());
+ declarator.getConstructorMemberInitializers(),
+ declarator.hasFunctionBody() );
}
/**
* @param declarator
Index: parser/org/eclipse/cdt/internal/core/parser/Declarator.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Declarator.java,v
retrieving revision 1.8
diff -u -r1.8 Declarator.java
--- parser/org/eclipse/cdt/internal/core/parser/Declarator.java 12 Aug 2003 18:19:38 -0000 1.8
+++ parser/org/eclipse/cdt/internal/core/parser/Declarator.java 11 Sep 2003 17:38:19 -0000
@@ -392,4 +392,20 @@
return pointerOperatorNameDuple;
}
+ /**
+ * @return
+ */
+ public boolean hasFunctionBody()
+ {
+ return hasFunctionBody;
+ }
+
+ /**
+ * @param b
+ */
+ public void setHasFunctionBody(boolean b)
+ {
+ hasFunctionBody = b;
+ }
+
}
Index: parser/org/eclipse/cdt/internal/core/parser/NullSourceElementRequestor.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/NullSourceElementRequestor.java,v
retrieving revision 1.12
diff -u -r1.12 NullSourceElementRequestor.java
--- parser/org/eclipse/cdt/internal/core/parser/NullSourceElementRequestor.java 8 Sep 2003 19:17:53 -0000 1.12
+++ parser/org/eclipse/cdt/internal/core/parser/NullSourceElementRequestor.java 11 Sep 2003 17:38:19 -0000
@@ -32,6 +32,7 @@
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.core.parser.ast.IASTVariableReference;
+import org.eclipse.cdt.internal.core.parser.ast.complete.ASTParameterReference;
public class NullSourceElementRequestor implements ISourceElementRequestor
@@ -429,6 +430,15 @@
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumeratorReference(org.eclipse.cdt.core.parser.ast.IASTEnumerationReference)
*/
public void acceptEnumeratorReference(IASTEnumeratorReference reference)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptParameterReference(org.eclipse.cdt.internal.core.parser.ast.complete.ASTParameterReference)
+ */
+ public void acceptParameterReference(ASTParameterReference reference)
{
// TODO Auto-generated method stub
Index: parser/org/eclipse/cdt/internal/core/parser/Parser.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java,v
retrieving revision 1.105
diff -u -r1.105 Parser.java
--- parser/org/eclipse/cdt/internal/core/parser/Parser.java 9 Sep 2003 18:02:40 -0000 1.105
+++ parser/org/eclipse/cdt/internal/core/parser/Parser.java 11 Sep 2003 17:38:21 -0000
@@ -897,7 +897,7 @@
case IToken.tLBRACE :
if (forKR)
throw backtrack;
- declarator.hasFunctionBody(true);
+ declarator.setHasFunctionBody(true);
hasFunctionBody = true;
break;
default :
@@ -1730,23 +1730,25 @@
* @return Returns the same object sent in.
* @throws Backtrack
*/
- protected boolean cvQualifier(
+ protected IToken cvQualifier(
Declarator declarator)
throws Backtrack
{
+ IToken result = null;
switch (LT(1))
{
case IToken.t_const :
- consume( IToken.t_const );
- declarator.addPtrOp(ASTPointerOperator.CONST_POINTER);
- return true;
+ result = consume( IToken.t_const );
+ if( declarator != null ) declarator.addPtrOp(ASTPointerOperator.CONST_POINTER);
+ break;
case IToken.t_volatile :
- consume( IToken.t_volatile );
- declarator.addPtrOp(ASTPointerOperator.VOLATILE_POINTER);
- return true;
+ result = consume( IToken.t_volatile );
+ if( declarator != null ) declarator.addPtrOp(ASTPointerOperator.VOLATILE_POINTER);
+ break;
default :
- return false;
+
}
+ return result;
}
/**
* Parses the initDeclarator construct of the ANSI C++ spec.
@@ -2186,15 +2188,15 @@
else
{
// must be a conversion function
- typeId();
- toSend = lastToken;
+ toSend = typeId().getLastToken();
+
try
{
// this ptrOp doesn't belong to the declarator,
// it's just a part of the name
- consumePointerOperators(d, true);
- if( lastToken != null )
- toSend = lastToken;
+ IToken temp = consumePointerOperators(d, true);
+ if( temp != null )
+ toSend = temp;
}
catch (Backtrack b)
{
@@ -2220,22 +2222,22 @@
* @param owner Declarator that this pointer operator corresponds to.
* @throws Backtrack request a backtrack
*/
- protected void consumePointerOperators(Declarator d, boolean consumeOnlyOne) throws Backtrack
+ protected IToken consumePointerOperators(Declarator d, boolean consumeOnlyOne) throws Backtrack
{
+ IToken result = null;
for( ; ; )
{
- int t = LT(1);
- if (t == IToken.tAMPER)
+ if (LT(1) == IToken.tAMPER)
{
- consume( IToken.tAMPER );
- d.addPtrOp(ASTPointerOperator.REFERENCE);
- if( consumeOnlyOne ) return;
- continue;
+ result = consume( IToken.tAMPER );
+ if( d != null ) d.addPtrOp(ASTPointerOperator.REFERENCE);
+ /*if( consumeOnlyOne ) */return result;
+ /* continue; */
}
IToken mark = mark();
- IToken tokenType = LA(1);
+
ITokenDuple nameDuple = null;
- if (t == IToken.tIDENTIFIER || t == IToken.tCOLONCOLON)
+ if (LT(1) == IToken.tIDENTIFIER || LT(1) == IToken.tCOLONCOLON)
{
try
{
@@ -2244,34 +2246,33 @@
catch( Backtrack bt )
{
backup( mark );
- return;
+ return null;
}
- t = LT(1);
}
- if (t == IToken.tSTAR)
+ if ( LT(1) == IToken.tSTAR)
{
- tokenType = consume(Token.tSTAR); // tokenType = "*"
+ result = consume(Token.tSTAR); // tokenType = "*"
- d.setPointerOperatorName(nameDuple);
+ if( d != null ) d.setPointerOperatorName(nameDuple);
- boolean successful = false;
+ IToken successful = null;
for (;;)
{
- boolean newSuccess = cvQualifier(d);
- if( newSuccess ) successful = true;
+ IToken newSuccess = cvQualifier(d);
+ if( newSuccess != null ) successful = newSuccess;
else break;
}
- if( !successful )
+ if( successful == null )
{
- d.addPtrOp( ASTPointerOperator.POINTER );
+ if( d != null ) d.addPtrOp( ASTPointerOperator.POINTER );
}
- if( consumeOnlyOne ) return;
+ if( consumeOnlyOne ) return result;
continue;
}
backup(mark);
- return;
+ return result;
}
}
/**
@@ -3520,12 +3521,6 @@
if (LT(1) == IToken.t_const)
consume();
duple = typeId();
- while (LT(1) == IToken.tSTAR)
- {
- consume(IToken.tSTAR);
- if (LT(1) == IToken.t_const || LT(1) == IToken.t_volatile)
- consume();
- }
consume(IToken.tRPAREN);
IASTExpression castExpression = castExpression(scope);
try
@@ -3552,17 +3547,20 @@
}
return unaryExpression(scope);
}
+
/**
* @throws Backtrack
*/
- protected ITokenDuple typeId() throws Backtrack
+ protected ITokenDuple typeId( ) throws Backtrack
{
IToken begin = LA(1);
IToken end = null;
try
{
ITokenDuple d = name();
- return d;
+ IToken checkForPtrs = consumePointerOperators(null, false);
+ if( checkForPtrs == null ) return d;
+ return new TokenDuple( d.getFirstToken(), checkForPtrs );
}
catch (Backtrack b)
{
@@ -3599,7 +3597,8 @@
}
if (end != null)
{
- return new TokenDuple(begin, end);
+ IToken end2 = consumePointerOperators(null, false);
+ return new TokenDuple(begin, end2 == null ? end : end2);
}
else if (
LT(1) == IToken.t_typename
@@ -3610,7 +3609,8 @@
{
consume();
ITokenDuple d = name();
- return new TokenDuple(begin, d.getLastToken());
+ IToken end2 = consumePointerOperators(null, false);
+ return new TokenDuple(begin, ( (end2 == null) ? d.getLastToken() : end2 ) );
}
else
throw backtrack;
@@ -4273,7 +4273,7 @@
lhs,
null,
null,
- null,
+ duple,
"", null);
}
catch (ASTSemanticException e)
Index: parser/org/eclipse/cdt/internal/core/parser/Scanner.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Scanner.java,v
retrieving revision 1.52
diff -u -r1.52 Scanner.java
--- parser/org/eclipse/cdt/internal/core/parser/Scanner.java 9 Sep 2003 18:02:40 -0000 1.52
+++ parser/org/eclipse/cdt/internal/core/parser/Scanner.java 11 Sep 2003 17:38:23 -0000
@@ -1966,8 +1966,9 @@
} else if (t.getType() == IToken.tLT) {
try {
- startOffset = baseOffset + t.getOffset();
+
t = helperScanner.nextToken(false);
+ startOffset = baseOffset + t.getOffset();
while (t.getType() != IToken.tGT) {
fileName.append(t.getImage());
Index: parser/org/eclipse/cdt/internal/core/parser/ast/ASTParameterDeclaration.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/ASTParameterDeclaration.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/ASTParameterDeclaration.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/ASTParameterDeclaration.java 12 Aug 2003 18:19:38 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,57 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.internal.core.parser.ast;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
-import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
-import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTParameterDeclaration extends ASTAbstractDeclaration implements IASTParameterDeclaration
-{
-
- private final String parameterName;
- private final IASTInitializerClause initializerClause;
- /**
- * @param isConst
- * @param typeSpecifier
- * @param pointerOperators
- * @param arrayModifiers
- * @param parameterName
- * @param initializerClause
- */
- public ASTParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause)
- {
- super( isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp );
- this.parameterName = parameterName;
- this.initializerClause = initializerClause;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration#getName()
- */
- public String getName()
- {
- return parameterName;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration#getDefaultValue()
- */
- public IASTInitializerClause getDefaultValue()
- {
- return initializerClause;
- }
-}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java,v
retrieving revision 1.9
diff -u -r1.9 BaseASTFactory.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java 14 Aug 2003 15:33:27 -0000 1.9
+++ parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java 11 Sep 2003 17:38:23 -0000
@@ -19,7 +19,6 @@
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
import org.eclipse.cdt.core.parser.ast.IASTMacro;
-import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
@@ -54,11 +53,6 @@
public IASTAbstractDeclaration createAbstractDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOperator)
{
return new ASTAbstractDeclaration( isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOperator );
- }
-
- public IASTParameterDeclaration createParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause)
- {
- return new ASTParameterDeclaration( isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp, parameterName, initializerClause );
}
public IASTInitializerClause createInitializerClause(IASTInitializerClause.Kind kind, IASTExpression assignmentExpression, List initializerClauses)
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterDeclaration.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterDeclaration.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterDeclaration.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterDeclaration.java 11 Sep 2003 17:38:23 -0000
@@ -0,0 +1,136 @@
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.parser.ast.complete;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.cdt.core.parser.ISourceElementRequestor;
+import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
+import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
+import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
+import org.eclipse.cdt.internal.core.parser.ast.ASTAbstractDeclaration;
+import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ASTParameterDeclaration extends ASTSymbol implements IASTParameterDeclaration
+{
+ private final ASTAbstractDeclaration abstractDeclaration;
+ private final String parameterName;
+ private final IASTInitializerClause initializerClause;
+ /**
+ * @param isConst
+ * @param typeSpecifier
+ * @param pointerOperators
+ * @param arrayModifiers
+ * @param parameterName
+ * @param initializerClause
+ */
+ public ASTParameterDeclaration(ISymbol symbol, boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause)
+ {
+ super( symbol );
+ abstractDeclaration = new ASTAbstractDeclaration( isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp );
+ this.parameterName = parameterName;
+ this.initializerClause = initializerClause;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration#getName()
+ */
+ public String getName()
+ {
+ return parameterName;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration#getDefaultValue()
+ */
+ public IASTInitializerClause getDefaultValue()
+ {
+ return initializerClause;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#isConst()
+ */
+ public boolean isConst()
+ {
+ return abstractDeclaration.isConst();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#isVolatile()
+ */
+ public boolean isVolatile()
+ {
+ return abstractDeclaration.isVolatile();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getPointerOperators()
+ */
+ public Iterator getPointerOperators()
+ {
+ return abstractDeclaration.getPointerOperators();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getArrayModifiers()
+ */
+ public Iterator getArrayModifiers()
+ {
+ return abstractDeclaration.getArrayModifiers();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getParameters()
+ */
+ public Iterator getParameters()
+ {
+ return abstractDeclaration.getParameters();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getPointerToFunctionOperator()
+ */
+ public ASTPointerOperator getPointerToFunctionOperator()
+ {
+ return abstractDeclaration.getPointerToFunctionOperator();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTTypeSpecifierOwner#getTypeSpecifier()
+ */
+ public IASTTypeSpecifier getTypeSpecifier()
+ {
+ return abstractDeclaration.getTypeSpecifier();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+ */
+ public void acceptElement(ISourceElementRequestor requestor)
+ {
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+ */
+ public void enterScope(ISourceElementRequestor requestor)
+ {
+
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+ */
+ public void exitScope(ISourceElementRequestor requestor)
+ {
+
+ }
+
+
+
+
+
+}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterReference.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterReference.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterReference.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTParameterReference.java 11 Sep 2003 17:38:23 -0000
@@ -0,0 +1,65 @@
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.parser.ast.complete;
+
+import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
+import org.eclipse.cdt.core.parser.ISourceElementRequestor;
+import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTParameterReference;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ASTParameterReference extends ASTReference implements IASTParameterReference
+{
+ private final IASTParameterDeclaration parm;
+
+ /**
+ * @param offset
+ * @param string
+ * @param declaration
+ */
+ public ASTParameterReference(int offset, String string, IASTParameterDeclaration declaration)
+ {
+ super( offset, string );
+ parm = declaration;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTReference#getReferencedElement()
+ */
+ public ISourceElementCallbackDelegate getReferencedElement()
+ {
+ return parm;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+ */
+ public void acceptElement(ISourceElementRequestor requestor)
+ {
+ requestor.acceptParameterReference( this );
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+ */
+ public void enterScope(ISourceElementRequestor requestor)
+ {
+
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+ */
+ public void exitScope(ISourceElementRequestor requestor)
+ {
+
+ }
+}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbolOwner.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbolOwner.java,v
retrieving revision 1.1
diff -u -r1.1 ASTSymbolOwner.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbolOwner.java 21 Jul 2003 17:29:55 -0000 1.1
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbolOwner.java 11 Sep 2003 17:38:23 -0000
@@ -19,7 +19,7 @@
*/
public class ASTSymbolOwner implements ISymbolOwner
{
- protected final ISymbol symbol;
+ protected ISymbol symbol;
/**
*
*/
@@ -34,4 +34,10 @@
{
return symbol;
}
+
+ public void setSymbol( ISymbol symbol )
+ {
+ this.symbol = symbol;
+ }
+
}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java,v
retrieving revision 1.34
diff -u -r1.34 CompleteParseASTFactory.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java 10 Sep 2003 13:21:48 -0000 1.34
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java 11 Sep 2003 17:38:24 -0000
@@ -63,7 +63,6 @@
import org.eclipse.cdt.core.parser.ast.IASTExpression.Kind;
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type;
import org.eclipse.cdt.core.parser.ast.IASTTemplateParameter.ParamKind;
-import org.eclipse.cdt.internal.core.parser.ast.ASTParameterDeclaration;
import org.eclipse.cdt.internal.core.parser.ast.BaseASTFactory;
import org.eclipse.cdt.internal.core.parser.pst.ForewardDeclaredSymbolExtension;
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
@@ -79,6 +78,7 @@
import org.eclipse.cdt.internal.core.parser.pst.TypeInfo;
import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension.ExtensionException;
+
/**
* @author jcamelon
*
@@ -210,36 +210,18 @@
throw new ASTSemanticException();
}
break;
- case 2:
- firstSymbol = name.getFirstToken();
- if( firstSymbol.getType() != IToken.tCOLONCOLON )
- throw new ASTSemanticException();
- try
- {
- if(type == TypeInfo.t_function)
- if(validParameterList(parameters))
- result = pst.getCompilationUnit().unqualifiedFunctionLookup( name.getLastToken().getImage(), new LinkedList(parameters));
- else
- result = null;
- else
- result = pst.getCompilationUnit().lookup( name.getLastToken().getImage() );
- addReference( references, createReference( result, name.getLastToken().getImage(), name.getLastToken().getOffset() ));
- }
- catch( ParserSymbolTableException e)
- {
- throw new ASTSemanticException();
- }
- break;
default:
Iterator iter = name.iterator();
firstSymbol = name.getFirstToken();
result = startingScope;
if( firstSymbol.getType() == IToken.tCOLONCOLON )
result = pst.getCompilationUnit();
+
while( iter.hasNext() )
{
IToken t = (IToken)iter.next();
if( t.getType() == IToken.tCOLONCOLON ) continue;
+ if( t.isPointer() ) break;
try
{
if( t == name.getLastToken() )
@@ -660,6 +642,13 @@
{
return new ASTFieldReference( offset, string, (IASTField)symbol.getASTExtension().getPrimaryDeclaration());
}
+ else if( symbol.getContainingSymbol().getType() == TypeInfo.t_function &&
+ symbol.getContainingSymbol() instanceof IParameterizedSymbol &&
+ ((IParameterizedSymbol)symbol.getContainingSymbol()).getParameterList() != null &&
+ ((IParameterizedSymbol)symbol.getContainingSymbol()).getParameterList().contains( symbol ) )
+ {
+ return new ASTParameterReference( offset, string, (IASTParameterDeclaration)symbol.getASTExtension().getPrimaryDeclaration() );
+ }
else
{
return new ASTVariableReference( offset, string, (IASTVariable)symbol.getASTExtension().getPrimaryDeclaration());
@@ -1149,7 +1138,7 @@
boolean isExplicit,
boolean isPureVirtual,
ASTAccessVisibility visibility,
- List constructorChain) throws ASTSemanticException
+ List constructorChain, boolean isFunctionDefinition ) throws ASTSemanticException
{
List references = new ArrayList();
IContainerSymbol ownerScope = scopeToSymbol( scope );
@@ -1208,7 +1197,7 @@
return createMethod(scope, functionName, parameters, returnType,
exception, isInline, isFriend, isStatic, startOffset, offset,
ownerTemplate, isConst, isVolatile, isVirtual, isExplicit, isPureVirtual,
- visibility, constructorChain,parentName, references);
+ visibility, constructorChain,parentName, references, isFunctionDefinition);
}
}
@@ -1217,7 +1206,31 @@
setParameter( symbol, returnType, false, references );
setParameters( symbol, references, parameters.iterator() );
-
+
+ symbol.setIsForwardDeclaration(!isFunctionDefinition);
+
+ if( isFunctionDefinition )
+ {
+ List functionParameters = new LinkedList();
+ // the lookup requires a list of type infos
+ // instead of a list of IASTParameterDeclaration
+ Iterator p = parameters.iterator();
+ while (p.hasNext()){
+ ASTParameterDeclaration param = (ASTParameterDeclaration)p.next();
+ functionParameters.add(getParameterTypeInfo(param));
+ }
+
+ IParameterizedSymbol functionDeclaration = null;
+
+ functionDeclaration =
+ (IParameterizedSymbol) lookupQualifiedName(ownerScope, name, TypeInfo.t_function, functionParameters, 0, new ArrayList(), false);
+
+ if( functionDeclaration != null )
+ {
+ functionDeclaration.setTypeSymbol( symbol );
+ }
+ }
+
try
{
ownerScope.addSymbol( symbol );
@@ -1362,6 +1375,19 @@
if( newReferences != null )
references.addAll( newReferences );
+ if( absDecl instanceof ASTParameterDeclaration )
+ {
+ ASTParameterDeclaration parm = (ASTParameterDeclaration)absDecl;
+ parm.setSymbol( paramSymbol );
+ try
+ {
+ attachSymbolExtension( paramSymbol, parm );
+ }
+ catch (ExtensionException e)
+ {
+ throw new ASTSemanticException();
+ }
+ }
}
/**
@@ -1414,12 +1440,12 @@
boolean isExplicit,
boolean isPureVirtual,
ASTAccessVisibility visibility,
- List constructorChain) throws ASTSemanticException
+ List constructorChain, boolean isFunctionDefinition ) throws ASTSemanticException
{
return createMethod(scope, name, parameters, returnType,
exception, isInline, isFriend, isStatic, startOffset, nameOffset,
ownerTemplate, isConst, isVolatile, isVirtual, isExplicit, isPureVirtual,
- visibility, constructorChain,scopeToSymbol(scope).getName(), null);
+ visibility, constructorChain,scopeToSymbol(scope).getName(), null, isFunctionDefinition );
}
public IASTMethod createMethod(
@@ -1442,7 +1468,7 @@
ASTAccessVisibility visibility,
List constructorChain,
String parentName,
- List references) throws ASTSemanticException
+ List references, boolean isFunctionDefinition ) throws ASTSemanticException
{
boolean isConstructor = false;
boolean isDestructor = false;
@@ -1902,4 +1928,9 @@
if( lookupSymbol.isType( TypeInfo.t_type, TypeInfo.t_enumeration ) ) return true;
return false;
}
+
+ public IASTParameterDeclaration createParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause)
+ {
+ return new ASTParameterDeclaration( null, isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp, parameterName, initializerClause );
+ }
}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTParameterDeclaration.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTParameterDeclaration.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTParameterDeclaration.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTParameterDeclaration.java 11 Sep 2003 17:38:24 -0000
@@ -0,0 +1,58 @@
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.parser.ast.quick;
+
+import java.util.List;
+
+import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
+import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
+import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
+import org.eclipse.cdt.internal.core.parser.ast.ASTAbstractDeclaration;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ASTParameterDeclaration extends ASTAbstractDeclaration implements IASTParameterDeclaration
+{
+
+ private final String parameterName;
+ private final IASTInitializerClause initializerClause;
+ /**
+ * @param isConst
+ * @param typeSpecifier
+ * @param pointerOperators
+ * @param arrayModifiers
+ * @param parameterName
+ * @param initializerClause
+ */
+ public ASTParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause)
+ {
+ super( isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp );
+ this.parameterName = parameterName;
+ this.initializerClause = initializerClause;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration#getName()
+ */
+ public String getName()
+ {
+ return parameterName;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration#getDefaultValue()
+ */
+ public IASTInitializerClause getDefaultValue()
+ {
+ return initializerClause;
+ }
+}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java,v
retrieving revision 1.31
diff -u -r1.31 QuickParseASTFactory.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java 4 Sep 2003 20:46:57 -0000 1.31
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java 11 Sep 2003 17:38:24 -0000
@@ -15,6 +15,7 @@
import org.eclipse.cdt.core.parser.ITokenDuple;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.core.parser.ast.ASTClassKind;
+import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
import org.eclipse.cdt.core.parser.ast.ASTSemanticException;
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
@@ -187,7 +188,7 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createFunction(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, java.util.List, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration)
*/
- public IASTFunction createFunction(IASTScope scope, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate, boolean isConst, boolean isVolatile, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChain)
+ public IASTFunction createFunction(IASTScope scope, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate, boolean isConst, boolean isVolatile, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChain, boolean isFunctionDefinition )
{
return new ASTFunction(scope, name, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate );
}
@@ -195,7 +196,7 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createMethod(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, java.util.List, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration, boolean, boolean, boolean, boolean, boolean, boolean, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
*/
- public IASTMethod createMethod(IASTScope scope, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate, boolean isConst, boolean isVolatile, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChain)
+ public IASTMethod createMethod(IASTScope scope, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate, boolean isConst, boolean isVolatile, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChain, boolean isFunctionDefinition )
{
return new ASTMethod(scope, name, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate, isConst, isVolatile, false, false, isVirtual, isExplicit, isPureVirtual, visibility, constructorChain);
}
@@ -290,4 +291,9 @@
public boolean queryIsTypeName(IASTScope scope, ITokenDuple nameInQuestion) {
return true; // we have no information to say that it is not
}
+
+ public IASTParameterDeclaration createParameterDeclaration(boolean isConst, boolean isVolatile, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause)
+ {
+ return new ASTParameterDeclaration( isConst, isVolatile, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp, parameterName, initializerClause );
+ }
}
Index: search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java,v
retrieving revision 1.25
diff -u -r1.25 MatchLocator.java
--- search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java 9 Sep 2003 15:46:38 -0000 1.25
+++ search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java 11 Sep 2003 17:38:25 -0000
@@ -75,6 +75,7 @@
import org.eclipse.cdt.core.search.IMatch;
import org.eclipse.cdt.internal.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
+import org.eclipse.cdt.internal.core.parser.ast.complete.ASTParameterReference;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -472,6 +473,15 @@
public static void verbose(String log) {
System.out.println("(" + Thread.currentThread() + ") " + log);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptParameterReference(org.eclipse.cdt.internal.core.parser.ast.complete.ASTParameterReference)
+ */
+ public void acceptParameterReference(ASTParameterReference reference)
+ {
+ // TODO Auto-generated method stub
+
+ }
}