[cfe-dev] macro-expanded/preprocessed string (clangLex) question
Sean Silva
silvas at purdue.edu
Mon Jun 24 14:41:57 PDT 2013
On Fri, Jun 21, 2013 at 1:28 PM, Thompson, John <
John_Thompson at playstation.sony.com> wrote:
> Argyrios,****
>
> ** **
>
> Yeah, your comment made me think that perhaps I should just track macro
> expansions in general, not limiting it to conditional directives, as macro
> instances anywhere with different values could be problematic as well for
> modules. Is that what you meant as well?****
>
> ** **
>
> What do you think, Sean?****
>
> ** **
>
> The program structure doesn’t change a whole lot. Instead of storing the
> condition location and values, I store the macro information.****
>
> **
>
I think the program structure will have to change a good amount anyway in
order to make it clear what the algorithm is doing. Unless it is unable to
express the check that is desired (but I think it can), I strongly believe
that the pseudocode I suggested is the right approach, which nicely models
the problem as:
1) Defining an equivalence relation on macro expansions or preprocessor
conditions or whatever (call this type T)
2) Maintaining a map keyed on the physical source file location of the T
and having T as values, and using that to ensure that all physical source
locations expand to the same thing across TU's.
This approach should work for either of the scenarios. Moreover, it has
obvious time and space complexity and it's easy to see how to parallelize
it (operate on independent maps in independent threads and at the end
perform a "union" operation on the maps).
-- Sean Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130624/e7cd6508/attachment.html>
More information about the cfe-dev
mailing list