Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Camelon2003-07-30 01:31:14 +0000
committerJohn Camelon2003-07-30 01:31:14 +0000
commit57c348fffae10b1dc55802795fd85a828754720e (patch)
treed7aaf4cba6d98206bf75999a91125c055579aa8f /core/org.eclipse.cdt.core/parser
parent3d7a522e3ed5be925c602d1e6144e2cb4d0cca33 (diff)
downloadorg.eclipse.cdt-57c348fffae10b1dc55802795fd85a828754720e.tar.gz
org.eclipse.cdt-57c348fffae10b1dc55802795fd85a828754720e.tar.xz
org.eclipse.cdt-57c348fffae10b1dc55802795fd85a828754720e.zip
CORE
Updated AST to better represent pointers to functions/methods. Implemented typedef declaration/x-ref infrastructure. TESTS Updated QuickParseASTTests for pointer to function updates. Updated CompleteParseASTTests for typedef work.
Diffstat (limited to 'core/org.eclipse.cdt.core/parser')
-rw-r--r--core/org.eclipse.cdt.core/parser/ChangeLog4
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java12
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTAbstractDeclaration.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java40
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTPointerToFunction.java20
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTPointerToMethod.java20
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java184
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/NullSourceElementRequestor.java19
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTAbstractDeclaration.java25
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTParameterDeclaration.java44
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java9
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedef.java116
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedefReference.java62
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java87
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTPointerToFunction.java72
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTPointerToMethod.java87
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java17
18 files changed, 294 insertions, 535 deletions
diff --git a/core/org.eclipse.cdt.core/parser/ChangeLog b/core/org.eclipse.cdt.core/parser/ChangeLog
index b80a606754f..5c900c84520 100644
--- a/core/org.eclipse.cdt.core/parser/ChangeLog
+++ b/core/org.eclipse.cdt.core/parser/ChangeLog
@@ -1,3 +1,7 @@
+2003-07-29 John Camelon
+ Updated AST to better represent pointers to functions/methods.
+ Implemented typedef declaration/x-ref infrastructure.
+
2003-07-29 Victor Mozgin
Fixed PR 39546 : Parser fails on 'signed' casts.
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java
index 37841600b26..769b6f7ecd8 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java
@@ -28,8 +28,6 @@ import org.eclipse.cdt.core.parser.ast.IASTMethod;
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.IASTPointerToFunction;
-import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
@@ -95,13 +93,5 @@ public interface ISourceElementRequestor {
public void exitInclusion( IASTInclusion inclusion );
public void exitCompilationUnit( IASTCompilationUnit compilationUnit );
- /**
- * @param function
- */
- public void acceptPointerToFunction(IASTPointerToFunction function);
-
- /**
- * @param method
- */
- public void acceptPointerToMethod(IASTPointerToMethod method);
+
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTAbstractDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTAbstractDeclaration.java
index 441bc2809ed..28131c75bee 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTAbstractDeclaration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTAbstractDeclaration.java
@@ -21,6 +21,7 @@ public interface IASTAbstractDeclaration extends IASTTypeSpecifierOwner
public boolean isConst();
public Iterator getPointerOperators();
public Iterator getArrayModifiers();
-
+ public Iterator getParameters();
+ public ASTPointerOperator getPointerToFunctionOperator();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java
index 08ea4a02f99..a87d313f6d3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java
@@ -139,7 +139,7 @@ public interface IASTFactory
boolean isConst,
IASTTypeSpecifier typeSpecifier,
List pointerOperators,
- List arrayModifiers);
+ List arrayModifiers, List parameters, ASTPointerOperator pointerOperator);
public IASTMethod createMethod(
IASTScope scope,
String name,
@@ -166,7 +166,7 @@ public interface IASTFactory
public IASTField createField( IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, ASTAccessVisibility visibility) throws ASTSemanticException;
- public IASTParameterDeclaration createParameterDeclaration( boolean isConst, IASTTypeSpecifier getTypeSpecifier, List pointerOperators, List arrayModifiers, String parameterName, IASTInitializerClause initializerClause );
+ public IASTParameterDeclaration createParameterDeclaration( boolean isConst, IASTTypeSpecifier getTypeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause );
public IASTTemplateDeclaration createTemplateDeclaration( IASTScope scope, List templateParameters, boolean exported, int startingOffset );
@@ -176,42 +176,8 @@ public interface IASTFactory
public IASTTemplateSpecialization createTemplateSpecialization(IASTScope scope, int startingOffset);
- public IASTTypedefDeclaration createTypedef( IASTScope scope, String name, IASTAbstractDeclaration mapping, int startingOffset, int nameOffset );
+ public IASTTypedefDeclaration createTypedef( IASTScope scope, String name, IASTAbstractDeclaration mapping, int startingOffset, int nameOffset ) throws ASTSemanticException;
public IASTAbstractTypeSpecifierDeclaration createTypeSpecDeclaration( IASTScope scope, IASTTypeSpecifier typeSpecifier, IASTTemplate template, int startingOffset, int endingOffset);
- public IASTPointerToFunction createPointerToFunction(
- IASTScope scope,
- String name,
- List parameters,
- IASTAbstractDeclaration returnType,
- IASTExceptionSpecification exception,
- boolean isInline,
- boolean isFriend,
- boolean isStatic,
- int startOffset,
- int nameOffset,
- IASTTemplate ownerTemplate, ASTPointerOperator pointerOperator);
-
- public IASTPointerToMethod createPointerToMethod(
- 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 isConstructor,
- boolean isDestructor,
- boolean isVirtual,
- boolean isExplicit,
- boolean isPureVirtual,
- ASTAccessVisibility visibility, ASTPointerOperator pointerOperator);
-
} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTPointerToFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTPointerToFunction.java
deleted file mode 100644
index 213d0720a4c..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTPointerToFunction.java
+++ /dev/null
@@ -1,20 +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.core.parser.ast;
-
-
-/**
- * @author jcamelon
- *
- */
-public interface IASTPointerToFunction extends IASTFunction, IASTPointerOperatorOwner
-{
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTPointerToMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTPointerToMethod.java
deleted file mode 100644
index 213ea3c49db..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTPointerToMethod.java
+++ /dev/null
@@ -1,20 +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.core.parser.ast;
-
-
-/**
- * @author jcamelon
- *
- */
-public interface IASTPointerToMethod extends IASTMethod, IASTPointerOperatorOwner
-{
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java
index c716c7cf2cc..0a93537f07f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java
@@ -14,19 +14,16 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.ITokenDuple;
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
import org.eclipse.cdt.core.parser.ast.ASTSemanticException;
+import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTFactory;
import org.eclipse.cdt.core.parser.ast.IASTField;
import org.eclipse.cdt.core.parser.ast.IASTFunction;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
-import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
-import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTTemplate;
@@ -316,65 +313,115 @@ public class DeclarationWrapper implements IDeclaratorOwner
boolean isWithinClass = (getScope() instanceof IASTClassSpecifier); //TODO fix this for COMPLETE_PARSE
boolean isFunction = declarator.isFunction();
boolean hasInnerDeclarator = ( declarator.getOwnedDeclarator() != null );
-
+
if( hasInnerDeclarator )
- {
- ITokenDuple innerPointerName = declarator.getOwnedDeclarator().getPointerOperatorNameDuple();
- if( innerPointerName != null && innerPointerName.getLastToken().getType() == IToken.tCOLONCOLON )
- return createP2MethodASTNode(declarator);
- else
- return createP2FunctionASTNode( declarator );
- }
-
+ return createIndirectDeclaration( declarator );
+
if (isTypedef())
- return createTypedef(declarator);
+ return createTypedef(declarator, false);
if (isWithinClass )
{
if( isFunction)
- return createMethodASTNode(declarator);
+ return createMethodASTNode(declarator, false);
else
- return createFieldASTNode(declarator);
+ return createFieldASTNode(declarator, false );
}
else
{
if (isFunction)
- return createFunctionASTNode(declarator);
+ return createFunctionASTNode(declarator, false);
else
- return createVariableASTNode(declarator);
+ return createVariableASTNode(declarator, false);
}
}
/**
* @param declarator
* @return
*/
- private IASTTypedefDeclaration createTypedef(Declarator declarator)
+ private IASTDeclaration createIndirectDeclaration(Declarator declarator) throws ASTSemanticException
+ {
+ if( declarator.getOwnedDeclarator().getOwnedDeclarator() == null )
+ {
+
+ Declarator d = declarator.getOwnedDeclarator();
+ Iterator i = d.getPtrOps().iterator();
+ if( !i.hasNext() )
+ {
+ boolean isWithinClass = scope instanceof IASTClassSpecifier;
+ boolean isFunction = (declarator.getParameters().size() != 0);
+ if (isTypedef())
+ return createTypedef(declarator, true);
+
+ if (isWithinClass )
+ {
+ if( isFunction)
+ return createMethodASTNode(declarator, true);
+ else
+ return createFieldASTNode(declarator, true );
+ }
+ else
+ {
+ if (isFunction)
+ return createFunctionASTNode(declarator, true);
+ else
+ return createVariableASTNode(declarator, true);
+ }
+
+ }
+
+ List convertedParms = createParameterList( declarator.getParameters() );
+ IASTAbstractDeclaration abs = astFactory.createAbstractDeclaration(
+ constt, getTypeSpecifier(), declarator.getPtrOps(), declarator.getArrayModifiers(), convertedParms,
+ (ASTPointerOperator)i.next() );
+ String name = ( d.getPointerOperatorNameDuple() != null ) ? d.getPointerOperatorNameDuple().toString() + d.getName() : d.getName();
+ if( typedef )
+ return astFactory.createTypedef(
+ scope,
+ name,
+ abs, getStartingOffset(), d.getNameStartOffset() );
+ else
+ return astFactory.createVariable( scope, name, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), d.getNameStartOffset() );
+
+ }
+ else
+ {
+ throw new ASTSemanticException();
+ }
+
+ }
+
+ /**
+ * @param declarator
+ * @return
+ */
+ private IASTTypedefDeclaration createTypedef(Declarator declarator, boolean nested ) throws ASTSemanticException
{
return astFactory.createTypedef(
scope,
- declarator.getName(),
+ nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
astFactory.createAbstractDeclaration(
constt,
getTypeSpecifier(),
declarator.getPtrOps(),
- declarator.getArrayModifiers()), startingOffset, declarator.getNameStartOffset());
+ declarator.getArrayModifiers(), null, null), startingOffset, declarator.getNameStartOffset());
}
/**
* @param declarator
* @return
*/
- private IASTMethod createMethodASTNode(Declarator declarator) throws ASTSemanticException
+ private IASTMethod createMethodASTNode(Declarator declarator, boolean nested) throws ASTSemanticException
{
return astFactory
.createMethod(
scope,
- declarator.getName(),
+ nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
createParameterList(declarator.getParameters()),
astFactory.createAbstractDeclaration(
constt,
getTypeSpecifier(),
declarator.getPtrOps(),
- declarator.getArrayModifiers()),
+ declarator.getArrayModifiers(), null, null),
declarator.getExceptionSpecification(),
inline,
friend,
@@ -396,17 +443,17 @@ public class DeclarationWrapper implements IDeclaratorOwner
* @param declarator
* @return
*/
- private IASTFunction createFunctionASTNode(Declarator declarator) throws ASTSemanticException
+ private IASTFunction createFunctionASTNode(Declarator declarator, boolean nested) throws ASTSemanticException
{
return astFactory.createFunction(
scope,
- declarator.getName(),
+ nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
createParameterList(declarator.getParameters()),
astFactory.createAbstractDeclaration(
constt,
getTypeSpecifier(),
declarator.getPtrOps(),
- declarator.getArrayModifiers()),
+ declarator.getArrayModifiers(), null, null),
declarator.getExceptionSpecification(),
inline,
friend,
@@ -419,11 +466,11 @@ public class DeclarationWrapper implements IDeclaratorOwner
* @param declarator
* @return
*/
- private IASTField createFieldASTNode(Declarator declarator) throws ASTSemanticException
+ private IASTField createFieldASTNode(Declarator declarator, boolean nested) throws ASTSemanticException
{
return astFactory.createField(
scope,
- declarator.getName(),
+ nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
auto,
declarator.getInitializerClause(),
declarator.getBitFieldExpression(),
@@ -431,7 +478,7 @@ public class DeclarationWrapper implements IDeclaratorOwner
constt,
getTypeSpecifier(),
declarator.getPtrOps(),
- declarator.getArrayModifiers()),
+ declarator.getArrayModifiers(), null, null),
mutable,
extern,
register,
@@ -457,10 +504,10 @@ public class DeclarationWrapper implements IDeclaratorOwner
wrapper.getTypeSpecifier(),
declarator.getPtrOps(),
declarator.getArrayModifiers(),
- declarator.getName() == null
- ? ""
- : declarator.getName(),
- declarator.getInitializerClause()));
+ null,
+ null, declarator.getName() == null
+ ? ""
+ : declarator.getName(), declarator.getInitializerClause()));
}
}
return result;
@@ -469,11 +516,11 @@ public class DeclarationWrapper implements IDeclaratorOwner
* @param declarator
* @return
*/
- private IASTVariable createVariableASTNode(Declarator declarator) throws ASTSemanticException
+ private IASTVariable createVariableASTNode(Declarator declarator, boolean nested ) throws ASTSemanticException
{
return astFactory.createVariable(
scope,
- declarator.getName(),
+ nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
isAuto(),
declarator.getInitializerClause(),
declarator.getBitFieldExpression(),
@@ -481,75 +528,14 @@ public class DeclarationWrapper implements IDeclaratorOwner
constt,
getTypeSpecifier(),
declarator.getPtrOps(),
- declarator.getArrayModifiers()),
+ declarator.getArrayModifiers(), null, null),
mutable,
extern,
register,
staticc,
getStartingOffset(),
declarator.getNameStartOffset());
- }
-
- /**
- * @param declarator
- * @return
- */
- private IASTPointerToMethod createP2MethodASTNode(Declarator declarator)
- {
-
- return astFactory
- .createPointerToMethod(
- scope,
- declarator.getOwnedDeclarator().getPointerOperatorNameDuple().toString().trim() +
- declarator.getOwnedDeclarator().getName().trim(),
- createParameterList(declarator.getParameters()),
- astFactory.createAbstractDeclaration(
- constt,
- getTypeSpecifier(),
- declarator.getPtrOps(),
- declarator.getArrayModifiers()),
- declarator.getExceptionSpecification(),
- inline,
- friend,
- staticc,
- startingOffset,
- declarator.getOwnedDeclarator().getNameStartOffset(),
- templateDeclaration,
- declarator.isConst(),
- declarator.isVolatile(),
- false,
- // isConstructor
- false, // isDestructor
- virtual,
- explicit,
- declarator.isPureVirtual(),
- ((scope instanceof IASTClassSpecifier )? ((IASTClassSpecifier)scope).getCurrentVisibilityMode() : ASTAccessVisibility.PUBLIC )
- , (ASTPointerOperator)declarator.getOwnedDeclarator().getPtrOps().get(0));
- }
- /**
- * @param declarator
- * @return
- */
- private IASTPointerToFunction createP2FunctionASTNode(Declarator declarator)
- {
- return astFactory.createPointerToFunction(
- scope,
- declarator.getOwnedDeclarator().getName(),
- createParameterList(declarator.getParameters()),
- astFactory.createAbstractDeclaration(
- constt,
- getTypeSpecifier(),
- declarator.getPtrOps(),
- declarator.getArrayModifiers()),
- declarator.getExceptionSpecification(),
- inline,
- friend,
- staticc,
- startingOffset,
- declarator.getOwnedDeclarator().getNameStartOffset(),
- templateDeclaration, (ASTPointerOperator)declarator.getOwnedDeclarator().getPtrOps().get(0));
- }
-
+ }
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.IDeclaratorOwner#getDeclarationWrapper()
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/NullSourceElementRequestor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/NullSourceElementRequestor.java
index 28ed341b1ec..58a7719d4b5 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/NullSourceElementRequestor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/NullSourceElementRequestor.java
@@ -20,8 +20,6 @@ import org.eclipse.cdt.core.parser.ast.IASTMethod;
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.IASTPointerToFunction;
-import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
@@ -333,23 +331,8 @@ public class NullSourceElementRequestor implements ISourceElementRequestor
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptPointerToFunction(org.eclipse.cdt.core.parser.ast.IASTPointerToFunction)
- */
- public void acceptPointerToFunction(IASTPointerToFunction function)
- {
- // TODO Auto-generated method stub
-
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptPointerToMethod(org.eclipse.cdt.core.parser.ast.IASTPointerToMethod)
- */
- public void acceptPointerToMethod(IASTPointerToMethod method)
- {
- // TODO Auto-generated method stub
-
- }
+
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedefReference(org.eclipse.cdt.core.parser.ast.IASTTypedefReference)
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java
index ef988c093ab..31f4856ddd9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java
@@ -595,10 +595,10 @@ public class Parser implements IParser
wrapper.getTypeSpecifier(),
declarator.getPtrOps(),
declarator.getArrayModifiers(),
- declarator.getName() == null
- ? ""
- : declarator.getName(),
- declarator.getInitializerClause()),
+ null,
+ null, declarator.getName() == null
+ ? ""
+ : declarator.getName(), declarator.getInitializerClause()),
null));
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTAbstractDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTAbstractDeclaration.java
index 75ecbc20cc2..d10b22fc735 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTAbstractDeclaration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTAbstractDeclaration.java
@@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core.parser.ast;
import java.util.Iterator;
import java.util.List;
+import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
@@ -22,22 +23,26 @@ import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
*/
public class ASTAbstractDeclaration implements IASTAbstractDeclaration
{
- private final boolean isConst;
+ private final List parms;
+ private final boolean isConst;
private final IASTTypeSpecifier typeSpecifier;
private final List pointerOperators;
private final List arrayModifiers;
+ private final ASTPointerOperator pointerOperator;
/**
* @param isConst
* @param typeSpecifier
* @param pointerOperators
* @param arrayModifiers
*/
- public ASTAbstractDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers)
+ public ASTAbstractDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp )
{
this.isConst = isConst;
this.typeSpecifier = typeSpecifier;
this.pointerOperators = pointerOperators;
- this.arrayModifiers = arrayModifiers;
+ this.arrayModifiers = arrayModifiers;
+ this.parms = parameters;
+ this.pointerOperator = pointerOp;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#isConst()
@@ -67,4 +72,18 @@ public class ASTAbstractDeclaration implements IASTAbstractDeclaration
{
return arrayModifiers.iterator();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getParameters()
+ */
+ public Iterator getParameters()
+ {
+ return parms.iterator();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getPointerToFunctionOperator()
+ */
+ public ASTPointerOperator getPointerToFunctionOperator()
+ {
+ return pointerOperator;
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTParameterDeclaration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTParameterDeclaration.java
index 18d7a2d27ea..1e6724ce1c0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTParameterDeclaration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTParameterDeclaration.java
@@ -10,9 +10,9 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast;
-import java.util.Iterator;
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;
@@ -21,12 +21,9 @@ import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
* @author jcamelon
*
*/
-public class ASTParameterDeclaration implements IASTParameterDeclaration
+public class ASTParameterDeclaration extends ASTAbstractDeclaration implements IASTParameterDeclaration
{
- private final boolean isConst;
- private final IASTTypeSpecifier typeSpecifier;
- private final List pointerOperators;
- private final List arrayModifiers;
+
private final String parameterName;
private final IASTInitializerClause initializerClause;
/**
@@ -37,12 +34,9 @@ public class ASTParameterDeclaration implements IASTParameterDeclaration
* @param parameterName
* @param initializerClause
*/
- public ASTParameterDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, String parameterName, IASTInitializerClause initializerClause)
+ public ASTParameterDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause)
{
- this.isConst = isConst;
- this.typeSpecifier = typeSpecifier;
- this.pointerOperators = pointerOperators;
- this.arrayModifiers = arrayModifiers;
+ super( isConst, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp );
this.parameterName = parameterName;
this.initializerClause = initializerClause;
}
@@ -60,32 +54,4 @@ public class ASTParameterDeclaration implements IASTParameterDeclaration
{
return initializerClause;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#isConst()
- */
- public boolean isConst()
- {
- return isConst;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getTypeSpecifier()
- */
- public IASTTypeSpecifier getTypeSpecifier()
- {
- return typeSpecifier;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getPointerOperators()
- */
- public Iterator getPointerOperators()
- {
- return pointerOperators.iterator();
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration#getArrayModifiers()
- */
- public Iterator getArrayModifiers()
- {
- return arrayModifiers.iterator();
- }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java
index c444f1b4d8f..a0fdfc57dc4 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java
@@ -12,6 +12,7 @@ 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.IASTAbstractDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
@@ -48,14 +49,14 @@ public class BaseASTFactory {
return inclusion;
}
- public IASTAbstractDeclaration createAbstractDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers)
+ public IASTAbstractDeclaration createAbstractDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOperator)
{
- return new ASTAbstractDeclaration( isConst, typeSpecifier, pointerOperators, arrayModifiers );
+ return new ASTAbstractDeclaration( isConst, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOperator );
}
- public IASTParameterDeclaration createParameterDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, String parameterName, IASTInitializerClause initializerClause)
+ public IASTParameterDeclaration createParameterDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause)
{
- return new ASTParameterDeclaration( isConst, typeSpecifier, pointerOperators, arrayModifiers, parameterName, initializerClause );
+ return new ASTParameterDeclaration( isConst, typeSpecifier, pointerOperators, arrayModifiers, parameters, pointerOp, parameterName, initializerClause );
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedef.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedef.java
index 2fad6008395..6ef5e09b415 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedef.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedef.java
@@ -10,121 +10,137 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.complete;
+import java.util.List;
+
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
+import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
+import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
+import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
/**
* @author jcamelon
*
*/
-public class ASTTypedef implements IASTTypedefDeclaration
+public class ASTTypedef extends ASTSymbol implements IASTTypedefDeclaration
{
+
+ private final IASTAbstractDeclaration mapping;
+ private NamedOffsets offsets = new NamedOffsets();
+ private final ASTQualifiedNamedElement qualifiedName;
+ private final ASTReferenceStore referenceStore;
+
/**
- *
+ * @param newSymbol
+ * @param mapping
+ * @param startingOffset
+ * @param nameOffset
+ * @param references
*/
- public ASTTypedef()
+ public ASTTypedef(ISymbol newSymbol, IASTAbstractDeclaration mapping, int startingOffset, int nameOffset, List references)
{
- super();
- // TODO Auto-generated constructor stub
+ super( newSymbol );
+ this.mapping = mapping;
+ this.referenceStore = new ASTReferenceStore( references );
+ this.qualifiedName = new ASTQualifiedNamedElement( getOwnerScope(), newSymbol.getName());
+ setStartingOffset(startingOffset);
+ setNameOffset(nameOffset);
}
+
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
+ * @see org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration#getName()
*/
public String getName()
{
- // TODO Auto-generated method stub
- return null;
+ return getSymbol().getName();
}
+
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration#getAbstractDeclarator()
*/
public IASTAbstractDeclaration getAbstractDeclarator()
{
- // TODO Auto-generated method stub
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
- */
- public int getNameOffset()
- {
- // TODO Auto-generated method stub
- return 0;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
- */
- public void setNameOffset(int o)
- {
- // TODO Auto-generated method stub
+ return mapping;
}
+
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
+ * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
- public String[] getFullyQualifiedName()
+ public void acceptElement(ISourceElementRequestor requestor)
{
- // TODO Auto-generated method stub
- return null;
+ requestor.acceptTypedefDeclaration(this);
+ referenceStore.processReferences(requestor);
}
+
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
+ * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
- public IASTScope getOwnerScope()
- {
- // TODO Auto-generated method stub
- return null;
+ public void enterScope(ISourceElementRequestor requestor)
+ {
}
+
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+ * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
- public void acceptElement(ISourceElementRequestor requestor)
+ public void exitScope(ISourceElementRequestor requestor)
{
- // TODO Auto-generated method stub
}
+
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
*/
- public void enterScope(ISourceElementRequestor requestor)
+ public int getNameOffset()
{
- // TODO Auto-generated method stub
+ return offsets.getNameOffset();
}
+
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
*/
- public void exitScope(ISourceElementRequestor requestor)
+ public void setNameOffset(int o)
{
- // TODO Auto-generated method stub
+ offsets.setNameOffset(o);
}
+
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
*/
public void setStartingOffset(int o)
{
- // TODO Auto-generated method stub
+ offsets.setStartingOffset(o);
}
+
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
*/
public void setEndingOffset(int o)
{
- // TODO Auto-generated method stub
+ offsets.setEndingOffset(o);
}
+
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
*/
public int getStartingOffset()
{
- // TODO Auto-generated method stub
- return 0;
+ return offsets.getStartingOffset();
}
+
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
*/
public int getEndingOffset()
{
- // TODO Auto-generated method stub
- return 0;
+ return offsets.getEndingOffset();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
+ */
+ public String[] getFullyQualifiedName()
+ {
+ return qualifiedName.getFullyQualifiedName();
}
+
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedefReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedefReference.java
new file mode 100644
index 00000000000..05fdcb579c9
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTTypedefReference.java
@@ -0,0 +1,62 @@
+/**********************************************************************
+ * 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.IASTTypedefDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTTypedefReference;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ASTTypedefReference
+ extends ASTReference
+ implements IASTTypedefReference
+{
+ private final IASTTypedefDeclaration referencedItem;
+ /**
+ * @param offset
+ * @param name
+ */
+ public ASTTypedefReference(int offset, String name, IASTTypedefDeclaration referencedItem )
+ {
+ super(offset, name);
+ this.referencedItem = referencedItem;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTReference#getReferencedElement()
+ */
+ public ISourceElementCallbackDelegate getReferencedElement()
+ {
+ return referencedItem;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+ */
+ public void acceptElement(ISourceElementRequestor requestor)
+ {
+ requestor.acceptTypedefReference(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)
+ {
+ }
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
index 316e9100d04..6b6e6600981 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
@@ -38,8 +38,6 @@ import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
-import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
import org.eclipse.cdt.core.parser.ast.IASTReference;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
@@ -432,6 +430,10 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
{
return new ASTClassReference( offset, string, (IASTClassSpecifier)symbol.getASTExtension().getPrimaryDeclaration() );
}
+ else if( symbol.getTypeInfo().checkBit( TypeInfo.isTypedef ))
+ {
+ return new ASTTypedefReference( offset, string, (IASTTypedefDeclaration)symbol.getASTExtension().getPrimaryDeclaration());
+ }
else if( symbol.getType() == TypeInfo.t_enumeration )
return new ASTEnumerationReference( offset, string, (IASTEnumerationSpecifier)symbol.getASTExtension().getPrimaryDeclaration() );
else if( symbol.getType() == TypeInfo.t_function )
@@ -1137,10 +1139,36 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
String name,
IASTAbstractDeclaration mapping,
int startingOffset,
- int nameOffset)
+ int nameOffset) throws ASTSemanticException
{
- // TODO Auto-generated method stub
- return new ASTTypedef();
+ IContainerSymbol containerSymbol = scopeToSymbol(scope);
+ ISymbol newSymbol = pst.newSymbol( name, TypeInfo.t_type);
+ newSymbol.getTypeInfo().setBit( true,TypeInfo.isTypedef );
+
+ List references = new ArrayList();
+ if( mapping.getTypeSpecifier() instanceof ASTSimpleTypeSpecifier )
+ {
+ references.addAll( ((ASTSimpleTypeSpecifier)mapping.getTypeSpecifier()).getReferences() );
+ }
+
+ try
+ {
+ containerSymbol.addSymbol( newSymbol );
+ }
+ catch (ParserSymbolTableException e)
+ {
+ throw new ASTSemanticException();
+ }
+ ASTTypedef d = new ASTTypedef( newSymbol, mapping, startingOffset, nameOffset, references );
+ try
+ {
+ attachSymbolExtension(newSymbol, d );
+ }
+ catch (ExtensionException e1)
+ {
+ throw new ASTSemanticException();
+ }
+ return d;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypeSpecDeclaration(org.eclipse.cdt.core.parser.ast.IASTScope, org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier, org.eclipse.cdt.core.parser.ast.IASTTemplate, int, int)
@@ -1154,54 +1182,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
{
return new ASTAbstractTypeSpecifierDeclaration( scopeToSymbol(scope), typeSpecifier, template, startingOffset, endingOffset);
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createPointerToFunction(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.IASTTemplate, org.eclipse.cdt.core.parser.ast.ASTPointerOperator)
- */
- public IASTPointerToFunction createPointerToFunction(
- IASTScope scope,
- String name,
- List parameters,
- IASTAbstractDeclaration returnType,
- IASTExceptionSpecification exception,
- boolean isInline,
- boolean isFriend,
- boolean isStatic,
- int startOffset,
- int nameOffset,
- IASTTemplate ownerTemplate,
- ASTPointerOperator pointerOperator)
- {
- // TODO Auto-generated method stub
- return null;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createPointerToMethod(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.IASTTemplate, boolean, boolean, boolean, boolean, boolean, boolean, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility, org.eclipse.cdt.core.parser.ast.ASTPointerOperator)
- */
- public IASTPointerToMethod createPointerToMethod(
- 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 isConstructor,
- boolean isDestructor,
- boolean isVirtual,
- boolean isExplicit,
- boolean isPureVirtual,
- ASTAccessVisibility visibility,
- ASTPointerOperator pointerOperator)
- {
- // TODO Auto-generated method stub
- return null;
- }
+
protected ParserSymbolTable pst = new ParserSymbolTable();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTPointerToFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTPointerToFunction.java
deleted file mode 100644
index 55e49bd2d32..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTPointerToFunction.java
+++ /dev/null
@@ -1,72 +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.quick;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
-import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTTemplate;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTPointerToFunction
- extends ASTFunction
- implements IASTPointerToFunction
-{
-
- private final ASTPointerOperator pointerOperator;
-
- /**
- * @param scope
- * @param name
- * @param parameters
- * @param returnType
- * @param exception
- * @param isInline
- * @param isFriend
- * @param isStatic
- * @param startOffset
- * @param nameOffset
- * @param ownerTemplate
- */
- public ASTPointerToFunction(IASTScope scope, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate, ASTPointerOperator pointerOperator)
- {
- super(
- scope,
- name,
- parameters,
- returnType,
- exception,
- isInline,
- isFriend,
- isStatic,
- startOffset,
- nameOffset,
- ownerTemplate);
- this.pointerOperator = pointerOperator;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTPointerOperatorOwner#getPointerOperator()
- */
- public ASTPointerOperator getPointerOperator()
- {
- return pointerOperator;
- }
-
-
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTPointerToMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTPointerToMethod.java
deleted file mode 100644
index bd634495cc1..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTPointerToMethod.java
+++ /dev/null
@@ -1,87 +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.quick;
-
-import java.util.List;
-
-import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
-import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
-import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTTemplate;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTPointerToMethod
- extends ASTMethod
- implements IASTPointerToMethod
-{
-
- private final ASTPointerOperator pointerOperator;
-
- /**
- * @param scope
- * @param name
- * @param parameters
- * @param returnType
- * @param exception
- * @param isInline
- * @param isFriend
- * @param isStatic
- * @param startOffset
- * @param nameOffset
- * @param ownerTemplate
- * @param isConst
- * @param isVolatile
- * @param isConstructor
- * @param isDestructor
- * @param isVirtual
- * @param isExplicit
- * @param isPureVirtual
- * @param visibility
- */
- public ASTPointerToMethod(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 isConstructor, boolean isDestructor, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, ASTAccessVisibility visibility, ASTPointerOperator pointerOperator)
- {
- super(
- scope,
- name,
- parameters,
- returnType,
- exception,
- isInline,
- isFriend,
- isStatic,
- startOffset,
- nameOffset,
- ownerTemplate,
- isConst,
- isVolatile,
- isConstructor,
- isDestructor,
- isVirtual,
- isExplicit,
- isPureVirtual,
- visibility);
- this.pointerOperator = pointerOperator;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTPointerOperatorOwner#getPointerOperator()
- */
- public ASTPointerOperator getPointerOperator()
- {
- return pointerOperator;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java
index 2ae3f3ab4f8..36fa6a8a9fa 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java
@@ -15,7 +15,6 @@ import java.util.List;
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;
@@ -37,8 +36,6 @@ import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
-import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
-import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTTemplate;
@@ -288,19 +285,5 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
return new ASTAbstractTypeSpecifierDeclaration( scope, typeSpecifier, template, startingOffset, endingOffset );
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createPointerToFunction(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.IASTTemplate)
- */
- public IASTPointerToFunction createPointerToFunction(IASTScope scope, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate, ASTPointerOperator pointerOperator)
- {
- return new ASTPointerToFunction( scope, name, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate, pointerOperator);
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createPointerToMethod(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.IASTTemplate, boolean, boolean, boolean, boolean, boolean, boolean, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
- */
- public IASTPointerToMethod createPointerToMethod(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 isConstructor, boolean isDestructor, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, ASTAccessVisibility visibility, ASTPointerOperator pointerOperator)
- {
- return new ASTPointerToMethod(scope, name, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate, isConst, isVolatile, isConstructor, isDestructor, isVirtual, isExplicit, isPureVirtual, visibility, pointerOperator);
- }
}

Back to the top