<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW " title="NEW --- - clang_visitChildren skips elements" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24268&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=jKJvEmsr2ytE4NEjLrXgh6QagHsnt1CKVUSUd45dWlU&s=xNRUAz2QTarVrVbo4h36QkpY_c0g--NsTBKCKKSqCw0&e=">24268</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang_visitChildren skips elements
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.7
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>libclang
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mail@milianw.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>klimek@google.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14647" name="attach_14647" title="visitor code">attachment 14647</a> <a href="attachment.cgi?id=14647&action=edit" title="visitor code">[details]</a></span>
visitor code

This is a really odd issue I found. The attached clang-c based code (compile
with $CXX -lclang), fails to visit the call to returnTemplateInstantiation:

...
"MyTemplate" [(28, 1), (28, 44)] in test.cpp | ClassTemplate
"T" [(28, 11), (28, 21)] in test.cpp | TemplateTypeParameter
"ReturnType" [(30, 1), (30, 35)] in test.cpp | TypeAliasDecl
"MyTemplate" [(30, 20), (30, 30)] in test.cpp | TemplateRef
"callFunction" [(34, 1), (34, 26)] in test.cpp | FunctionDecl
"ReturnType" [(34, 1), (34, 11)] in test.cpp | TypeRef
"hereIsTheError" [(36, 1), (36, 42)] in test.cpp | FunctionDecl
"" [(36, 23), (36, 42)] in test.cpp | CompoundStmt


If one instead comments the line for f20, or uses an int for ReturnType, the
callFunction is properly visited:

...
"MyTemplate" [(28, 1), (28, 44)] in test.cpp | ClassTemplate
"T" [(28, 11), (28, 21)] in test.cpp | TemplateTypeParameter
"ReturnType" [(32, 1), (32, 23)] in test.cpp | TypeAliasDecl
"callFunction" [(34, 1), (34, 26)] in test.cpp | FunctionDecl
"ReturnType" [(34, 1), (34, 11)] in test.cpp | TypeRef
"hereIsTheError" [(36, 1), (36, 42)] in test.cpp | FunctionDecl
"" [(36, 23), (36, 42)] in test.cpp | CompoundStmt
"callFunction" [(36, 25), (36, 39)] in test.cpp | CallExpr
"callFunction" [(36, 25), (36, 37)] in test.cpp | UnexposedExpr
"callFunction" [(36, 25), (36, 37)] in test.cpp | DeclRefExpr

Can anyone point me to the code in clang that could be responsible for such
erratic behavior? It is quite a serious issue for us in KDevelop, and I could
believe it's bad for any other IDE relying on clang-c.

Thanks!</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>