This is an archive of the discontinued LLVM Phabricator instance.

[Clangd] Added hidden command line option -tweaks to specify which tweaks to enable
ClosedPublic

Authored by SureYeaah on Jul 1 2019, 5:38 AM.

Event Timeline

SureYeaah created this revision.Jul 1 2019, 5:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 1 2019, 5:38 AM
SureYeaah retitled this revision from Summary: [Clangd] Added hidden flag --disable-tweaks to disable tweaks - Only for testing purposes to Summary: [Clangd] Added hidden flag --disable-tweaks to disable tweaks.Jul 1 2019, 5:44 AM
SureYeaah edited the summary of this revision. (Show Details)
SureYeaah edited the summary of this revision. (Show Details)

This seems somewhat inflexible; how can we use this to test tweaks?

Sorry, hit submit too early...

We could use -tweaks=comma,separated,list and have the ClangdServer::Options member be a function<bool(StringRef)> TweakFilter or so

SureYeaah updated this revision to Diff 207313.Jul 1 2019, 8:01 AM

Replaced the boolean flag with a list of tweaks flag

SureYeaah retitled this revision from Summary: [Clangd] Added hidden flag --disable-tweaks to disable tweaks to [Clangd] Added hidden command line option -tweaks to specify which tweaks to enable.Jul 1 2019, 8:02 AM
SureYeaah edited the summary of this revision. (Show Details)
SureYeaah updated this revision to Diff 207321.Jul 1 2019, 8:13 AM

Removed extra comment

SureYeaah updated this revision to Diff 207323.Jul 1 2019, 8:15 AM

Whitespace formatting

sammccall accepted this revision.Jul 1 2019, 8:39 AM
sammccall added inline comments.
clang-tools-extra/clangd/ClangdServer.h
145

ClangdServer::Options needs to be default-constructible with sensible default options.

Can you either inline-initialize this = [](llvm::StringRef) { return true; } (if possible), or have the code handle TweakFilter==nullptr as accepting anything?

clang-tools-extra/clangd/tool/ClangdMain.cpp
541

it would be clearer to set this only if TweakList.getNumOccurrences(), rather than using it inside the lambda, I think

543

return llvm::find(TweakList, TweakToSearch) != TweakList.end() ?

This revision is now accepted and ready to land.Jul 1 2019, 8:39 AM
SureYeaah updated this revision to Diff 207358.Jul 1 2019, 9:37 AM
SureYeaah marked 3 inline comments as done.

Refactored code

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 1 2019, 9:55 AM