<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Allow clang-cl.exe /c -emit-llvm"
   href="https://bugs.llvm.org/show_bug.cgi?id=35190">35190</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Allow clang-cl.exe /c -emit-llvm
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>5.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Driver
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>andreas.haferburg@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>There is no `-emit-llvm` flag in gcc, but the GCC driver was extended to
support `-emit-llvm`. The equivalent for cl.exe would be `/c -emit-llvm`, but
it doesn't work.

What I found very surprising is that `clang-cl /c -Xclang -emit-llvm
hello_world.c` doesn't even work. Maybe that is a bug.

All the examples on <a href="https://clang.llvm.org/docs/UsersManual.html">https://clang.llvm.org/docs/UsersManual.html</a> are written
for clang.exe, and they don't work anymore for clang-cl.exe.

The workaround for getting clang-cl.exe to emit IR is to run `clang-cl.exe
-###`, and then replace the `-emit-obj` with `-emit-llvm`, which I personally
find quite unintuitive.

The goal for clang-cl.exe is to be compatible with cl.exe. But in my opinion,
it should also remain compatible with LLVM: clang.exe should be LLVM+gcc, and
clang-cl.exe should be LLVM+cl.

Cf. <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED INVALID - clang-cl /MT results in linker error unless /link /DEFAULTLIB:LIBCMT.lib is added"
   href="show_bug.cgi?id=35120">https://bugs.llvm.org/show_bug.cgi?id=35120</a></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>