Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Expanding getImageLocation() method to work for non IASTName nodes

Thanks for the expert advice.

Cheers,
-sergey


On Mon, Jan 7, 2013 at 1:33 AM, Schorn, Markus <Markus.Schorn@xxxxxxxxxxxxx> wrote:

Hi Sergey,

I don’t think there is a downside to extending the concept of image-locations to IASTNodes, other than that the generated AST needs more memory.  

The AST for the indexer is created without image-locations (ILanguage.OPTION_NO_IMAGE_LOCATIONS), so the indexer will not be affected.

Markus.

 

From: sprigogin@xxxxxxxxxx [mailto:sprigogin@xxxxxxxxxx] On Behalf Of Sergey Prigogin
Sent: Wed, 02. 01. 2013 02:05
To: CDT General developers list.; Schorn, Markus
Subject: Expanding getImageLocation() method to work for non IASTName nodes

 

Markus and all,

I'm trying to improve formatting of macro arguments in situations when the arguments are long and don't fit into a single line.  Unfortunately, currently it seems to be impossible to obtain source offsets of the AST nodes, except for IASTNames, generated from macro arguments. This makes formatting of macro arguments pretty challenging since the formatting algorithms rely on knowledge of AST and mapping of its nodes to the source file locations.

 

It looks like creating image location for all tokens in MacroExpander.postProcessTokens(TokenList) makes getImageLocation() method work for all nodes in macro parameter expansions. Do you have objections to creating extra image locations or envision problems with this approach?

 

If necessary, creation of the extra image locations can be disabled during indexing.

 

-sergey



Back to the top