mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +02:00
CORE
Fixed Bug 43503 : Search:f_SD_01 cannot be found in ManyClasses20 Project Fixed Bug 43680 : Fix Parser Error Handling TESTS Updated CompleteParseASTTest::testBug42872() Moved FailedCompleteParseASTTest::testBug43503() to CompleteParseASTTest::testBug43503A().
This commit is contained in:
parent
148f6add3c
commit
007714a394
9 changed files with 755 additions and 349 deletions
|
@ -1,3 +1,7 @@
|
|||
2003-09-30 John Camelon
|
||||
Updated CompleteParseASTTest::testBug42872()
|
||||
Moved FailedCompleteParseASTTest::testBug43503() to CompleteParseASTTest::testBug43503A().
|
||||
|
||||
2003-09-30 Andrew Niefer
|
||||
added testBug43503_AmbiguousUsing() and testBug43503_UnableToResolveFunction() to
|
||||
ParserSymbolTableTest
|
||||
|
|
|
@ -114,20 +114,4 @@ public class FailedCompleteParseASTTest extends CompleteParseBaseTest
|
|||
assertFalse( i.hasNext() );
|
||||
assertAllReferences( 4 /*should be 5 */, createTaskList( new Task( cl /* , 2 */ ), new Task( a), new Task( pm), new Task( f2)));
|
||||
}
|
||||
|
||||
public void testBug43503 () throws Exception {
|
||||
Iterator i = parse("class SD_01 { f_SD_01() {}}; int main(){ SD_01 * a = new SD_01(); a->f_SD_01(); } ").getDeclarations();
|
||||
IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
Iterator j = getDeclarations(classA);
|
||||
IASTMethod f = (IASTMethod)j.next();
|
||||
assertFalse(j.hasNext());
|
||||
IASTFunction main = (IASTFunction) i.next();
|
||||
assertFalse(i.hasNext());
|
||||
Iterator k = getDeclarations(main);
|
||||
|
||||
assertFalse(k.hasNext()); // this should be true, there is one declaration of "a"
|
||||
// "a" is found to be in a multiplication expression, not a declaration
|
||||
// not knowing "a" causes us to not find the reference to "f"
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -745,9 +745,22 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
|||
IASTClassSpecifier structB = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
IASTClassSpecifier structD = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
IASTFunction foo = (IASTFunction)i.next();
|
||||
IASTVariable bp = (IASTVariable)getDeclarations(foo).next();
|
||||
assertFalse( i.hasNext() );
|
||||
}
|
||||
|
||||
public void testBug43503A() throws Exception {
|
||||
Iterator i = parse("class SD_01 { f_SD_01() {}}; int main(){ SD_01 * a = new SD_01(); a->f_SD_01(); } ").getDeclarations();
|
||||
IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
|
||||
Iterator j = getDeclarations(classA);
|
||||
IASTMethod f = (IASTMethod)j.next();
|
||||
assertFalse(j.hasNext());
|
||||
IASTFunction main = (IASTFunction) i.next();
|
||||
assertFalse(i.hasNext());
|
||||
Iterator k = getDeclarations(main);
|
||||
assertTrue(k.hasNext());
|
||||
}
|
||||
|
||||
|
||||
public void testBug42979() throws Exception
|
||||
{
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2003-09-30 John Camelon
|
||||
Fixed Bug 43503 : Search:f_SD_01 cannot be found in ManyClasses20 Project
|
||||
Fixed Bug 43680 : Fix Parser Error Handling
|
||||
|
||||
2003-09-30 Hoda Amer
|
||||
-Solution to [Bug 43053] require reference cleanup for expressions
|
||||
Added purgeReferences() at the end of ASTExpression::acceptElement()
|
||||
|
|
|
@ -24,32 +24,32 @@ public interface IASTFactory
|
|||
String name,
|
||||
int startingOffset,
|
||||
int nameOffset,
|
||||
int nameEndOffset, int endingOffset);
|
||||
int nameEndOffset, int endingOffset) throws Exception;
|
||||
public IASTInclusion createInclusion(
|
||||
String name,
|
||||
String fileName,
|
||||
boolean local,
|
||||
int startingOffset,
|
||||
int nameOffset,
|
||||
int nameEndOffset, int endingOffset);
|
||||
int nameEndOffset, int endingOffset) throws Exception;
|
||||
public IASTUsingDirective createUsingDirective(
|
||||
IASTScope scope,
|
||||
ITokenDuple duple, int startingOffset, int endingOffset)
|
||||
throws ASTSemanticException;
|
||||
throws ASTSemanticException, Exception;
|
||||
public IASTUsingDeclaration createUsingDeclaration(
|
||||
IASTScope scope,
|
||||
boolean isTypeName,
|
||||
ITokenDuple name, int startingOffset, int endingOffset) throws ASTSemanticException;
|
||||
ITokenDuple name, int startingOffset, int endingOffset) throws ASTSemanticException, Exception;
|
||||
public IASTASMDefinition createASMDefinition(
|
||||
IASTScope scope,
|
||||
String assembly,
|
||||
int first,
|
||||
int last);
|
||||
int last)throws Exception;
|
||||
public IASTNamespaceDefinition createNamespaceDefinition(
|
||||
IASTScope scope,
|
||||
String identifier,
|
||||
int startingOffset,
|
||||
int nameOffset, int nameEndOffset) throws ASTSemanticException;
|
||||
int nameOffset, int nameEndOffset) throws ASTSemanticException, Exception;
|
||||
|
||||
public IASTNamespaceAlias createNamespaceAlias(
|
||||
IASTScope scope,
|
||||
|
@ -57,12 +57,12 @@ public interface IASTFactory
|
|||
ITokenDuple alias,
|
||||
int startingOffset,
|
||||
int nameOffset,
|
||||
int nameEndOffset, int endOffset ) throws ASTSemanticException;
|
||||
int nameEndOffset, int endOffset ) throws ASTSemanticException, Exception;
|
||||
|
||||
public IASTCompilationUnit createCompilationUnit();
|
||||
public IASTCompilationUnit createCompilationUnit() throws Exception;
|
||||
public IASTLinkageSpecification createLinkageSpecification(
|
||||
IASTScope scope,
|
||||
String spec, int startingOffset);
|
||||
String spec, int startingOffset) throws Exception;
|
||||
public IASTClassSpecifier createClassSpecifier(
|
||||
IASTScope scope,
|
||||
ITokenDuple name,
|
||||
|
@ -70,7 +70,7 @@ public interface IASTFactory
|
|||
ClassNameType type,
|
||||
ASTAccessVisibility access,
|
||||
int startingOffset,
|
||||
int nameOffset, int nameEndOffset) throws ASTSemanticException;
|
||||
int nameOffset, int nameEndOffset) throws ASTSemanticException, Exception;
|
||||
/**
|
||||
* @param astClassSpec
|
||||
* @param isVirtual
|
||||
|
@ -81,21 +81,21 @@ public interface IASTFactory
|
|||
IASTClassSpecifier astClassSpec,
|
||||
boolean isVirtual,
|
||||
ASTAccessVisibility visibility,
|
||||
ITokenDuple parentClassName) throws ASTSemanticException;
|
||||
ITokenDuple parentClassName) throws ASTSemanticException, Exception;
|
||||
public IASTElaboratedTypeSpecifier createElaboratedTypeSpecifier(
|
||||
IASTScope scope,
|
||||
ASTClassKind elaboratedClassKind,
|
||||
ITokenDuple typeName,
|
||||
int startingOffset, int endOffset, boolean isForewardDecl) throws ASTSemanticException;
|
||||
int startingOffset, int endOffset, boolean isForewardDecl) throws ASTSemanticException, Exception;
|
||||
public IASTEnumerationSpecifier createEnumerationSpecifier(
|
||||
IASTScope scope,
|
||||
String name,
|
||||
int startingOffset, int nameOffset, int nameEndOffset) throws ASTSemanticException;
|
||||
int startingOffset, int nameOffset, int nameEndOffset) throws ASTSemanticException, Exception;
|
||||
public void addEnumerator(
|
||||
IASTEnumerationSpecifier enumeration,
|
||||
String string,
|
||||
int startingOffset,
|
||||
int nameOffset, int nameEndOffset, int endingOffset, IASTExpression initialValue)throws ASTSemanticException;
|
||||
int nameOffset, int nameEndOffset, int endingOffset, IASTExpression initialValue)throws ASTSemanticException, Exception;
|
||||
public IASTExpression createExpression(
|
||||
IASTScope scope,
|
||||
IASTExpression.Kind kind,
|
||||
|
@ -103,17 +103,17 @@ public interface IASTFactory
|
|||
IASTExpression rhs,
|
||||
IASTExpression thirdExpression,
|
||||
IASTTypeId typeId,
|
||||
ITokenDuple idExpression, String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException;
|
||||
public IASTExpression.IASTNewExpressionDescriptor createNewDescriptor(List newPlacementExpressions,List newTypeIdExpressions,List newInitializerExpressions);
|
||||
ITokenDuple idExpression, String literal, IASTNewExpressionDescriptor newDescriptor) throws ASTSemanticException, Exception;
|
||||
public IASTExpression.IASTNewExpressionDescriptor createNewDescriptor(List newPlacementExpressions,List newTypeIdExpressions,List newInitializerExpressions)throws Exception;
|
||||
public IASTInitializerClause createInitializerClause(
|
||||
IASTInitializerClause.Kind kind,
|
||||
IASTExpression assignmentExpression,
|
||||
List initializerClauses);
|
||||
public IASTExceptionSpecification createExceptionSpecification(IASTScope scope, List typeIds) throws ASTSemanticException;
|
||||
List initializerClauses) throws Exception;
|
||||
public IASTExceptionSpecification createExceptionSpecification(IASTScope scope, List typeIds) throws ASTSemanticException, Exception;
|
||||
/**
|
||||
* @param exp
|
||||
*/
|
||||
public IASTArrayModifier createArrayModifier(IASTExpression exp);
|
||||
public IASTArrayModifier createArrayModifier(IASTExpression exp) throws Exception;
|
||||
/**
|
||||
* @param duple
|
||||
* @param expressionList
|
||||
|
@ -121,7 +121,7 @@ public interface IASTFactory
|
|||
*/
|
||||
public IASTConstructorMemberInitializer createConstructorMemberInitializer(
|
||||
IASTScope scope,
|
||||
ITokenDuple duple, IASTExpression expressionList) throws ASTSemanticException;
|
||||
ITokenDuple duple, IASTExpression expressionList) throws ASTSemanticException, Exception;
|
||||
public IASTSimpleTypeSpecifier createSimpleTypeSpecifier(
|
||||
IASTScope scope,
|
||||
IASTSimpleTypeSpecifier.Type kind,
|
||||
|
@ -129,7 +129,7 @@ public interface IASTFactory
|
|||
boolean isShort,
|
||||
boolean isLong,
|
||||
boolean isSigned,
|
||||
boolean isUnsigned, boolean isTypename) throws ASTSemanticException;
|
||||
boolean isUnsigned, boolean isTypename) throws ASTSemanticException, Exception;
|
||||
public IASTFunction createFunction(
|
||||
IASTScope scope,
|
||||
String name,
|
||||
|
@ -147,12 +147,12 @@ public interface IASTFactory
|
|||
boolean isVolatile,
|
||||
boolean isVirtual,
|
||||
boolean isExplicit,
|
||||
boolean isPureVirtual, List constructorChain, boolean isDefinition ) throws ASTSemanticException;
|
||||
boolean isPureVirtual, List constructorChain, boolean isDefinition ) throws ASTSemanticException, Exception;
|
||||
public IASTAbstractDeclaration createAbstractDeclaration(
|
||||
boolean isConst,
|
||||
boolean isVolatile,
|
||||
IASTTypeSpecifier typeSpecifier,
|
||||
List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOperator);
|
||||
List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOperator)throws Exception;
|
||||
public IASTMethod createMethod(
|
||||
IASTScope scope,
|
||||
String name,
|
||||
|
@ -170,28 +170,28 @@ public interface IASTFactory
|
|||
boolean isVolatile,
|
||||
boolean isVirtual,
|
||||
boolean isExplicit,
|
||||
boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChain, boolean isDefinition) throws ASTSemanticException;
|
||||
boolean isPureVirtual, ASTAccessVisibility visibility, List constructorChain, boolean isDefinition) throws ASTSemanticException, Exception;
|
||||
|
||||
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, int nameEndOffset, IASTExpression constructorExpression ) throws ASTSemanticException;
|
||||
IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, int nameEndOffset, IASTExpression constructorExpression ) throws ASTSemanticException, Exception;
|
||||
|
||||
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, int nameEndOffset, IASTExpression constructorExpression, ASTAccessVisibility visibility) throws ASTSemanticException;
|
||||
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, int nameEndOffset, IASTExpression constructorExpression, ASTAccessVisibility visibility) throws ASTSemanticException, Exception;
|
||||
|
||||
public IASTParameterDeclaration createParameterDeclaration( boolean isConst, boolean isVolatile, IASTTypeSpecifier getTypeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int nameOffset, int nameEndOffset, int endingOffset );
|
||||
public IASTParameterDeclaration createParameterDeclaration( boolean isConst, boolean isVolatile, IASTTypeSpecifier getTypeSpecifier, List pointerOperators, List arrayModifiers, List parameters, ASTPointerOperator pointerOp, String parameterName, IASTInitializerClause initializerClause, int startingOffset, int nameOffset, int nameEndOffset, int endingOffset ) throws Exception;
|
||||
|
||||
public IASTTemplateDeclaration createTemplateDeclaration( IASTScope scope, List templateParameters, boolean exported, int startingOffset );
|
||||
public IASTTemplateDeclaration createTemplateDeclaration( IASTScope scope, List templateParameters, boolean exported, int startingOffset ) throws Exception;
|
||||
|
||||
public IASTTemplateParameter createTemplateParameter( IASTTemplateParameter.ParamKind kind, String identifier, String defaultValue, IASTParameterDeclaration parameter, List parms );
|
||||
public IASTTemplateParameter createTemplateParameter( IASTTemplateParameter.ParamKind kind, String identifier, String defaultValue, IASTParameterDeclaration parameter, List parms ) throws Exception;
|
||||
|
||||
public IASTTemplateInstantiation createTemplateInstantiation(IASTScope scope, int startingOffset);
|
||||
public IASTTemplateInstantiation createTemplateInstantiation(IASTScope scope, int startingOffset)throws Exception;
|
||||
|
||||
public IASTTemplateSpecialization createTemplateSpecialization(IASTScope scope, int startingOffset);
|
||||
public IASTTemplateSpecialization createTemplateSpecialization(IASTScope scope, int startingOffset)throws Exception;
|
||||
|
||||
public IASTTypedefDeclaration createTypedef( IASTScope scope, String name, IASTAbstractDeclaration mapping, int startingOffset, int nameOffset, int nameEndOffset ) throws ASTSemanticException;
|
||||
public IASTTypedefDeclaration createTypedef( IASTScope scope, String name, IASTAbstractDeclaration mapping, int startingOffset, int nameOffset, int nameEndOffset ) throws ASTSemanticException, Exception;
|
||||
|
||||
public IASTAbstractTypeSpecifierDeclaration createTypeSpecDeclaration( IASTScope scope, IASTTypeSpecifier typeSpecifier, IASTTemplate template, int startingOffset, int endingOffset);
|
||||
public IASTAbstractTypeSpecifierDeclaration createTypeSpecDeclaration( IASTScope scope, IASTTypeSpecifier typeSpecifier, IASTTemplate template, int startingOffset, int endingOffset)throws Exception;
|
||||
|
||||
public boolean queryIsTypeName( IASTScope scope, ITokenDuple nameInQuestion );
|
||||
public boolean queryIsTypeName( IASTScope scope, ITokenDuple nameInQuestion ) throws Exception;
|
||||
|
||||
static final String DOUBLE_COLON = "::";
|
||||
static final String TELTA = "~";
|
||||
|
@ -199,14 +199,14 @@ public interface IASTFactory
|
|||
* @param scope
|
||||
* @return
|
||||
*/
|
||||
public IASTCodeScope createNewCodeBlock(IASTScope scope);
|
||||
public IASTCodeScope createNewCodeBlock(IASTScope scope)throws Exception;
|
||||
|
||||
public IASTTypeId createTypeId( IASTScope scope, IASTSimpleTypeSpecifier.Type kind, boolean isConst, boolean isVolatile, boolean isShort,
|
||||
boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, ITokenDuple name, List pointerOps, List arrayMods ) throws ASTSemanticException;
|
||||
boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename, ITokenDuple name, List pointerOps, List arrayMods ) throws ASTSemanticException, Exception;
|
||||
/**
|
||||
* @param astClassSpecifier
|
||||
*/
|
||||
public void signalEndOfClassSpecifier(IASTClassSpecifier astClassSpecifier);
|
||||
public void signalEndOfClassSpecifier(IASTClassSpecifier astClassSpecifier) throws Exception;
|
||||
|
||||
|
||||
}
|
|
@ -373,17 +373,49 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
}
|
||||
|
||||
List convertedParms = createParameterList( declarator.getParameters() );
|
||||
IASTAbstractDeclaration abs = astFactory.createAbstractDeclaration(
|
||||
constt, volatil, getTypeSpecifier(), declarator.getPointerOperators(), declarator.getArrayModifiers(),
|
||||
convertedParms, (ASTPointerOperator)i.next() );
|
||||
IASTAbstractDeclaration abs = null;
|
||||
try
|
||||
{
|
||||
abs =
|
||||
astFactory.createAbstractDeclaration(
|
||||
constt,
|
||||
volatil,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPointerOperators(),
|
||||
declarator.getArrayModifiers(),
|
||||
convertedParms,
|
||||
(ASTPointerOperator)i.next());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ASTSemanticException();
|
||||
}
|
||||
String name = ( d.getPointerOperatorNameDuple() != null ) ? d.getPointerOperatorNameDuple().toString() + d.getName() : d.getName();
|
||||
if( typedef )
|
||||
return astFactory.createTypedef(
|
||||
scope,
|
||||
name,
|
||||
abs, getStartingOffset(), d.getNameStartOffset(), d.getNameEndOffset() );
|
||||
try
|
||||
{
|
||||
return astFactory.createTypedef(
|
||||
scope,
|
||||
name,
|
||||
abs, getStartingOffset(), d.getNameStartOffset(), d.getNameEndOffset() );
|
||||
}
|
||||
catch (ASTSemanticException e1)
|
||||
{
|
||||
throw e1;
|
||||
}
|
||||
catch (Exception e1)
|
||||
{
|
||||
throw new ASTSemanticException();
|
||||
}
|
||||
else
|
||||
return astFactory.createVariable( scope, name, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), d.getNameStartOffset(), d.getNameEndOffset(), d.getConstructorExpression() );
|
||||
try
|
||||
{
|
||||
return astFactory.createVariable( scope, name, auto, d.getInitializerClause(), d.getBitFieldExpression(), abs, mutable, extern, register, staticc, getStartingOffset(), d.getNameStartOffset(), d.getNameEndOffset(), d.getConstructorExpression() );
|
||||
}
|
||||
catch (Exception e2)
|
||||
{
|
||||
throw new ASTSemanticException();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -399,14 +431,25 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
*/
|
||||
private IASTTypedefDeclaration createTypedef(Declarator declarator, boolean nested ) throws ASTSemanticException
|
||||
{
|
||||
return astFactory.createTypedef(
|
||||
scope,
|
||||
nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
|
||||
astFactory.createAbstractDeclaration(
|
||||
constt,
|
||||
volatil,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null), startingOffset, declarator.getNameStartOffset(), declarator.getNameEndOffset());
|
||||
try
|
||||
{
|
||||
return astFactory.createTypedef(
|
||||
scope,
|
||||
nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
|
||||
astFactory.createAbstractDeclaration(
|
||||
constt,
|
||||
volatil,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null), startingOffset, declarator.getNameStartOffset(), declarator.getNameEndOffset());
|
||||
}
|
||||
catch (ASTSemanticException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ASTSemanticException();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param declarator
|
||||
|
@ -414,14 +457,57 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
*/
|
||||
private IASTMethod createMethodASTNode(Declarator declarator, boolean nested) throws ASTSemanticException
|
||||
{
|
||||
return astFactory
|
||||
.createMethod(
|
||||
try
|
||||
{
|
||||
return astFactory
|
||||
.createMethod(
|
||||
scope,
|
||||
nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
|
||||
createParameterList(declarator.getParameters()),
|
||||
astFactory.createAbstractDeclaration(
|
||||
constt,
|
||||
volatil,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
|
||||
declarator.getExceptionSpecification(),
|
||||
inline,
|
||||
friend,
|
||||
staticc,
|
||||
startingOffset,
|
||||
declarator.getNameStartOffset(),
|
||||
declarator.getNameEndOffset(),
|
||||
templateDeclaration,
|
||||
declarator.isConst(),
|
||||
declarator.isVolatile(),
|
||||
virtual,
|
||||
explicit,
|
||||
declarator.isPureVirtual(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode(),
|
||||
declarator.getConstructorMemberInitializers(), declarator.hasFunctionBody());
|
||||
}
|
||||
catch (ASTSemanticException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ASTSemanticException();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param declarator
|
||||
* @return
|
||||
*/
|
||||
private IASTFunction createFunctionASTNode(Declarator declarator, boolean nested) throws ASTSemanticException
|
||||
{
|
||||
try
|
||||
{
|
||||
return astFactory.createFunction(
|
||||
scope,
|
||||
nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
|
||||
createParameterList(declarator.getParameters()),
|
||||
nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
|
||||
createParameterList(declarator.getParameters()),
|
||||
astFactory.createAbstractDeclaration(
|
||||
constt,
|
||||
volatil,
|
||||
volatil,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
|
||||
declarator.getExceptionSpecification(),
|
||||
|
@ -431,43 +517,22 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
startingOffset,
|
||||
declarator.getNameStartOffset(),
|
||||
declarator.getNameEndOffset(),
|
||||
templateDeclaration,
|
||||
declarator.isConst(),
|
||||
declarator.isVolatile(),
|
||||
virtual,
|
||||
explicit,
|
||||
declarator.isPureVirtual(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode(),
|
||||
declarator.getConstructorMemberInitializers(), declarator.hasFunctionBody());
|
||||
}
|
||||
/**
|
||||
* @param declarator
|
||||
* @return
|
||||
*/
|
||||
private IASTFunction createFunctionASTNode(Declarator declarator, boolean nested) throws ASTSemanticException
|
||||
{
|
||||
return astFactory.createFunction(
|
||||
scope,
|
||||
nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
|
||||
createParameterList(declarator.getParameters()),
|
||||
astFactory.createAbstractDeclaration(
|
||||
constt,
|
||||
volatil,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
|
||||
declarator.getExceptionSpecification(),
|
||||
inline,
|
||||
friend,
|
||||
staticc,
|
||||
startingOffset,
|
||||
declarator.getNameStartOffset(),
|
||||
declarator.getNameEndOffset(),
|
||||
templateDeclaration,
|
||||
declarator.isConst(),
|
||||
declarator.isVolatile(),
|
||||
virtual,
|
||||
explicit,
|
||||
declarator.isPureVirtual(),
|
||||
declarator.getConstructorMemberInitializers(), declarator.hasFunctionBody() );
|
||||
templateDeclaration,
|
||||
declarator.isConst(),
|
||||
declarator.isVolatile(),
|
||||
virtual,
|
||||
explicit,
|
||||
declarator.isPureVirtual(),
|
||||
declarator.getConstructorMemberInitializers(), declarator.hasFunctionBody() );
|
||||
}
|
||||
catch (ASTSemanticException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ASTSemanticException();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param declarator
|
||||
|
@ -475,26 +540,37 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
*/
|
||||
private IASTField createFieldASTNode(Declarator declarator, boolean nested) throws ASTSemanticException
|
||||
{
|
||||
return astFactory.createField(
|
||||
scope,
|
||||
nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
|
||||
auto,
|
||||
declarator.getInitializerClause(),
|
||||
declarator.getBitFieldExpression(),
|
||||
astFactory.createAbstractDeclaration(
|
||||
constt,
|
||||
volatil,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
|
||||
mutable,
|
||||
extern,
|
||||
register,
|
||||
staticc,
|
||||
startingOffset,
|
||||
declarator.getNameStartOffset(),
|
||||
declarator.getNameEndOffset(), declarator.getConstructorExpression(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode());
|
||||
try
|
||||
{
|
||||
return astFactory.createField(
|
||||
scope,
|
||||
nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
|
||||
auto,
|
||||
declarator.getInitializerClause(),
|
||||
declarator.getBitFieldExpression(),
|
||||
astFactory.createAbstractDeclaration(
|
||||
constt,
|
||||
volatil,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
|
||||
mutable,
|
||||
extern,
|
||||
register,
|
||||
staticc,
|
||||
startingOffset,
|
||||
declarator.getNameStartOffset(),
|
||||
declarator.getNameEndOffset(), declarator.getConstructorExpression(), ((IASTClassSpecifier)scope).getCurrentVisibilityMode());
|
||||
}
|
||||
catch (ASTSemanticException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ASTSemanticException();
|
||||
}
|
||||
}
|
||||
private List createParameterList(List currentParameters)
|
||||
private List createParameterList(List currentParameters) throws ASTSemanticException
|
||||
{
|
||||
List result = new ArrayList();
|
||||
Iterator i = currentParameters.iterator();
|
||||
|
@ -505,16 +581,23 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
while (j.hasNext())
|
||||
{
|
||||
Declarator declarator = (Declarator)j.next();
|
||||
result.add(
|
||||
astFactory.createParameterDeclaration(
|
||||
wrapper.isConst(),
|
||||
wrapper.isVolatile(),
|
||||
wrapper.getTypeSpecifier(),
|
||||
declarator.getPointerOperators(),
|
||||
declarator.getArrayModifiers(),
|
||||
null, null, declarator.getName() == null
|
||||
? ""
|
||||
: declarator.getName(), declarator.getInitializerClause(), wrapper.getStartingOffset(), declarator.getNameStartOffset(), declarator.getNameEndOffset(), wrapper.getEndOffset()));
|
||||
try
|
||||
{
|
||||
result.add(
|
||||
astFactory.createParameterDeclaration(
|
||||
wrapper.isConst(),
|
||||
wrapper.isVolatile(),
|
||||
wrapper.getTypeSpecifier(),
|
||||
declarator.getPointerOperators(),
|
||||
declarator.getArrayModifiers(),
|
||||
null, null, declarator.getName() == null
|
||||
? ""
|
||||
: declarator.getName(), declarator.getInitializerClause(), wrapper.getStartingOffset(), declarator.getNameStartOffset(), declarator.getNameEndOffset(), wrapper.getEndOffset()));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ASTSemanticException();
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
@ -525,23 +608,34 @@ public class DeclarationWrapper implements IDeclaratorOwner
|
|||
*/
|
||||
private IASTVariable createVariableASTNode(Declarator declarator, boolean nested ) throws ASTSemanticException
|
||||
{
|
||||
return astFactory.createVariable(
|
||||
scope,
|
||||
nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
|
||||
isAuto(),
|
||||
declarator.getInitializerClause(),
|
||||
declarator.getBitFieldExpression(),
|
||||
astFactory.createAbstractDeclaration(
|
||||
constt,
|
||||
volatil,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
|
||||
mutable,
|
||||
extern,
|
||||
register,
|
||||
staticc,
|
||||
getStartingOffset(),
|
||||
declarator.getNameStartOffset(), declarator.getNameEndOffset(), declarator.getConstructorExpression());
|
||||
try
|
||||
{
|
||||
return astFactory.createVariable(
|
||||
scope,
|
||||
nested ? declarator.getOwnedDeclarator().getName() : declarator.getName(),
|
||||
isAuto(),
|
||||
declarator.getInitializerClause(),
|
||||
declarator.getBitFieldExpression(),
|
||||
astFactory.createAbstractDeclaration(
|
||||
constt,
|
||||
volatil,
|
||||
getTypeSpecifier(),
|
||||
declarator.getPointerOperators(), declarator.getArrayModifiers(), null, null),
|
||||
mutable,
|
||||
extern,
|
||||
register,
|
||||
staticc,
|
||||
getStartingOffset(),
|
||||
declarator.getNameStartOffset(), declarator.getNameEndOffset(), declarator.getConstructorExpression());
|
||||
}
|
||||
catch (ASTSemanticException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ASTSemanticException();
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -344,7 +344,23 @@ public class Scanner implements IScanner {
|
|||
}
|
||||
}
|
||||
if (inclusionReader != null) {
|
||||
IASTInclusion inclusion = astFactory.createInclusion( fileName, newPath, !useIncludePaths, beginOffset, nameOffset, nameOffset + fileName.length(), endOffset );
|
||||
IASTInclusion inclusion = null;
|
||||
try
|
||||
{
|
||||
inclusion =
|
||||
astFactory.createInclusion(
|
||||
fileName,
|
||||
newPath,
|
||||
!useIncludePaths,
|
||||
beginOffset,
|
||||
nameOffset,
|
||||
nameOffset + fileName.length(),
|
||||
endOffset);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
contextStack.updateContext(inclusionReader, newPath, ScannerContext.INCLUSION, inclusion, requestor );
|
||||
}
|
||||
}
|
||||
|
@ -2010,10 +2026,28 @@ public class Scanner implements IScanner {
|
|||
{
|
||||
if( requestor != null )
|
||||
{
|
||||
IASTInclusion i = astFactory.createInclusion( f, "", !useIncludePath, beginningOffset,
|
||||
startOffset, startOffset + f.length(), endOffset );
|
||||
i.enterScope( requestor );
|
||||
i.exitScope( requestor );
|
||||
IASTInclusion i = null;
|
||||
try
|
||||
{
|
||||
i =
|
||||
astFactory.createInclusion(
|
||||
f,
|
||||
"",
|
||||
!useIncludePath,
|
||||
beginningOffset,
|
||||
startOffset,
|
||||
startOffset + f.length(),
|
||||
endOffset);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
if( i != null )
|
||||
{
|
||||
i.enterScope( requestor );
|
||||
i.exitScope( requestor );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2168,7 +2202,14 @@ public class Scanner implements IScanner {
|
|||
throw new ScannerException( ScannerException.ErrorCode.INVALID_PREPROCESSOR_DIRECTIVE, getCurrentFile(), getCurrentOffset() );
|
||||
}
|
||||
|
||||
astFactory.createMacro( key, beginning, offset, offset + key.length(), contextStack.getCurrentContext().getOffset() ).acceptElement( requestor );
|
||||
try
|
||||
{
|
||||
astFactory.createMacro( key, beginning, offset, offset + key.length(), contextStack.getCurrentContext().getOffset() ).acceptElement( requestor );
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
}
|
||||
|
||||
protected Vector getMacroParameters (String params, boolean forStringizing) throws ScannerException {
|
||||
|
|
|
@ -154,7 +154,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
result = startingScope.qualifiedLookup(name, type);
|
||||
}
|
||||
} catch (ParserSymbolTableException e) {
|
||||
throw e;
|
||||
if( e.reason != ParserSymbolTableException.r_UnableToResolveFunction )
|
||||
throw e;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -215,14 +216,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
try
|
||||
{
|
||||
result = lookupElement(startingScope, firstSymbol.getImage(), type, parameters);
|
||||
/* if(type == TypeInfo.t_function)
|
||||
if (validParameterList(parameters))
|
||||
result = startingScope.unqualifiedFunctionLookup( firstSymbol.getImage(), new LinkedList(parameters));
|
||||
else
|
||||
result = null;
|
||||
else
|
||||
result = startingScope.lookup( firstSymbol.getImage());
|
||||
*/ if( result != null )
|
||||
if( result != null )
|
||||
addReference( references, createReference( result, firstSymbol.getImage(), firstSymbol.getOffset() ));
|
||||
else
|
||||
throw new ASTSemanticException();
|
||||
|
@ -248,14 +242,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
{
|
||||
if( t == name.getLastToken() )
|
||||
result = lookupElement((IContainerSymbol)result, t.getImage(), type, parameters);
|
||||
/* if((type == TypeInfo.t_function) || (type == TypeInfo.t_constructor))
|
||||
if (validParameterList(parameters))
|
||||
result = ((IContainerSymbol)result).qualifiedFunctionLookup( t.getImage(), new LinkedList(parameters) );
|
||||
else
|
||||
result = null;
|
||||
else
|
||||
result = ((IContainerSymbol)result).qualifiedLookup( t.getImage() );
|
||||
*/ else
|
||||
else
|
||||
result = ((IContainerSymbol)result).lookupNestedNameSpecifier( t.getImage() );
|
||||
addReference( references, createReference( result, t.getImage(), t.getOffset() ));
|
||||
}
|
||||
|
@ -857,7 +844,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
* Apply the usual arithmetic conversions to find out the result of an expression
|
||||
* that has a lhs and a rhs as indicated in the specs (section 5.Expressions, page 64)
|
||||
*/
|
||||
protected TypeInfo usualArithmeticConversions(TypeInfo lhs, TypeInfo rhs){
|
||||
protected TypeInfo usualArithmeticConversions(TypeInfo lhs, TypeInfo rhs) throws ASTSemanticException{
|
||||
|
||||
// if you have a variable of type basic type, then we need to go to the basic type first
|
||||
while( (lhs.getType() == TypeInfo.t_type) && (lhs.getTypeSymbol() != null)){
|
||||
|
@ -866,6 +853,12 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
while( (rhs.getType() == TypeInfo.t_type) && (rhs.getTypeSymbol() != null)){
|
||||
rhs = rhs.getTypeSymbol().getTypeInfo();
|
||||
}
|
||||
|
||||
if( lhs.isType(TypeInfo.t_class, TypeInfo.t_enumeration ) ||
|
||||
rhs.isType(TypeInfo.t_class, TypeInfo.t_enumeration ) )
|
||||
{
|
||||
throw new ASTSemanticException();
|
||||
}
|
||||
|
||||
TypeInfo info = new TypeInfo();
|
||||
if(
|
||||
|
@ -929,6 +922,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
}
|
||||
}
|
||||
protected List getExpressionResultType(IASTExpression expression, ISymbol symbol)throws ASTSemanticException{
|
||||
|
||||
|
||||
List result = new ArrayList();
|
||||
TypeInfo info = new TypeInfo();
|
||||
try {
|
||||
|
@ -1163,8 +1158,10 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
|
|||
if((left != null ) && (right != null)){
|
||||
TypeInfo leftType =(TypeInfo)left.getResultType().iterator().next();
|
||||
TypeInfo rightType =(TypeInfo)right.getResultType().iterator().next();
|
||||
info = usualArithmeticConversions(leftType, rightType);
|
||||
info = usualArithmeticConversions(leftType, rightType);
|
||||
}
|
||||
else
|
||||
throw new ASTSemanticException();
|
||||
result.add(info);
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue