<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">I think it’s more suitable to ask this question on clang mailing list (cfe-dev)</div><div class=""><br class=""></div><div class="">B.R.</div><div class="">Bekket<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Feb 5, 2019, at 12:29 AM, Teodor Dermendzhiev via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div id="divtagdefaultwrapper" dir="ltr" style="caret-color: rgb(0, 0, 0); font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class=""><p style="margin-top: 0px; margin-bottom: 0px;" class=""></p><div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;" class="">Hi all,<br class="">I am having problems walking through the syntax tree of a simple header file. With llvm 4.0.1 everything works as expected but<span style="font-size: 12pt;" class=""> after upgrading to 7.0.0 I notice that just a small number of all declarations in the AST are being visited. </span></div><div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px; font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;" class="">Running a simple ASTFrontendAction (like the one from this article - <a href="https://clang.llvm.org/docs/RAVFrontendAction.html" target="_blank" rel="noopener noreferrer" data-auth="NotApplicable" class="x_OWAAutoLink" id="LPlnk818952" previewremoved="true">https://clang.llvm.org/docs/RAVFrontendAction.html</a> ) in HandleTranslationUnit() -<br class=""><br class=""></div><div style="font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;" class="">    virtual void HandleTranslationUnit(ASTContext &Context) {<br class="">        Decl* tu = Context.getTranslationUnitDecl();<br class="">        Visitor.TraverseDecl(tu);<br class="">    }</div><div style="font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;" class=""><br class=""></div><div style="font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;" class="">when I dump the *tu* variable I get a lot smaller dump with 7.0.0. After investigating further I updated TraverseDeclContextHelper() method in order to print the size of decls() container for every DeclContext we visit:<br class=""><br class=""><div class="">template <typename Derived><br class="">bool RecursiveASTVisitor<Derived>::TraverseDeclContextHelper(DeclContext *DC) {<br class="">  if (!DC)<br class="">    return true;<br class=""><br class="">  int childSize = 0; // my code<br class=""><br class="">  for (auto *Child : DC->decls()) {<br class="">    childSize++; // my code<br class="">    if (!canIgnoreChildDeclWhileTraversingDeclContext(Child))<br class="">        TRY_TO(TraverseDecl(Child));<br class="">  }<br class=""><br class="">  std::cout << DC->getDeclKindName() << ": " << childSize << " child declarations" << "\n"; //my code<br class=""><br class="">  return true;<br class="">}</div><br class=""></div><span style="font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;" class="">With llvm 4.0.0 I get: </span><div style="font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;" class="">TranslationUnit: 20526 child declarations<br class=""><br class="">while with 7.0.0:<br class="">TranslationUnit: 486 child declarations</div><div style="font-family: Calibri, Helvetica, sans-serif, serif, EmojiFont; font-size: 16px;" class=""><br class="">I created a sample project that illustrates this behavior - <a href="https://github.com/tdermendjiev/clang-samples" target="_blank" rel="noopener noreferrer" data-auth="NotApplicable" class="x_OWAAutoLink" id="LPlnk291918" previewremoved="true">https://github.com/tdermendjiev/clang-samples</a> . <br class=""><br class="">Any help tackling this issue is appreciated. Thank you.<br class=""><br class="">Best wishes,<br class="">Teodor Dermendzhiev</div><br class=""><p style="margin-top: 0px; margin-bottom: 0px;" class=""></p></div><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">LLVM Developers mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="mailto:llvm-dev@lists.llvm.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">llvm-dev@lists.llvm.org</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></div></blockquote></div><br class=""></div></body></html>