Skip to content

Commit 43aff62

Browse files
committed
fmt'
1 parent cc9249d commit 43aff62

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

clang-tools-extra/clang-tidy/readability/UseCppStyleCommentsCheck.cpp

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ class UseCppStyleCommentsCheck::CStyleCommentHandler : public CommentHandler {
8686
"//" + Line.str()));
8787
}
8888

89-
if (NewlinePos == StringRef::npos) {
89+
if (NewlinePos == StringRef::npos)
9090
break;
91-
}
91+
9292
CommentText = CommentText.substr(NewlinePos + 1);
9393
LineNo++;
9494
}
@@ -108,9 +108,9 @@ class UseCppStyleCommentsCheck::CStyleCommentHandler : public CommentHandler {
108108
CommentEnd = Range.getEnd();
109109
const std::optional<Token> NextTok =
110110
Lexer::findNextToken(CommentStart, SM, PP.getLangOpts());
111-
if (!NextTok.has_value()) {
111+
if (!NextTok.has_value())
112112
return false;
113-
}
113+
114114
const std::string tokenSpelling =
115115
Lexer::getSpelling(*NextTok, SM, PP.getLangOpts());
116116
const unsigned lineNo = SM.getSpellingLineNumber(CommentEnd);
@@ -122,9 +122,8 @@ class UseCppStyleCommentsCheck::CStyleCommentHandler : public CommentHandler {
122122
bool HandleComment(Preprocessor &PP, SourceRange Range) override {
123123
const SourceManager &SM = PP.getSourceManager();
124124

125-
if (Range.getBegin().isMacroID() || SM.isInSystemHeader(Range.getBegin())) {
125+
if (Range.getBegin().isMacroID() || SM.isInSystemHeader(Range.getBegin()))
126126
return false;
127-
}
128127

129128
const StringRef Text = Lexer::getSourceText(
130129
CharSourceRange::getCharRange(Range), SM, PP.getLangOpts());
@@ -135,18 +134,15 @@ class UseCppStyleCommentsCheck::CStyleCommentHandler : public CommentHandler {
135134
} else if (ExcludedCommentMatch.match(Text)) {
136135
return false;
137136
}
138-
if (ExcludeDoxygen && isDoxygenStyleComment(Text)) {
137+
if (ExcludeDoxygen && isDoxygenStyleComment(Text))
139138
return false;
140-
}
141139

142140
SmallVector<StringRef> Matches;
143-
if (!CStyleCommentMatch.match(Text, &Matches)) {
141+
if (!CStyleCommentMatch.match(Text, &Matches))
144142
return false;
145-
}
146143

147-
if (CheckForCodeAfterComment(PP, Range)) {
144+
if (CheckForCodeAfterComment(PP, Range))
148145
return false;
149-
}
150146

151147
SmallVector<FixItHint, 4> FixIts;
152148
convertToCppStyleCommentFixes(SM, Range, FixIts);
@@ -155,9 +151,8 @@ class UseCppStyleCommentsCheck::CStyleCommentHandler : public CommentHandler {
155151
Range.getBegin(),
156152
"use C++ style comments '//' instead of C style comments '/*...*/'");
157153

158-
for (const auto &Fix : FixIts) {
154+
for (const auto &Fix : FixIts)
159155
D << Fix;
160-
}
161156

162157
return false;
163158
}

clang-tools-extra/clang-tidy/readability/UseCppStyleCommentsCheck.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ class UseCppStyleCommentsCheck : public ClangTidyCheck {
2121
public:
2222
UseCppStyleCommentsCheck(StringRef Name, ClangTidyContext *Context);
2323

24-
~UseCppStyleCommentsCheck() override;
25-
2624
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
2725
return LangOpts.CPlusPlus;
2826
}

clang-tools-extra/docs/clang-tidy/checks/readability/use-cpp-style-comments.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,5 @@ Options
5353
.. option:: ExcludedComments
5454

5555
A regex pattern that allows specifying certain comments to exclude from transformation.
56-
By default, this option is set to "^$", which means no comments are excluded.
56+
By default, this option is set to `^$`, which means no comments are excluded.
5757
You can provide a custom regex to exclude specific comments based on your needs.

0 commit comments

Comments
 (0)