<div dir="ltr">(this conversation is more applicable to cfe-dev (cc'd) rather than llvm-dev (please drop llvm-dev from further replies)<br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 14, 2015 at 12:34 PM, Marcus Rodrigues via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Dear LLVMers,<br><br>I'm developing a tool to extract constraints from C programs. To do it, I<br>need, firstly, to be able to go over the Abstract Syntax Tree of a program.<br>Thus, I'm trying to use clang to get the AST of a program and start my <br>work from it. The problem that I'm having is that I don't know how I can <br>get the AST of a program without any intervention of the semantic analyzer. <br>I would like to analyze programs that have uses of undeclared variables. <br>However, once clang finds an undeclared variable, it stops building the tree, <br>and just shows me the errors. If I need to modify clang, to continue producing <br>the tree, e.g., assuming that every undeclared variable is extern, how can I do it?<br><br>Or,  in other words, is there a way to disable the semantic analysis<br>and get the AST of a program without any interference of the this analyzer?<br></div></div></div></div></blockquote><div><br></div><div>Short answer: no. I suppose it might be supportable in C (we shuold produce an AST, but we will produce errors (you can suppress them), with invalid nodes for the variable references), it's certainly not supportable in C++ owing to the non-context-free nature of the C++ programming language.<br><br>- Dave</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><br></div>Since now, thank you very much!<br><br></div>Regards,<br></div> Marcus<br></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div></div>