<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 - clangd indexing broken for bazel compilation database"
   href="https://bugs.llvm.org/show_bug.cgi?id=50742">50742</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clangd indexing broken for bazel compilation database
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang-tools-extra
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>clangd
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>llvm@wkenyon.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hey, bazel produces a compilation database with commands that compile fine with
clang, but do not index properly with clangd-indexer (or background indexing
with clangd).

For example, if you create these two files in /tmp/reproduce

`hello-world.cc`
```
#include <iostream>
#include <x86intrin.h>

int main(int argc, char** argv) {
  std::cout << "Hello world" << std::endl;
  return 0;
}
```

`compile_commands.json`
```
[
{"command":"/usr/bin/clang -Wall -fno-omit-frame-pointer -std=c++17 -iquote .
-I /usr/lib/llvm-6.0/lib/clang/6.0.0/include -I /usr/include -I
/usr/include/c++/7 -I /usr/include/x86_64-linux-gnu/c++/7 -I
/usr/include/c++/7/backward -x c++ -c hello-world.cc",
"directory":"/tmp/reproduce", "file":"hello-world.cc"}
```

Then run the following commands:

```
will@will-desktop:/tmp/reproduce$ /usr/bin/clang -Wall -fno-omit-frame-pointer
-std=c++17 -iquote . -I /usr/lib/llvm-6.0/lib/clang/6.0.0/include -I
/usr/include -I /usr/include/c++/7 -I /usr/include/x86_64-linux-gnu/c++/7 -I
/usr/include/c++/7/backward -x c++ -c hello-world.cc
will@will-desktop:/tmp/reproduce$ ~/llvm-project/build/bin/clangd-indexer
--executor=all-TUs compile_commands.json > /dev/null
[1/1] Processing file /home/will/examples/cpp-tutorial/stage1/hello-world.cc
In file included from hello-world.cc:2:
In file included from /usr/lib/llvm-6.0/lib/clang/6.0.0/include/x86intrin.h:29:
In file included from /usr/lib/llvm-6.0/lib/clang/6.0.0/include/immintrin.h:32:
/usr/lib/llvm-6.0/lib/clang/6.0.0/include/xmmintrin.h:1900:3: error: use of
undeclared identifier '__builtin_ia32_storehps'
  __builtin_ia32_storehps((__v2si *)__p, (__v4sf)__a);
  ^
/usr/lib/llvm-6.0/lib/clang/6.0.0/include/xmmintrin.h:1917:3: error: use of
undeclared identifier '__builtin_ia32_storelps'
  __builtin_ia32_storelps((__v2si *)__p, (__v4sf)__a);
  ^
In file included from hello-world.cc:2:
In file included from /usr/lib/llvm-6.0/lib/clang/6.0.0/include/x86intrin.h:29:
In file included from /usr/lib/llvm-6.0/lib/clang/6.0.0/include/immintrin.h:32:
In file included from
/usr/lib/llvm-6.0/lib/clang/6.0.0/include/xmmintrin.h:2969:
/usr/lib/llvm-6.0/lib/clang/6.0.0/include/emmintrin.h:3427:10: error: use of
undeclared identifier '__builtin_ia32_cvtdq2ps'; did you mean
'__builtin_ia32_cvtpd2ps'?
  return __builtin_ia32_cvtdq2ps((__v4si)__a);
         ^~~~~~~~~~~~~~~~~~~~~~~
         __builtin_ia32_cvtpd2ps
/usr/lib/llvm-6.0/lib/clang/6.0.0/include/emmintrin.h:1309:10: note:
'__builtin_ia32_cvtpd2ps' declared here
  return __builtin_ia32_cvtpd2ps((__v2df)__a);
         ^
In file included from hello-world.cc:2:
In file included from /usr/lib/llvm-6.0/lib/clang/6.0.0/include/x86intrin.h:29:
In file included from /usr/lib/llvm-6.0/lib/clang/6.0.0/include/immintrin.h:66:
/usr/lib/llvm-6.0/lib/clang/6.0.0/include/avxintrin.h:2228:18: error: use of
undeclared identifier '__builtin_ia32_cvtdq2ps256'; did you mean
'__builtin_ia32_cvtpd2ps256'?
  return (__m256)__builtin_ia32_cvtdq2ps256((__v8si) __a);
...
```

You can see that clang compiles the file successfully, but clangd can't index
it.

Thanks,

Will</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>