Always use -fparse-all-comments

This commit is contained in:
Jacob Dufault 2017-12-27 07:56:17 -08:00
parent ef4af128fc
commit 9dde5041cb
2 changed files with 21 additions and 15 deletions

View File

@ -303,9 +303,6 @@ void TryEnsureDocumentParsed(ClangCompleteManager* manager,
std::vector<std::string> args = session->file.args; std::vector<std::string> args = session->file.args;
// Show comment docstrings.
args.push_back("-fparse-all-comments");
// -fspell-checking enables FixIts for, ie, misspelled types. // -fspell-checking enables FixIts for, ie, misspelled types.
if (!AnyStartsWith(args, "-fno-spell-checking") && if (!AnyStartsWith(args, "-fno-spell-checking") &&
!AnyStartsWith(args, "-fspell-checking")) { !AnyStartsWith(args, "-fspell-checking")) {

View File

@ -211,6 +211,11 @@ 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");
// Using -fparse-all-comments enables documententation in the indexer and in
// code completion.
if (!AnyStartsWith(result.args, "-fparse-all-comments"))
result.args.push_back("-fparse-all-comments");
return result; return result;
} }
@ -482,19 +487,21 @@ TEST_SUITE("Project") {
/* raw */ {"clang", "-lstdc++", "myfile.cc"}, /* raw */ {"clang", "-lstdc++", "myfile.cc"},
/* expected */ /* expected */
{"clang", "-lstdc++", "myfile.cc", "-xc++", "-std=c++11", {"clang", "-lstdc++", "myfile.cc", "-xc++", "-std=c++11",
"-resource-dir=/w/resource_dir/", "-Wno-unknown-warning-option"}); "-resource-dir=/w/resource_dir/", "-Wno-unknown-warning-option",
"-fparse-all-comments"});
CheckFlags( CheckFlags(
/* raw */ {"goma", "clang"}, /* raw */ {"goma", "clang"},
/* expected */ /* expected */
{"clang", "-xc++", "-std=c++11", "-resource-dir=/w/resource_dir/", {"clang", "-xc++", "-std=c++11", "-resource-dir=/w/resource_dir/",
"-Wno-unknown-warning-option"}); "-Wno-unknown-warning-option", "-fparse-all-comments"});
CheckFlags( CheckFlags(
/* raw */ {"goma", "clang", "--foo"}, /* raw */ {"goma", "clang", "--foo"},
/* expected */ /* expected */
{"clang", "--foo", "-xc++", "-std=c++11", {"clang", "--foo", "-xc++", "-std=c++11",
"-resource-dir=/w/resource_dir/", "-Wno-unknown-warning-option"}); "-resource-dir=/w/resource_dir/", "-Wno-unknown-warning-option",
"-fparse-all-comments"});
} }
// FIXME: Fix this test. // FIXME: Fix this test.
@ -504,16 +511,16 @@ TEST_SUITE("Project") {
/* raw */ {"cc", "-O0", "foo/bar.c"}, /* raw */ {"cc", "-O0", "foo/bar.c"},
/* expected */ /* expected */
{"cc", "-O0", "-xc", "-std=c11", "-resource-dir=/w/resource_dir/", {"cc", "-O0", "-xc", "-std=c11", "-resource-dir=/w/resource_dir/",
"-Wno-unknown-warning-option"}); "-Wno-unknown-warning-option", "-fparse-all-comments"});
} }
TEST_CASE("Implied binary") { TEST_CASE("Implied binary") {
CheckFlags( CheckFlags("/home/user", "/home/user/foo/bar.cc",
"/home/user", "/home/user/foo/bar.cc", /* raw */ {"-DDONT_IGNORE_ME"},
/* raw */ {"-DDONT_IGNORE_ME"}, /* expected */
/* expected */ {"clang++", "-DDONT_IGNORE_ME", "-xc++", "-std=c++11",
{"clang++", "-DDONT_IGNORE_ME", "-xc++", "-std=c++11", "-resource-dir=/w/resource_dir/", "-Wno-unknown-warning-option",
"-resource-dir=/w/resource_dir/", "-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
@ -859,7 +866,8 @@ TEST_SUITE("Project") {
"-fvisibility-inlines-hidden", "-fvisibility-inlines-hidden",
"-xc++", "-xc++",
"-resource-dir=/w/resource_dir/", "-resource-dir=/w/resource_dir/",
"-Wno-unknown-warning-option"}); "-Wno-unknown-warning-option",
"-fparse-all-comments"});
} }
// Checks flag parsing for an example chromium file. // Checks flag parsing for an example chromium file.
@ -1179,7 +1187,8 @@ TEST_SUITE("Project") {
"-fvisibility-inlines-hidden", "-fvisibility-inlines-hidden",
"-xc++", "-xc++",
"-resource-dir=/w/resource_dir/", "-resource-dir=/w/resource_dir/",
"-Wno-unknown-warning-option"}); "-Wno-unknown-warning-option",
"-fparse-all-comments"});
} }
TEST_CASE("Directory extraction") { TEST_CASE("Directory extraction") {