<div dir="ltr">Hi Peter, here's what I think after having a quick look at the code.<div><br></div><div>a) I don't think that there's a way to print enum constants in a syntactically correct way. But I don't think anyone would object if you extended PrintingPolicy to handle this. The comment for getQualifiedNameAsString indicates that this method will be removed and you should probably not use it, printQualifiedName will do what you want especially if you decide to take the PrintingPolicy approach.</div>
<div><br></div><div>b) The linkage specifier seems to override the namespace, and this makes sense to me. I mean namespace implies name mangling and C linkage doesn't and you can't have both?</div><div><br></div>
<div>
Nikola</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Aug 3, 2014 at 8:13 AM, Peter Stirling <span dir="ltr"><<a href="mailto:peter@pjstirling.plus.com" target="_blank">peter@pjstirling.plus.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
I've got plans to write a clang tool to automatically generate universal foreign function interface definitions, to allow usage of c++ libraries from non-c++ languages. As part of that I need to pull out correct function and type names from the AST to go into a new .cc file.<br>
<br>
clang::NamedDecl::<u></u>getQualifiedNameAsString() sounds like it should be what I want, but I'm having a couple of problems with it so far:<br>
<br>
a) for EnumConstantDecl it returns a name including the name of the EnumDecl (which is arguably correct, but is invalid in c++ code). I think it would be better if there was a second method that produced the syntactically correct version.<br>
b) the attached file is a cut-down example from the system headers on my machine (gcc-4.8.3 if it matters). When you call getQualifiedNameAsString() on the __uselocale function declaration (I was surprised to learn that it WAS a function declaration), clang returns "__uselocale" and not "__gnu_cxx::__uselocale". Is this a bug, or some misunderstanding on my part?<br>
<br>
I've been using the RecursiveASTVisitor to do the tree walking, and can I ask whether there is some convenient way to prune a node's children, without aborting the whole traversal? For example: I want to visit CXXRecordDecl, but not the ones inside function bodies. At the moment I am walking up the parent DeclContext chain, which (to me) seems less than ideal.<br>
<br>
<br>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>