From 9dde5041cbb49cf29bdb56d397f21dbdd90658c1 Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Wed, 27 Dec 2017 07:56:17 -0800 Subject: [PATCH] Always use -fparse-all-comments --- src/clang_complete.cc | 3 --- src/project.cc | 33 +++++++++++++++++++++------------ 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/clang_complete.cc b/src/clang_complete.cc index 5c74effb..68b7536c 100644 --- a/src/clang_complete.cc +++ b/src/clang_complete.cc @@ -303,9 +303,6 @@ void TryEnsureDocumentParsed(ClangCompleteManager* manager, std::vector args = session->file.args; - // Show comment docstrings. - args.push_back("-fparse-all-comments"); - // -fspell-checking enables FixIts for, ie, misspelled types. if (!AnyStartsWith(args, "-fno-spell-checking") && !AnyStartsWith(args, "-fspell-checking")) { diff --git a/src/project.cc b/src/project.cc index 2b1612a5..9d385384 100644 --- a/src/project.cc +++ b/src/project.cc @@ -211,6 +211,11 @@ Project::Entry GetCompilationEntryFromCompileCommandEntry( if (!AnyStartsWith(result.args, "-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; } @@ -482,19 +487,21 @@ TEST_SUITE("Project") { /* raw */ {"clang", "-lstdc++", "myfile.cc"}, /* expected */ {"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( /* raw */ {"goma", "clang"}, /* expected */ {"clang", "-xc++", "-std=c++11", "-resource-dir=/w/resource_dir/", - "-Wno-unknown-warning-option"}); + "-Wno-unknown-warning-option", "-fparse-all-comments"}); CheckFlags( /* raw */ {"goma", "clang", "--foo"}, /* expected */ {"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. @@ -504,16 +511,16 @@ TEST_SUITE("Project") { /* raw */ {"cc", "-O0", "foo/bar.c"}, /* expected */ {"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") { - CheckFlags( - "/home/user", "/home/user/foo/bar.cc", - /* raw */ {"-DDONT_IGNORE_ME"}, - /* expected */ - {"clang++", "-DDONT_IGNORE_ME", "-xc++", "-std=c++11", - "-resource-dir=/w/resource_dir/", "-Wno-unknown-warning-option"}); + CheckFlags("/home/user", "/home/user/foo/bar.cc", + /* raw */ {"-DDONT_IGNORE_ME"}, + /* expected */ + {"clang++", "-DDONT_IGNORE_ME", "-xc++", "-std=c++11", + "-resource-dir=/w/resource_dir/", "-Wno-unknown-warning-option", + "-fparse-all-comments"}); } // Checks flag parsing for a random chromium file in comparison to what @@ -859,7 +866,8 @@ TEST_SUITE("Project") { "-fvisibility-inlines-hidden", "-xc++", "-resource-dir=/w/resource_dir/", - "-Wno-unknown-warning-option"}); + "-Wno-unknown-warning-option", + "-fparse-all-comments"}); } // Checks flag parsing for an example chromium file. @@ -1179,7 +1187,8 @@ TEST_SUITE("Project") { "-fvisibility-inlines-hidden", "-xc++", "-resource-dir=/w/resource_dir/", - "-Wno-unknown-warning-option"}); + "-Wno-unknown-warning-option", + "-fparse-all-comments"}); } TEST_CASE("Directory extraction") {