llvm-project/clang/unittests
Haojian Wu f2879d8a48 [clang-tidy] Add fix descriptions to clang-tidy checks.
Summary:
Motivation/Context: in the code review system integrating with clang-tidy,
clang-tidy doesn't provide a human-readable description of the fix. Usually
developers have to preview a code diff (before vs after apply the fix) to
understand what the fix does before applying a fix.

This patch proposes that each clang-tidy check provides a short and
actional fix description that can be shown in the UI, so that users can know
what the fix does without previewing diff.

This patch extends clang-tidy framework to support fix descriptions (will add implementations for
existing checks in the future). Fix descriptions and fixes are emitted via diagnostic::Note (rather than
attaching the main warning diagnostic).

Before this patch:

```
void MyCheck::check(...) {
   ...
   diag(loc, "my check warning") <<  FixtItHint::CreateReplacement(...);
}
```

After:

```
void MyCheck::check(...) {
   ...
   diag(loc, "my check warning"); // Emit a check warning
   diag(loc, "fix description", DiagnosticIDs::Note) << FixtItHint::CreateReplacement(...); // Emit a diagnostic note and a fix
}
```

Reviewers: sammccall, alexfh

Reviewed By: alexfh

Subscribers: MyDeveloperDay, Eugene.Zelenko, aaron.ballman, JonasToth, xazax.hun, jdoerfert, cfe-commits

Tags: #clang-tools-extra, #clang

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

llvm-svn: 358576
2019-04-17 12:53:59 +00:00
..
AST Changed every use of ASTImporter::Import to Import_New 2019-04-08 13:59:15 +00:00
ASTMatchers [clang][OpenMP] Fix another test when using libgomp. 2019-03-21 19:13:22 +00:00
Analysis Fix some clang analysis tests passing arguments incorrectly 2019-03-07 18:57:04 +00:00
Basic [FileSystemStatCache] Update test for new FileSystemStatCache API 2019-04-16 18:00:43 +00:00
CodeGen Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CrossTU Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Driver Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Format [clang-format] Fix -Wconversion-null warning in GCC 2019-04-15 20:13:20 +00:00
Frontend Modules: Add LangOptions::CacheGeneratedPCH 2019-03-12 18:38:04 +00:00
Index [clang][Index] Fix msan failure 2019-03-08 10:18:40 +00:00
Lex Revert "[Lexer] NFC: Fix an off-by-one bug in getAsCharRange()." 2019-04-05 22:11:28 +00:00
Rename Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Rewrite Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Sema [CodeComplete] Propagate preferred type for function arguments in more cases 2019-02-26 11:01:50 +00:00
Serialization Stop relying on allocator behaviour in modules unit test 2019-03-09 20:15:01 +00:00
StaticAnalyzer [analyzer] Enable subcheckers to possess checker options 2019-03-04 00:28:16 +00:00
Tooling [clang-tidy] Add fix descriptions to clang-tidy checks. 2019-04-17 12:53:59 +00:00
libclang Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CMakeLists.txt Modules: Rename MemoryBufferCache to InMemoryModuleCache 2019-03-09 17:33:56 +00:00