[PATCH] D63989: Summary: [Clangd] Added hidden flag --disable-tweaks to disable tweaks- Only for testing purposes
Shaurya Gupta via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 1 05:39:52 PDT 2019
SureYeaah created this revision.
SureYeaah added reviewers: sammccall, kadircet.
Herald added subscribers: cfe-commits, arphaman, jkorous, MaskRay, ilya-biryukov.
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D63989
Files:
clang-tools-extra/clangd/ClangdServer.cpp
clang-tools-extra/clangd/ClangdServer.h
clang-tools-extra/clangd/test/fixits-duplication.test
clang-tools-extra/clangd/tool/ClangdMain.cpp
Index: clang-tools-extra/clangd/tool/ClangdMain.cpp
===================================================================
--- clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -278,6 +278,11 @@
"/usr/bin/**/clang-*,/path/to/repo/**/g++-*"),
llvm::cl::CommaSeparated);
+static llvm::cl::opt<bool> DisableTweaks(
+ "disable-tweaks",
+ llvm::cl::desc("Disable tweak diagnostics for testing purposes."),
+ llvm::cl::init(false), llvm::cl::Hidden);
+
namespace {
/// \brief Supports a test URI scheme with relaxed constraints for lit tests.
@@ -476,7 +481,7 @@
Opts.StaticIndex = StaticIdx.get();
Opts.AsyncThreadsCount = WorkerThreadsCount;
Opts.HiddenFeatures = HiddenFeatures;
-
+ Opts.DisableTweaks = DisableTweaks;
clangd::CodeCompleteOptions CCOpts;
CCOpts.IncludeIneligibleResults = IncludeIneligibleResults;
CCOpts.Limit = LimitResults;
Index: clang-tools-extra/clangd/test/fixits-duplication.test
===================================================================
--- clang-tools-extra/clangd/test/fixits-duplication.test
+++ clang-tools-extra/clangd/test/fixits-duplication.test
@@ -1,4 +1,4 @@
-# RUN: clangd -lit-test -clang-tidy-checks=modernize-use-nullptr,hicpp-use-nullptr < %s | FileCheck -strict-whitespace %s
+# RUN: clangd -lit-test -clang-tidy-checks=modernize-use-nullptr,hicpp-use-nullptr --disable-tweaks < %s | FileCheck -strict-whitespace %s
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{"textDocument":{"codeAction":{"codeActionLiteralSupport":{}}}},"trace":"off"}}
---
{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"test:///foo.cpp","languageId":"cpp","version":1,"text":"void foo() { char* p = 0; }"}}}
Index: clang-tools-extra/clangd/ClangdServer.h
===================================================================
--- clang-tools-extra/clangd/ClangdServer.h
+++ clang-tools-extra/clangd/ClangdServer.h
@@ -140,6 +140,9 @@
/// Enable semantic highlighting features.
bool SemanticHighlighting = false;
+
+ /// Disable tweaks for testing purposes
+ bool DisableTweaks = false;
};
// Sensible default options for use in tests.
// Features like indexing must be enabled if desired.
@@ -313,6 +316,7 @@
// can be caused by missing includes (e.g. member access in incomplete type).
bool SuggestMissingIncludes = false;
bool EnableHiddenFeatures = false;
+ bool DisableTweaks = false;
// GUARDED_BY(CachedCompletionFuzzyFindRequestMutex)
llvm::StringMap<llvm::Optional<FuzzyFindRequest>>
Index: clang-tools-extra/clangd/ClangdServer.cpp
===================================================================
--- clang-tools-extra/clangd/ClangdServer.cpp
+++ clang-tools-extra/clangd/ClangdServer.cpp
@@ -102,6 +102,7 @@
GetClangTidyOptions(Opts.GetClangTidyOptions),
SuggestMissingIncludes(Opts.SuggestMissingIncludes),
EnableHiddenFeatures(Opts.HiddenFeatures),
+ DisableTweaks(Opts.DisableTweaks),
WorkspaceRoot(Opts.WorkspaceRoot),
// Pass a callback into `WorkScheduler` to extract symbols from a newly
// parsed file and rebuild the file index synchronously each time an AST
@@ -333,7 +334,7 @@
return CB(Selection.takeError());
std::vector<TweakRef> Res;
for (auto &T : prepareTweaks(*Selection)) {
- if (T->hidden() && !EnableHiddenFeatures)
+ if (DisableTweaks || (T->hidden() && !EnableHiddenFeatures))
continue;
Res.push_back({T->id(), T->title(), T->intent()});
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63989.207268.patch
Type: text/x-patch
Size: 3632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190701/3ad32af8/attachment-0001.bin>
More information about the cfe-commits
mailing list