[all-commits] [llvm/llvm-project] 9e6f88: [clangd] Respect .clang-tidy ExtraArgs (-Wfoo only...

Sam McCall via All-commits all-commits at lists.llvm.org
Mon Jan 3 08:59:05 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9e6f88b31a7f7957a850d3541ffa759f2993ffc1
      https://github.com/llvm/llvm-project/commit/9e6f88b31a7f7957a850d3541ffa759f2993ffc1
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2022-01-03 (Mon, 03 Jan 2022)

  Changed paths:
    M clang-tools-extra/clangd/ParsedAST.cpp
    M clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp

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

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.

Differential Revision: https://reviews.llvm.org/D116147




More information about the All-commits mailing list