Skip to content

Commit 50320ec

Browse files
authored
[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.
1 parent 6357781 commit 50320ec

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void DefinitionsInHeadersCheck::check(const MatchFinder::MatchResult &Result) {
102102
// inline is not allowed for main function.
103103
if (FD->isMain())
104104
return;
105-
diag(FD->getLocation(), /*Description=*/"make as 'inline'",
105+
diag(FD->getLocation(), "mark the definition as 'inline'",
106106
DiagnosticIDs::Note)
107107
<< FixItHint::CreateInsertion(FD->getInnerLocStart(), "inline ");
108108
} else if (const auto *VD = dyn_cast<VarDecl>(ND)) {

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ Changes in existing checks
124124
false positive when member initialization depends on a structured binging
125125
variable.
126126

127+
- Improved :doc:`misc-definitions-in-headers
128+
<clang-tidy/checks/misc/definitions-in-headers>` check by rewording the
129+
diagnostic note that suggests adding ``inline``.
130+
127131
- Improved :doc:`modernize-use-std-format
128132
<clang-tidy/checks/modernize/use-std-format>` check to support replacing
129133
member function calls too.

clang-tools-extra/test/clang-tidy/checkers/misc/definitions-in-headers.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
int f() {
44
// 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]
5-
// CHECK-MESSAGES: :[[@LINE-2]]:5: note: make as 'inline'
5+
// CHECK-MESSAGES: :[[@LINE-2]]:5: note: mark the definition as 'inline'
66
// CHECK-FIXES: inline int f() {
77
return 1;
88
}

0 commit comments

Comments
 (0)