<div dir="ltr">I haven't looked too deeply into it, but from talking to various clang developers, the common theme is disbelieve that a high-level C++ AST can be created that is both useful and not overly specific to a single compiler.<div><br></div><div>From the paper referenced in the project, I see multiple things that make it seem not interesting to me from a point of refactoring and semantic analysis:</div><div>- The IPR does not handle macros before their expansion in the preprocessor.<br></div><div>- does not mimic C++ language irregularities; general rules are used, rather than long lists of special cases</div><div>- Unfortunately, a program cannot fully automate the generation of “skeletons.” If our aim is portability, we still need to (by hand) eliminate non-standard additions to the contents of header file.</div><div><br></div><div>Generally, I would not trust a representation that I can't generate code from to be correct enough for tools.</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Feb 1, 2017 at 8:32 PM Reid Kleckner via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">Yes, the clang "abstract syntax tree" is often jokingly referred to as the "concrete syntax graph". We try to provide a generally useful representation, but being a fast production C++ compiler comes first. Clang's AST is very concrete. You have to know a lot about it to navigate it. There is no "Node" base class that you can use as a cursor to navigate around Decls, Exprs, Types, and TemplateArguments. Template instantiation, the closest thing I can think of to cloning, is done relatively manually with TreeTransform.<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I think it would be nice to revisit the design of clang's AST to simplify it, normalize it, and abstract it, but it is not a task to be taken lightly, and I don't expect it to happen in the near future.</div></div><div class="gmail_extra gmail_msg"><br class="gmail_msg"><div class="gmail_quote gmail_msg">On Wed, Feb 1, 2017 at 8:44 AM, Gaetano Checinski via cfe-dev <span dir="ltr" class="gmail_msg"><<a href="mailto:cfe-dev@lists.llvm.org" class="gmail_msg" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br class="gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">As the AST is not really a Tree as it seems to have circular references, working with the AST is sometimes a bit messy (eg. cloning).<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">A while ago Stroustroup pointed me to Gabriel Dos Reis' work on a different approach to represent C++-AST: <a href="https://mailtrack.io/trace/link/a5c184fad2cf94fbf0449fa233263072ebc34ea8?url=https%3A%2F%2Fgithub.com%2FGabrielDosReis%2Fipr&signature=9a19f2a0a41d5ceb" class="gmail_msg" target="_blank">https://github.com/GabrielDosReis/ipr</a></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Did anyone try to integrate his work into clang or has an opinion to share ?<br class="gmail_msg"></div><img width="0" height="0" class="m_-1034651269622219800m_-8147391716180187190mailtrack-img gmail_msg" src="https://mailtrack.io/trace/mail/96ca32a20993f41b338d6ad7c9912d81a9b4e624.png?u=931501"></div>
<br class="gmail_msg">_______________________________________________<br class="gmail_msg">
cfe-dev mailing list<br class="gmail_msg">
<a href="mailto:cfe-dev@lists.llvm.org" class="gmail_msg" target="_blank">cfe-dev@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br class="gmail_msg">
<br class="gmail_msg"></blockquote></div><br class="gmail_msg"></div>
_______________________________________________<br class="gmail_msg">
cfe-dev mailing list<br class="gmail_msg">
<a href="mailto:cfe-dev@lists.llvm.org" class="gmail_msg" target="_blank">cfe-dev@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br class="gmail_msg">
</blockquote></div>