|
From: Baptiste L. <gai...@fr...> - 2004-08-13 07:03:04
|
You're correct, there's something broken (but then, I've been growing thi=
s
on a test basis).
I think something along the line of:
> Parser::SymbolDeclarationPtr declaration =3D table.findDeclaration=
At(
> location );
Parser::DeclarationPtrEnum enumDeclarations =3D
table.enumSiblingDeclaration( declaration ); // the enum includes
'declaration'. Give all declarations that resolve into the same qualified
identifier based on global scope.
(e.g. you're second option).
Baptiste.
----- Original Message -----=20
From: "Andre Baresel" <and...@gm...>
To: "CppTool Mailing List" <Cpp...@li...>
Sent: Thursday, August 12, 2004 11:14 AM
Subject: [Cpptool-develop] debugging example/cppparser/tests
> hello Baptiste,
>
> I'm not sure about the status of the two source trees at the moment.
> However I could not get the "src/*" tree compiled because of missing
files.
> For that reason I continued to look through "example/cppparser/tests".
> Aspecially the refactoring tests were intressting for me
> "refactoring/test1.cpp - test6.cpp
>
> I found out that the symboltable generates two entries for the
> declarations "class C1;" and "class C1 { .... }".
>
> SymbolDeclarator::declareClass inserts:
> SymbolDeclarationPtr declaration =3D symbolTable_.declare( classSymb=
ol );
>
> SymbolDeclarator::declareForwardClass does the same:
> SymbolDeclarationPtr declaration =3D symbolTable_.declare( classSymb=
ol );
>
> Last but not least the member "symboltable.declare" does:
> SymbolTable::declare( const Symbol &symbol )
> {
> SymbolDeclarationPtr declaration( new SymbolDeclaration( symbol ) );
> references_[ declaration ].push_back( symbol.location() );
> return declaration;
> }
>
> =3D=3D=3D=3D=3D=3D
> this leads to a hashmap "references_" which has two entries.
>
> During refactoring tests the test code asks for the declaration at
> position 'x':
> Parser::SymbolDeclarationPtr declaration =3D table.findDeclaration=
At(
> location );
>
> This will only return a single declaration and it's references. However=
,
> all other forward declarations are missed.
>
> Possible solutions are:
> - model the declaration type differently, such that multiple locations
> of declarations are possible
> (sounds a little bit ugly)
> - make references between all forward-declarations and declarations,
> these need to be two way
> links, because the user could select the forward-declaration for
> rename-operation...
>
> any idea ?
> greetings from Berlin,
> Andr=E9
|