Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't grab compilation command of a precompiled header #601

Open
laralex opened this issue Oct 6, 2024 · 2 comments
Open

Doesn't grab compilation command of a precompiled header #601

laralex opened this issue Oct 6, 2024 · 2 comments

Comments

@laralex
Copy link

laralex commented Oct 6, 2024

Describe the bug
Can't make Bear to append the compilation command of a precompiled header into compile_commands.json

To Reproduce
Make a header file test.hpp

#include <iostream>

inline void test(int a, int b) {
    std::cout << a + b;
}

Run Bear to generated the precompiled header

bear clang++ -std=c++20 -g -c -o test.hpp.pch -xc++-header test.hpp

Expected behavior
compile_commands.json should contain the compilation command, clangd is perfectly capable of interacting with it for code completion

[
   {
       "arguments": [
            "clang++",
            "-std=c++20",
            "-g",
            "-c",
            "-o",
            "test.hpp.pch",
            "-xc++-header",
            "test.hpp"
        ],
        "directory": "/home/user/test",
        "file": "test.hpp.pch"
    }
]

Instead compile_commands.json is just

[]

Environment:

  • OS name: Linux
  • OS version: Ubuntu 20.04.6 LTS
  • OS architecture: x86_64
  • Bear version: 2.4.3
  • Bear install method: sudo apt install bear

Additional context

@rizsotto
Copy link
Owner

rizsotto commented Oct 7, 2024

Hey @laralex , thanks for the report.

Yes, Bear does not put precompiled header into the output. This was a kind of design decision, because I have not seen use of it. Give me some time to implement it. Will keep the ticket open.

@laralex
Copy link
Author

laralex commented Oct 7, 2024

@rizsotto I tried to build v3.1.5 from source, it seems to work already. Though I wonder why Ubuntu 20.04 is packaged with such an old version 2.4.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants