[cfe-commits] Patches for clang -ast-print

Jordan Rose jordan_rose at apple.com
Wed Oct 31 09:27:17 PDT 2012


On Oct 29, 2012, at 17:39 , Eli Friedman <eli.friedman at gmail.com> wrote:

> On Mon, Oct 29, 2012 at 5:29 PM, Jordan Rose <jordan_rose at apple.com> wrote:
>> 
>> On Oct 29, 2012, at 17:23 , Eli Friedman <eli.friedman at gmail.com> wrote:
>> 
>> Since the CFG is a linearized structure now, it's not printing CFG structure. Instead, it's trying to show the statement associated with a single CFGElement, such as a cast, in a way that you could match it up with the source but still see the evaluation pattern.
> 
> So we're printing what basically amounts to a derived analysis for all
> users?  I guess that makes sense, to some extent... but is there no
> way to formally query the CFGElements a given CFGElement depends on?

In addition to Ted's response, I want to point out that the current dump may use placeholders for things the current element does not depend on for evaluation, e.g. a MemberExpr for a static member. Likewise, it may miss things that are dependencies: the semantic form of a PseudoObjectExpr. It's not a perfect format by any means...


>> It is deliberately trying to print the syntactic ("pretty") form of the statement, but with placeholders for subexpressions that appear earlier in the CFG. Maybe these two goals are incompatible, but I can say that what we have has really helped us on the analyzer side.
> 
> The issue comes down to the fact that you're trying to "pretty-print"
> things which aren't actually written in the source.  Maybe we need a
> PrintingPolicy bit for not-so-pretty-printing?

...and that does seem like we're venturing outside the intent of pretty-print, huh. I don't like the new form either, though, because it's even worse about implying that a given CFGElement is not consumed.

If you're okay with adding a PrintImplicitNodes bit to PrintingPolicy that would be good enough for us. Otherwise we'll have to think of something else.

Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121031/3c74f540/attachment.html>


More information about the cfe-commits mailing list