<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 --- - missing call to CompilerInstance::setAuxTarget in ASTUnit::Parse"
   href="https://llvm.org/bugs/show_bug.cgi?id=26359">26359</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>missing call to CompilerInstance::setAuxTarget in ASTUnit::Parse
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jascha@jawset.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=15743" name="attach_15743" title="patch to add setAuxTarget call to ASTUnit::Parse">attachment 15743</a> <a href="attachment.cgi?id=15743&action=edit" title="patch to add setAuxTarget call to ASTUnit::Parse">[details]</a></span>
patch to add setAuxTarget call to ASTUnit::Parse

I'm using libclang to parse CUDA sources via clang_parseTranslationUnit2, which
ends up calling ASTUnit::Parse. Unlike CompilerInstance::ExecuteAction
ASTUnit::Parse does not call setAuxTarget for the secondary target for CUDA
compilation. This results in several undeclared __builtin_ptx_* errors. Adding
the call resolves this.
Attached is a small patch for ASTUnit::Parse.

There are several other callers of CompilerInstance::setTarget (mostly in
ASTUnit.cpp) that don't call setAuxTarget either. Maybe the
setTarget/setAuxTarget call pair could be factored out into some sort of
setAllTargets call that all callers could use.
I don't know enough about the codebase to restructure this properly, though.</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>