[clang-tools-extra] 50320ec - [NFC][clang-tidy] reword diagnostic note in definitions-in-headers (#106862)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 17 01:42:26 PDT 2024
Author: Julian Schmidt
Date: 2024-09-17T10:42:23+02:00
New Revision: 50320ec967a2c6546e53998225dddb76c4016dc5
URL: https://github.com/llvm/llvm-project/commit/50320ec967a2c6546e53998225dddb76c4016dc5
DIFF: https://github.com/llvm/llvm-project/commit/50320ec967a2c6546e53998225dddb76c4016dc5.diff
LOG: [NFC][clang-tidy] reword diagnostic note in definitions-in-headers (#106862)
`make as inline` made little sense here, so I changed the `make` to
`mark`
and added `the definition` as well.
Added:
Modified:
clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/test/clang-tidy/checkers/misc/definitions-in-headers.hpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp b/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
index 21008bc144b91a..ee869256898989 100644
--- a/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
@@ -102,7 +102,7 @@ void DefinitionsInHeadersCheck::check(const MatchFinder::MatchResult &Result) {
// inline is not allowed for main function.
if (FD->isMain())
return;
- diag(FD->getLocation(), /*Description=*/"make as 'inline'",
+ diag(FD->getLocation(), "mark the definition as 'inline'",
DiagnosticIDs::Note)
<< FixItHint::CreateInsertion(FD->getInnerLocStart(), "inline ");
} else if (const auto *VD = dyn_cast<VarDecl>(ND)) {
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 465c333efdf38e..c297ed88ece0a2 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -124,6 +124,10 @@ Changes in existing checks
false positive when member initialization depends on a structured binging
variable.
+- Improved :doc:`misc-definitions-in-headers
+ <clang-tidy/checks/misc/definitions-in-headers>` check by rewording the
+ diagnostic note that suggests adding ``inline``.
+
- Improved :doc:`modernize-use-std-format
<clang-tidy/checks/modernize/use-std-format>` check to support replacing
member function calls too.
diff --git a/clang-tools-extra/test/clang-tidy/checkers/misc/definitions-in-headers.hpp b/clang-tools-extra/test/clang-tidy/checkers/misc/definitions-in-headers.hpp
index 4cf07077a230a5..9c91cb7033087d 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/misc/definitions-in-headers.hpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/misc/definitions-in-headers.hpp
@@ -2,7 +2,7 @@
int f() {
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: function 'f' defined in a header file; function definitions in header files can lead to ODR violations [misc-definitions-in-headers]
-// CHECK-MESSAGES: :[[@LINE-2]]:5: note: make as 'inline'
+// CHECK-MESSAGES: :[[@LINE-2]]:5: note: mark the definition as 'inline'
// CHECK-FIXES: inline int f() {
return 1;
}
More information about the cfe-commits
mailing list