[llvm-bugs] [Bug 50742] New: clangd indexing broken for bazel compilation database

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 16 10:15:43 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50742

            Bug ID: 50742
           Summary: clangd indexing broken for bazel compilation database
           Product: clang-tools-extra
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: clangd
          Assignee: unassignedclangbugs at nondot.org
          Reporter: llvm at wkenyon.net
                CC: llvm-bugs at lists.llvm.org

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 at 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 at 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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210616/9935a84a/attachment.html>


More information about the llvm-bugs mailing list