mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 23:55:08 +00:00
Don't store -fsyntax-only in compilation entries
There is a FIXME about the usage of -fsyntax-only in clang::createInvocationFromCommandLine
This commit is contained in:
parent
5bbd3f4a29
commit
7e45983d6d
@ -93,10 +93,12 @@ std::unique_ptr<ClangTranslationUnit> ClangTranslationUnit::Create(
|
|||||||
if (error_code != CXError_Success && cx_tu)
|
if (error_code != CXError_Success && cx_tu)
|
||||||
EmitDiagnostics(filepath, args, cx_tu);
|
EmitDiagnostics(filepath, args, cx_tu);
|
||||||
|
|
||||||
|
// We sometimes dump the command to logs and ask the user to run it. Include
|
||||||
|
// -fsyntax-only so they don't do a full compile.
|
||||||
auto make_msg = [&]() {
|
auto make_msg = [&]() {
|
||||||
return "Please try running the following, identify which flag causes the "
|
return "Please try running the following, identify which flag causes the "
|
||||||
"issue, and report a bug. cquery will then filter the flag for you "
|
"issue, and report a bug. cquery will then filter the flag for you "
|
||||||
" automatically:\n$ " + StringJoin(args, " ");
|
" automatically:\n$ " + StringJoin(args, " ") + " -fsyntax-only";
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (error_code) {
|
switch (error_code) {
|
||||||
|
@ -265,11 +265,6 @@ Project::Entry GetCompilationEntryFromCompileCommandEntry(
|
|||||||
if (!AnyStartsWith(result.args, "-Wno-unknown-warning-option"))
|
if (!AnyStartsWith(result.args, "-Wno-unknown-warning-option"))
|
||||||
result.args.push_back("-Wno-unknown-warning-option");
|
result.args.push_back("-Wno-unknown-warning-option");
|
||||||
|
|
||||||
// We sometimes dump the command to logs and ask the user to run it. Include
|
|
||||||
// -fsyntax-only so they don't do a full compile.
|
|
||||||
if (!AnyStartsWith(result.args, "-fsyntax-only"))
|
|
||||||
result.args.push_back("-fsyntax-only");
|
|
||||||
|
|
||||||
// Using -fparse-all-comments enables documentation in the indexer and in
|
// Using -fparse-all-comments enables documentation in the indexer and in
|
||||||
// code completion.
|
// code completion.
|
||||||
if (init_opts->index.comments > 1 &&
|
if (init_opts->index.comments > 1 &&
|
||||||
@ -603,28 +598,28 @@ TEST_SUITE("Project") {
|
|||||||
/* expected */
|
/* expected */
|
||||||
{"clang", "-working-directory", "/dir/", "-xc++", "-std=c++14",
|
{"clang", "-working-directory", "/dir/", "-xc++", "-std=c++14",
|
||||||
"-lstdc++", "&/dir/myfile.cc", "-resource-dir=/w/resource_dir/",
|
"-lstdc++", "&/dir/myfile.cc", "-resource-dir=/w/resource_dir/",
|
||||||
"-Wno-unknown-warning-option", "-fsyntax-only", "-fparse-all-comments"});
|
"-Wno-unknown-warning-option", "-fparse-all-comments"});
|
||||||
|
|
||||||
CheckFlags(
|
CheckFlags(
|
||||||
/* raw */ {"clang.exe"},
|
/* raw */ {"clang.exe"},
|
||||||
/* expected */
|
/* expected */
|
||||||
{"clang.exe", "-working-directory", "/dir/", "-xc++", "-std=c++14",
|
{"clang.exe", "-working-directory", "/dir/", "-xc++", "-std=c++14",
|
||||||
"-resource-dir=/w/resource_dir/", "-Wno-unknown-warning-option",
|
"-resource-dir=/w/resource_dir/", "-Wno-unknown-warning-option",
|
||||||
"-fsyntax-only", "-fparse-all-comments"});
|
"-fparse-all-comments"});
|
||||||
|
|
||||||
CheckFlags(
|
CheckFlags(
|
||||||
/* raw */ {"goma", "clang"},
|
/* raw */ {"goma", "clang"},
|
||||||
/* expected */
|
/* expected */
|
||||||
{"clang", "-working-directory", "/dir/", "-xc++", "-std=c++14",
|
{"clang", "-working-directory", "/dir/", "-xc++", "-std=c++14",
|
||||||
"-resource-dir=/w/resource_dir/", "-Wno-unknown-warning-option",
|
"-resource-dir=/w/resource_dir/", "-Wno-unknown-warning-option",
|
||||||
"-fsyntax-only", "-fparse-all-comments"});
|
"-fparse-all-comments"});
|
||||||
|
|
||||||
CheckFlags(
|
CheckFlags(
|
||||||
/* raw */ {"goma", "clang", "--foo"},
|
/* raw */ {"goma", "clang", "--foo"},
|
||||||
/* expected */
|
/* expected */
|
||||||
{"clang", "-working-directory", "/dir/", "-xc++", "-std=c++14", "--foo",
|
{"clang", "-working-directory", "/dir/", "-xc++", "-std=c++14", "--foo",
|
||||||
"-resource-dir=/w/resource_dir/", "-Wno-unknown-warning-option",
|
"-resource-dir=/w/resource_dir/", "-Wno-unknown-warning-option",
|
||||||
"-fsyntax-only", "-fparse-all-comments"});
|
"-fparse-all-comments"});
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Windows path normalization") {
|
TEST_CASE("Windows path normalization") {
|
||||||
@ -633,7 +628,7 @@ TEST_SUITE("Project") {
|
|||||||
/* expected */
|
/* expected */
|
||||||
{"clang", "-working-directory", "E:/workdir", "-xc++", "-std=c++14",
|
{"clang", "-working-directory", "E:/workdir", "-xc++", "-std=c++14",
|
||||||
"&E:/workdir/bar.cc", "-resource-dir=/w/resource_dir/",
|
"&E:/workdir/bar.cc", "-resource-dir=/w/resource_dir/",
|
||||||
"-Wno-unknown-warning-option", "-fsyntax-only", "-fparse-all-comments"});
|
"-Wno-unknown-warning-option", "-fparse-all-comments"});
|
||||||
|
|
||||||
CheckFlags(
|
CheckFlags(
|
||||||
"E:/workdir", "E:/workdir/bar.cc",
|
"E:/workdir", "E:/workdir/bar.cc",
|
||||||
@ -641,7 +636,7 @@ TEST_SUITE("Project") {
|
|||||||
/* expected */
|
/* expected */
|
||||||
{"clang", "-working-directory", "E:/workdir", "-xc++", "-std=c++14",
|
{"clang", "-working-directory", "E:/workdir", "-xc++", "-std=c++14",
|
||||||
"&E:/workdir/bar.cc", "-resource-dir=/w/resource_dir/",
|
"&E:/workdir/bar.cc", "-resource-dir=/w/resource_dir/",
|
||||||
"-Wno-unknown-warning-option", "-fsyntax-only", "-fparse-all-comments"});
|
"-Wno-unknown-warning-option", "-fparse-all-comments"});
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Path in args") {
|
TEST_CASE("Path in args") {
|
||||||
@ -651,7 +646,7 @@ TEST_SUITE("Project") {
|
|||||||
/* expected */
|
/* expected */
|
||||||
{"cc", "-working-directory", "/home/user", "-xc", "-std=gnu11", "-O0",
|
{"cc", "-working-directory", "/home/user", "-xc", "-std=gnu11", "-O0",
|
||||||
"&/home/user/foo/bar.c", "-resource-dir=/w/resource_dir/",
|
"&/home/user/foo/bar.c", "-resource-dir=/w/resource_dir/",
|
||||||
"-Wno-unknown-warning-option", "-fsyntax-only", "-fparse-all-comments"});
|
"-Wno-unknown-warning-option", "-fparse-all-comments"});
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Implied binary") {
|
TEST_CASE("Implied binary") {
|
||||||
@ -661,7 +656,7 @@ TEST_SUITE("Project") {
|
|||||||
/* expected */
|
/* expected */
|
||||||
{"clang++", "-working-directory", "/home/user", "-xc++", "-std=c++14",
|
{"clang++", "-working-directory", "/home/user", "-xc++", "-std=c++14",
|
||||||
"-DDONT_IGNORE_ME", "-resource-dir=/w/resource_dir/",
|
"-DDONT_IGNORE_ME", "-resource-dir=/w/resource_dir/",
|
||||||
"-Wno-unknown-warning-option", "-fsyntax-only", "-fparse-all-comments"});
|
"-Wno-unknown-warning-option", "-fparse-all-comments"});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks flag parsing for a random chromium file in comparison to what
|
// Checks flag parsing for a random chromium file in comparison to what
|
||||||
@ -1012,7 +1007,6 @@ TEST_SUITE("Project") {
|
|||||||
"lock_screen_sanity_unittest.cc",
|
"lock_screen_sanity_unittest.cc",
|
||||||
"-resource-dir=/w/resource_dir/",
|
"-resource-dir=/w/resource_dir/",
|
||||||
"-Wno-unknown-warning-option",
|
"-Wno-unknown-warning-option",
|
||||||
"-fsyntax-only",
|
|
||||||
"-fparse-all-comments"});
|
"-fparse-all-comments"});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1338,7 +1332,6 @@ TEST_SUITE("Project") {
|
|||||||
"&/w/c/s/out/Release/../../apps/app_lifetime_monitor.cc",
|
"&/w/c/s/out/Release/../../apps/app_lifetime_monitor.cc",
|
||||||
"-resource-dir=/w/resource_dir/",
|
"-resource-dir=/w/resource_dir/",
|
||||||
"-Wno-unknown-warning-option",
|
"-Wno-unknown-warning-option",
|
||||||
"-fsyntax-only",
|
|
||||||
"-fparse-all-comments"});
|
"-fparse-all-comments"});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user