r175585 - [preprocessor] Split the MacroInfo class into two separate concepts, MacroInfo class

Dmitri Gribenko gribozavr at gmail.com
Thu Feb 21 07:04:21 PST 2013


On Wed, Feb 20, 2013 at 2:54 AM, Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:
> Author: akirtzidis
> Date: Tue Feb 19 18:54:57 2013
> New Revision: 175585
>
> URL: http://llvm.org/viewvc/llvm-project?rev=175585&view=rev
> Log:
> [preprocessor] Split the MacroInfo class into two separate concepts, MacroInfo class
> for the data specific to a macro definition (e.g. what the tokens are), and
> MacroDirective class which encapsulates the changes to the "macro namespace"
> (e.g. the location where the macro name became active, the location where it was undefined, etc.)
>
> (A MacroDirective always points to a MacroInfo object.)
>
> Usually a macro definition (MacroInfo) is where a macro name becomes active (MacroDirective) but
> splitting the concepts allows us to better model the effect of modules to the macro namespace
> (also as a bonus it allows better modeling of push_macro/pop_macro #pragmas).
> Modules can have their own macro history, separate from the local (current translation unit)
> macro history; MacroDirectives will be used to model the macro history (changes to macro namespace).
>
> For example, if "@import A;" imports macro FOO, there will be a new local MacroDirective created
> to indicate that "FOO" became active at the import location. Module "A" itself will contain another
> MacroDirective in its macro history (at the point of the definition of FOO) and both MacroDirectives
> will point to the same MacroInfo object.
>
> Introducing the separation of macro concepts is the first part towards better modeling of module macros.

Argyrios,

This is a good explanation, could you copy the relevant parts of it
into documentation comments for MacroInfo and MacroDirective?

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-commits mailing list