[clangd] Re-enable clang-tidy's nolint blocks

The previous inefficient implementation is polished.

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D119701
This commit is contained in:
Haojian Wu 2022-03-17 13:48:47 +01:00
parent f66d3758bd
commit eb265e3ba2
2 changed files with 3 additions and 4 deletions

View file

@ -467,7 +467,7 @@ ParsedAST::build(llvm::StringRef Filename, const ParseInputs &Inputs,
if (IsInsideMainFile && CTContext->shouldSuppressDiagnostic(
DiagLevel, Info, TidySuppressedErrors,
/*AllowIO=*/false,
/*EnableNolintBlocks=*/false)) {
/*EnableNolintBlocks=*/true)) {
// FIXME: should we expose the suppression error (invalid use of
// NOLINT comments)?
return DiagnosticsEngine::Ignored;

View file

@ -477,9 +477,8 @@ TEST(DiagnosticTest, ClangTidySuppressionComment) {
#define BAD2 BAD
double h = BAD2; // NOLINT
// NOLINTBEGIN
// FIXME: re-enable when NOLINTBEGIN suppresss block is enabled in clangd.
// double x = BAD2;
// double y = BAD2;
double x = BAD2;
double y = BAD2;
// NOLINTEND
// verify no crashes on unmatched nolints.