Closed LKlemens closed 5 years ago
If you replace manually:
"arguments": [
"c++",
"-c",
"TestMain.hpp"
],
By:
"command": "c++ -c TestMain.hpp",
You don't have the error anymore?
Works like a charm
"arguments": [
"c++",
"-c",
"TestMain.hpp"
],
Error appearing with this:
"command": "c++ -c TestMain.hpp",
What version of Clang do you use?
clang version 5.0.1
ERR with rtags:
rc -J .
LIBCLANG TOOLING ERROR: json-compilation-database: Expected array.
Output with clang-check
clang-check TestMain.cpp -p .
Skipping /home/user/test/TestMain.cpp. Compile command not found.
I don't think Clang is the issue, I also use Clang 5.0.1, clang-tidy uses the Clang parsing facilities, and the compilation database is read without issues using command
:
/tmp/testdir$ clang-tidy --version
LLVM (http://llvm.org/):
LLVM version 5.0.1
Optimized build.
Default target: x86_64-unknown-linux-gnu
Host CPU: haswell
/tmp/testdir$ tail -n +1 *
==> compile_commands.json <==
[
{
"command": "c++ -std=c++14 -Wall -Wextra -c test.hpp"
"directory": "/tmp/testdir",
"file": "test.hpp"
}
]
==> test.hpp <==
#include <memory>
inline std::unique_ptr<int> make_unique_int(int x) {
return std::unique_ptr<int>(new int());
}
/tmp/testdir$ clang-tidy -checks '-*,clang-diagnostic-unused-parameter,modernize-make-unique' -p . test.hpp
2 warnings generated.
test.hpp:3:49: warning: unused parameter 'x' [clang-diagnostic-unused-parameter]
inline std::unique_ptr<int> make_unique_int(int x) {
^
/tmp/testdir/test.hpp:4:10: warning: use std::make_unique instead [modernize-make-unique]
return std::unique_ptr<int>(new int());
^~~~~~~~~~~~~~~~ ~~~~~~~~~~
std::make_unique
Wow, I've created json file with bear, and modified it with compdb again and it starts work :P Sorry for bothering you, next time I will be more careful and double check before create issue.
I am asking for support of newer scheme in compile_commands.json For instance:
Newer clang versions do not support scheme with "command" ;/ LIBCLANG TOOLING ERROR: json-compilation-database: Expected array.
Thanks in advance!