1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00
Andrew Niefer 2004-04-20 21:35:05 +00:00
parent 3ca43539a1
commit 822ad118ce
4 changed files with 28 additions and 4 deletions

View file

@ -1,3 +1,6 @@
2004-04-20 Andrew Niefer
added parser/CompleteParseASTTest.testBug59302()
2004-04-20 Andrew Niefer 2004-04-20 Andrew Niefer
-added parser/CompleteParseASTTemplateTest.test_14_7_3__11_ExplicitSpecializationArgumentDeduction() -added parser/CompleteParseASTTemplateTest.test_14_7_3__11_ExplicitSpecializationArgumentDeduction()
-added parser/CompleteParseASTTemplateTest.test_14_8_1__2_ExplicitArgumentSpecification() -added parser/CompleteParseASTTemplateTest.test_14_8_1__2_ExplicitArgumentSpecification()

View file

@ -1580,4 +1580,22 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
IASTSimpleTypeSpecifier simpleTypeSpec = ((IASTSimpleTypeSpecifier)bar.getReturnType().getTypeSpecifier()); IASTSimpleTypeSpecifier simpleTypeSpec = ((IASTSimpleTypeSpecifier)bar.getReturnType().getTypeSpecifier());
assertEquals( simpleTypeSpec.getType(), IASTGCCSimpleTypeSpecifier.Type.TYPEOF ); assertEquals( simpleTypeSpec.getType(), IASTGCCSimpleTypeSpecifier.Type.TYPEOF );
} }
public void testBug59302() throws Exception
{
Writer writer = new StringWriter();
writer.write("class A { class N{}; }; ");
writer.write("class B { friend class A::N; }; ");
Iterator i = parse( writer.toString() ).getDeclarations();
IASTClassSpecifier A = (IASTClassSpecifier) ((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
IASTClassSpecifier B = (IASTClassSpecifier) ((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
i = getDeclarations( A );
IASTClassSpecifier N = (IASTClassSpecifier) ((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier();
assertFalse( A.getFriends().hasNext() );
assertEquals( B.getFriends().next(), N );
}
} }

View file

@ -1,3 +1,6 @@
2004-04-20 Andrew Niefer
fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=59302 - Nested friend mishandled
2004-04-20 Andrew Niefer 2004-04-20 Andrew Niefer
- implement IContainerSymbol.lookupFunctionTemplateId - implement IContainerSymbol.lookupFunctionTemplateId
- handle explicit template argument specification - handle explicit template argument specification

View file

@ -2863,6 +2863,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
public IASTElaboratedTypeSpecifier createElaboratedTypeSpecifier(IASTScope scope, ASTClassKind kind, ITokenDuple name, int startingOffset, int startingLine, int endOffset, int endingLine, boolean isForewardDecl, boolean isFriend) throws ASTSemanticException public IASTElaboratedTypeSpecifier createElaboratedTypeSpecifier(IASTScope scope, ASTClassKind kind, ITokenDuple name, int startingOffset, int startingLine, int endOffset, int endingLine, boolean isForewardDecl, boolean isFriend) throws ASTSemanticException
{ {
IContainerSymbol currentScopeSymbol = scopeToSymbol(scope); IContainerSymbol currentScopeSymbol = scopeToSymbol(scope);
IContainerSymbol originalScope = currentScopeSymbol;
TypeInfo.eType pstType = classKindToTypeInfo(kind); TypeInfo.eType pstType = classKindToTypeInfo(kind);
List references = new ArrayList(); List references = new ArrayList();
IToken nameToken = name.getFirstToken(); IToken nameToken = name.getFirstToken();
@ -2932,8 +2934,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
checkSymbol.setIsForwardDeclaration(true); checkSymbol.setIsForwardDeclaration(true);
try { try {
if (isFriend) { if (isFriend) {
((IDerivableContainerSymbol) currentScopeSymbol) ((IDerivableContainerSymbol) originalScope).addFriend(checkSymbol);
.addFriend(checkSymbol);
} else { } else {
if (!isTemplateId) if (!isTemplateId)
currentScopeSymbol.addSymbol(checkSymbol); currentScopeSymbol.addSymbol(checkSymbol);
@ -2953,8 +2954,7 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto
references, isForewardDecl); references, isForewardDecl);
attachSymbolExtension(checkSymbol, elab, !isForewardDecl); attachSymbolExtension(checkSymbol, elab, !isForewardDecl);
} else if (isFriend) { } else if (isFriend) {
((IDerivableContainerSymbol) currentScopeSymbol) ((IDerivableContainerSymbol) originalScope).addFriend(checkSymbol);
.addFriend(checkSymbol);
} }
if (checkSymbol != null) { if (checkSymbol != null) {
if (scope instanceof IASTTemplateInstantiation) { if (scope instanceof IASTTemplateInstantiation) {