This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Respect .clang-tidy ExtraArgs (-Wfoo only) when producing diagnostics
ClosedPublic

Authored by sammccall on Dec 22 2021, 2:08 AM.

Details

Summary

This mechanism is used almost exclusively to enable extra warnings in clang-tidy
using ExtraArgs=-Wfoo, Checks="clang-diagnostic-foo".
Its presence is a strong signal that these flags are useful.

We choose not to actually emit them as clang-tidy diagnostics, but under their
"main" name - this ensures we show the same diagnostic in a consistent way.

We don't add the ExtraArgs to the compile command in general, but rather just
handle the -W<group> flags, which is the common case and avoids unexpected
side-effects.
And we only do this for the main file parse, when producing diagnostics.

Diff Detail

Event Timeline

sammccall created this revision.Dec 22 2021, 2:08 AM
sammccall requested review of this revision.Dec 22 2021, 2:08 AM
sammccall planned changes to this revision.Dec 22 2021, 2:21 AM

Actually we should probably handle -Wno-<group> too.

sammccall updated this revision to Diff 395858.Dec 22 2021, 6:18 AM

Also handle -Wno-<group> flags

kadircet accepted this revision.Jan 3 2022, 7:35 AM

thanks, lgtm!

clang-tools-extra/clangd/ParsedAST.cpp
270

why do we need a set here, rather than a flag?

This revision is now accepted and ready to land.Jan 3 2022, 7:35 AM