<div dir="ltr">Got it to work! Thanks so much Richard. I finally figured out that there is such a thing as a SemaConsumer that gets the Sema instance injected :).</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 27, 2016 at 3:00 PM, Kris Rasmussen <span dir="ltr"><<a href="mailto:kristopher.rasmussen@gmail.com" target="_blank">kristopher.rasmussen@gmail.com</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">Hey Richard - thanks for the quick reply. I'll give Sema another look. I tried to use it originally but stopped after finding that one is not available on the CompilerInstance passed into ASTFrontendAction::createASTConsumer. I'll do some more digging and how best to get a Sema instance.<div><br></div><div>Thanks,</div><div>Kris</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 27, 2016 at 2:08 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</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 class="gmail_extra"><div class="gmail_quote"><span>On Wed, Apr 27, 2016 at 1:47 PM, Kris Rasmussen via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-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">I learned that the issue here is that ```BarInt``` is an incomplete type because no on has looked at its members. Is there a way to force the instantiation at parse/AST traversal time even if it isn't instantiated by the code being parsed directly?</div></blockquote><div><br></div></span><div>You could change Clang to do that, but it would be likely to reject a lot of valid, real code if you did. If your tool has access to the Sema object, you can use RequireCompleteType to try to complete the definitions of the classes you need.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><div dir="ltr"><div>Thanks,<br>Kris </div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 27, 2016 at 9:29 AM, Kris Rasmussen <span dir="ltr"><<a href="mailto:kristopher.rasmussen@gmail.com" target="_blank">kristopher.rasmussen@gmail.com</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">Hi,<div><br></div><div>Is anyone able to help me figure out how to ensure ClassTemplateSpecializationDecls always have definitions so that I can properly inspect there members with the appropriate type substitutions? I am visiting template instantiations via ```shouldVisitTemplateInstantiations() { return true; }```, but I'm finding that they do not always have a definition attached to them.</div><div><br></div><div>I'm porting a code generation tool from the python clang bindings to C++ using ClangTool and RecursiveASTVisitor. My tool generates lua bindings from C++ source code. It needs to generate bindings for template instantiations, and requires knowledge of the template arguments in order to do so.<br></div><div><br></div><div>This code will result in a ClassTemplateSpecializationDecl that is missing its definition (hasDefinition() == false):</div><div><br></div><div>```</div><div><div>  template<typename T></div><div>  class Bar {</div><div>  public:</div><div>    T m_t;</div><div>  };</div><div>  using BarInt = Bar<int>;</div></div><div>```</div><div><br></div><div>Whereas this code will result in hasDefinition() == true as I want:</div><div>```</div><div><div>  class Foo : public Bar<int> {};</div></div><div>```</div><div><br></div><div>Thanks for any help you can provide! I've searched the net for answers, and also browsed the clang source code, but I'll admit that I haven't dug deeply enough yet to figure out exactly which code path is triggering the instantiations that are missing definitions yet.</div><div><br></div><div>Thanks,</div><div>Kris</div></div>
</blockquote></div><br></div>
</div></div><br></span>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>