[cfe-dev] LLVM- AST contents display and dependency analysis

Sean Silva chisophugis at gmail.com
Mon May 18 13:48:03 PDT 2015


On Thu, May 14, 2015 at 2:59 AM, Renato Golin <renato.golin at linaro.org>
wrote:

> On 13 May 2015 at 22:49, Sean Silva <chisophugis at gmail.com> wrote:
> > There isn't really a notion of "pass" on the clang AST; the result of
> > parsing is considered immutable.
>
> Right. What about the pre-processor?
>
> I'm not an expert on OpenMP, but would OpenMP force illegal behaviour
> with that pragma, or just bail if it could not prove legality?
>
> If the latter, than just adding "#pragma omp parallel loop" to all
> loops would work as he wants, no?
>

I'm not sure what you mean. To put it another way, the only officially
supported way to programmatically add "#pragma omp parallel loop" to a loop
body is to textually rewrite the source code and re-parse.

Of course, all of clang's source code is there for you to look at, so for
any given construct you can theoretically just imitate what is happening
inside clang, but it is extremely error-prone because you need to ensure
that all of the AST's invariants are maintained, with anything ranging from
a crash to silent miscompilation if you don't. These invariants are not
documented and probably not all consciously known.

-- Sean Silva


>
> cheers,
> --renato
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150518/f9e15324/attachment.html>


More information about the cfe-dev mailing list