<html>
    <head>
      <base href="http://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_createIndex - unexpected behavior from excludeDeclarationsFromPCH parameter"
   href="http://llvm.org/bugs/show_bug.cgi?id=21346">21346</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang_createIndex - unexpected behavior from excludeDeclarationsFromPCH parameter
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </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>rob.springer@live.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>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=13238" name="attach_13238" title="Test program (executor).">attachment 13238</a> <a href="attachment.cgi?id=13238&action=edit" title="Test program (executor).">[details]</a></span>
Test program (executor).

Short summary: when clang_createIndex() is called with a zero/"false" argument
for the excludeDeclarationsFromPCH parameter, explicit template instantiations
appear to be missing from the generated AST.

Attached are two files:
 - function_tmpl_instantiation.cc - Reproducer "input" file, consisting of a 
   function template declaration and three explicit instantiations of that
   template.
 - missing_func_decls.cc - Test program. When this program is built without
   -DSHOW_BAD_BEHAVIOR, the CXIndex is created by "clang_createIndex(1, 1)". In
   this case, all function template instantiations are visible when the TU's 
   [top-level] child nodes are all visited. When -DSHOW_BAD_BEHAVIOR is set,
   the CXIndex is created by calling "clang_createIndex(0, 1)". In this case, 
   none of the explicit instantiations are visited when walking the TU's 
   children.

I suspect that this is a bug, b/c the description for the
"excludeDeclarationsFromPCH" parameter only references excluding non-local
declarations from the TU being parsed. I'd expect that the explicit
instantiations would all be considered "local", so the fact that this flag
influences their presence would seem to be a bug.

Apologies in advance if I'm operating under some misconception, & 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>