[PATCH] D97415: [clang-tidy] Move Checkname out of Diagnostic Message

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 25 05:51:30 PST 2021


njames93 created this revision.
njames93 added reviewers: alexfh, aaron.ballman.
Herald added subscribers: usaxena95, kadircet, arphaman, xazax.hun.
njames93 published this revision for review.
njames93 added a subscriber: NoQ.
njames93 added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

@NoQ This may have a little impact on D95403 <https://reviews.llvm.org/D95403>, but from what I can see nothing mayor would conflict. It was fairly easy to fix up clang d integration.



================
Comment at: clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp:170-171
+  auto Res = DiagEngine->Report(Loc, ID);
+  // Repurpse the Flag value to store the check name. clang-tidy checks don't
+  // have command line flags so this field is safe ro use, but add a prefix just
+  // to be sure.
----------------



Repurpose the FlagValue field in DiagnosticEngine to store the Checkname.
This removes the need to remove the checkname from the message when we process the diagnostic later.

I looked at a few options and FlagValue seems the simplest way to implement this.
Its only ever read when there is a warning option for the given DiagnosticID, which will never happen for clang-tidy checks.

Removing the Checkname is also a necessary first step if we ever want to support tablegen diagnostics route for clang-tidy.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97415

Files:
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.h
  clang-tools-extra/clangd/Diagnostics.cpp
  clang-tools-extra/clangd/ParsedAST.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97415.326196.patch
Type: text/x-patch
Size: 11761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210225/3c9d6c01/attachment.bin>


More information about the cfe-commits mailing list