-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[clang-tidy] Replace /* ... */ single-line comments with // ... comments #124319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-clang-tidy @llvm/pr-subscribers-clang-tools-extra Author: None (4m4n-x-B4w4ne) ChangesThis Pull Request is to fix issue #24841. Full diff: https://github.com/llvm/llvm-project/pull/124319.diff 7 Files Affected:
diff --git a/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt b/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
index bab1167fb15ff2..f07dd5efecc58e 100644
--- a/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
+++ b/clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
@@ -31,6 +31,7 @@ add_clang_library(clangTidyModernizeModule STATIC
UseAutoCheck.cpp
UseBoolLiteralsCheck.cpp
UseConstraintsCheck.cpp
+ UseCppStyleCommentsCheck.cpp
UseDefaultMemberInitCheck.cpp
UseDesignatedInitializersCheck.cpp
UseEmplaceCheck.cpp
diff --git a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
index fc46c72982fdce..1917d562f7ce8d 100644
--- a/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
@@ -32,6 +32,7 @@
#include "UseAutoCheck.h"
#include "UseBoolLiteralsCheck.h"
#include "UseConstraintsCheck.h"
+#include "UseCppStyleCommentsCheck.h"
#include "UseDefaultMemberInitCheck.h"
#include "UseDesignatedInitializersCheck.h"
#include "UseEmplaceCheck.h"
@@ -107,6 +108,8 @@ class ModernizeModule : public ClangTidyModule {
"modernize-use-bool-literals");
CheckFactories.registerCheck<UseConstraintsCheck>(
"modernize-use-constraints");
+ CheckFactories.registerCheck<UseCppStyleCommentsCheck>(
+ "modernize-use-cpp-style-comments");
CheckFactories.registerCheck<UseDefaultMemberInitCheck>(
"modernize-use-default-member-init");
CheckFactories.registerCheck<UseEmplaceCheck>("modernize-use-emplace");
diff --git a/clang-tools-extra/clang-tidy/modernize/UseCppStyleCommentsCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseCppStyleCommentsCheck.cpp
new file mode 100644
index 00000000000000..3c25c50bab759c
--- /dev/null
+++ b/clang-tools-extra/clang-tidy/modernize/UseCppStyleCommentsCheck.cpp
@@ -0,0 +1,126 @@
+//===--- UseCppStyleCommentsCheck.cpp - clang-tidy-------------------------===//
+
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "UseCppStyleCommentsCheck.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Lex/Lexer.h"
+#include "clang/Lex/Preprocessor.h"
+#include <iostream>
+using namespace clang::ast_matchers;
+
+namespace clang::tidy::modernize {
+class UseCppStyleCommentsCheck::CStyleCommentHandler : public CommentHandler {
+public:
+ CStyleCommentHandler(UseCppStyleCommentsCheck &Check)
+ : Check(Check),
+ CStyleCommentMatch(
+ "^[ \t]*/\\*+[ \t\r\n]*(.*[ \t\r\n]*)*[ \t\r\n]*\\*+/[ \t\r\n]*$"){}
+
+ std::string convertToCppStyleComment(const SourceManager &SM, const SourceRange &Range) {
+ StringRef CommentText = Lexer::getSourceText(
+ CharSourceRange::getTokenRange(Range), SM, LangOptions());
+
+ std::string InnerText = CommentText.str();
+ InnerText.erase(0, 2);
+ InnerText.erase(InnerText.size() - 2, 2);
+
+ std::string Result;
+ std::istringstream Stream(InnerText);
+ std::string Line;
+
+ if (std::getline(Stream, Line)) {
+ size_t startPos = Line.find_first_not_of(" \t");
+ if (startPos != std::string::npos) {
+ Line = Line.substr(startPos);
+ } else {
+ Line.clear();
+ }
+ Result += "// " + Line;
+ }
+
+ while (std::getline(Stream, Line)) {
+ size_t startPos = Line.find_first_not_of(" \t");
+ if (startPos != std::string::npos) {
+ Line = Line.substr(startPos);
+ } else {
+ Line.clear();
+ }
+ Result += "\n// " + Line;
+ }
+ return Result;
+ }
+
+ bool HandleComment(Preprocessor &PP, SourceRange Range) override {
+ const SourceManager &SM = PP.getSourceManager();
+
+ if (Range.getBegin().isMacroID() ||
+ SM.isInSystemHeader(Range.getBegin())) {
+ return false;
+ }
+
+ const StringRef Text =
+ Lexer::getSourceText(CharSourceRange::getCharRange(Range),
+ SM, PP.getLangOpts());
+
+ SmallVector<StringRef> Matches;
+ if (!CStyleCommentMatch.match(Text, &Matches)) {
+ return false;
+ }
+
+ SourceLocation CommentStart = Range.getBegin();
+ SourceLocation CommentEnd = Range.getEnd();
+
+ unsigned StartLine = SM.getSpellingLineNumber(CommentStart);
+ unsigned EndLine = SM.getSpellingLineNumber(CommentEnd);
+
+
+ if (StartLine == EndLine) {
+ SourceLocation LineBegin = SM.translateLineCol(
+ SM.getFileID(CommentStart), StartLine, 1);
+ SourceLocation LineEnd = SM.translateLineCol(SM.getFileID(CommentEnd), EndLine, std::numeric_limits<unsigned>::max());
+ StringRef LineContent =
+ Lexer::getSourceText(CharSourceRange::getCharRange(LineBegin, LineEnd),
+ SM, PP.getLangOpts());
+ size_t CommentStartOffset = SM.getSpellingColumnNumber(CommentStart) - 1;
+ StringRef AfterComment = LineContent.drop_front(CommentStartOffset + Text.size());
+
+ if (!AfterComment.trim().empty()) {
+ return false;
+ }
+ }
+
+ Check.diag(
+ Range.getBegin(),
+ "use C++ style comments '//' instead of C style comments '/*...*/'")
+ << clang::FixItHint::CreateReplacement(
+ Range, convertToCppStyleComment(SM, Range));
+
+ return false;
+}
+
+
+private:
+ UseCppStyleCommentsCheck &Check;
+ llvm::Regex CStyleCommentMatch;
+};
+
+UseCppStyleCommentsCheck::UseCppStyleCommentsCheck(StringRef Name,
+ ClangTidyContext *Context)
+ : ClangTidyCheck(Name, Context),
+ Handler(std::make_unique<CStyleCommentHandler>(*this)) {}
+
+void UseCppStyleCommentsCheck::registerPPCallbacks(
+ const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) {
+ PP->addCommentHandler(Handler.get());
+}
+
+void UseCppStyleCommentsCheck::check(const MatchFinder::MatchResult &Result) {}
+
+UseCppStyleCommentsCheck::~UseCppStyleCommentsCheck() = default;
+} // namespace clang::tidy::modernize
diff --git a/clang-tools-extra/clang-tidy/modernize/UseCppStyleCommentsCheck.h b/clang-tools-extra/clang-tidy/modernize/UseCppStyleCommentsCheck.h
new file mode 100644
index 00000000000000..3d604683de5a24
--- /dev/null
+++ b/clang-tools-extra/clang-tidy/modernize/UseCppStyleCommentsCheck.h
@@ -0,0 +1,40 @@
+//===--- UseCppStyleCommentsCheck.h - clang-tidy---------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_CPP_STYLE_COMMENTS_CHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_CPP_STYLE_COMMENTS_CHECK_H
+
+#include "../ClangTidyCheck.h"
+#include <sstream>
+namespace clang::tidy::modernize {
+/// Detects C Style comments and suggests to use C++ style comments instead.
+///
+/// For the user-facing documentation see:
+/// http://clang.llvm.org/extra/clang-tidy/checks/modernize/use-cpp-style-comments.html
+class UseCppStyleCommentsCheck : public ClangTidyCheck {
+public:
+ UseCppStyleCommentsCheck(StringRef Name, ClangTidyContext *Context);
+
+ ~UseCppStyleCommentsCheck() override;
+
+ bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
+ return LangOpts.CPlusPlus;
+ }
+
+ void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
+ Preprocessor *ModuleExpanderPP) override;
+
+ void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+
+private:
+ class CStyleCommentHandler;
+ std::unique_ptr<CStyleCommentHandler> Handler;
+};
+} // namespace clang::tidy::modernize
+
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_CPP_STYLE_COMMENTS_CHECK_H
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index cc5f64a3f9fa32..a89cd1a8b80e50 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -173,6 +173,11 @@ New checks
Replace comparisons between signed and unsigned integers with their safe
C++20 ``std::cmp_*`` alternative, if available.
+
+- New :doc:`modernize-use-cpp-style-comments
+ <clang-tidy/checks/modernize/use-cpp-style-comments>` check.
+
+ Detects C Style comments and suggests to use C++ style comments instead.
- New :doc:`portability-template-virtual-member-function
<clang-tidy/checks/portability/template-virtual-member-function>` check.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-cpp-style-comments.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-cpp-style-comments.rst
new file mode 100644
index 00000000000000..5eaf759a3db6d6
--- /dev/null
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-cpp-style-comments.rst
@@ -0,0 +1,38 @@
+.. title:: clang-tidy - use-cpp-style-comments
+
+modernize-use-cpp-style-comments
+=======================
+
+Replace C-style comments with C++-style comments.
+C-style comments (`/* ... */`) are inherited from C, while C++ introduces
+`//` as a more concise, readable, and less error-prone alternative. Modern C++
+guidelines recommend using C++-style comments for consistency and
+maintainability. This check identifies and replaces C-style comments with
+equivalent C++-style comments.
+
+Examples:
+
+Input:
+.. code-block::c++
+ /* This is a single-line comment */
+ int x = 42; /* Inline comment */
+
+ /* This is a
+ multi-line comment */
+
+
+Output:
+.. code-block::c++
+ // This is a single-line comment
+ int x = 42; // Inline comment
+
+ // This is a
+ // multi-line comment
+
+.. note::
+
+ Inline Comments are neither fixed nor warned.
+ Example:
+ .. code-block:: c++
+ int a = /* this is a comment */ 5;
+
diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-cpp-style-comments.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-cpp-style-comments.cpp
new file mode 100644
index 00000000000000..f56750591e035f
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-cpp-style-comments.cpp
@@ -0,0 +1,68 @@
+// RUN: %check_clang_tidy -std=c++11 %s modernize-use-cpp-style-comments %t -- --
+
+// Single-line full C-style comment
+static const int CONSTANT = 42; /* Important constant value */
+// CHECK-MESSAGES: :[[@LINE-1]]:33: warning: use C++ style comments '//' instead of C style comments '/*...*/' [modernize-use-cpp-style-comments]
+// CHECK-FIXES: static const int CONSTANT = 42; // Important constant value
+
+// Inline comment that should NOT be transformed
+int a = /* inline comment */ 5;
+
+// Multiline full-line comment
+/* This is a multiline comment
+ that spans several lines
+ and should be converted to C++ style */
+// CHECK-MESSAGES: :[[@LINE-3]]:1: warning: use C++ style comments '//' instead of C style comments '/*...*/' [modernize-use-cpp-style-comments]
+// CHECK-FIXES: // This is a multiline comment
+// CHECK-FIXES: // that spans several lines
+// CHECK-FIXES: // and should be converted to C++ style
+void fnWithSomeBools(bool A,bool B) {}
+// Function with parameter inline comments
+void processData(int data /* input data */,
+ bool validate /* perform validation */) {
+ // These inline comments should NOT be transformed
+ fnWithSomeBools(/*ControlsA=*/ true, /*ControlsB=*/ false);
+}
+
+// Multiline comment with asterisk styling
+/*******************************
+ * Block comment with asterisks
+ * Should be converted to C++ style
+ *******************************/
+// CHECK-MESSAGES: :[[@LINE-4]]:1: warning: use C++ style comments '//' instead of C style comments '/*...*/' [modernize-use-cpp-style-comments]
+// CHECK-FIXES: // ******************************
+// CHECK-FIXES: // * Block comment with asterisks
+// CHECK-FIXES: // * Should be converted to C++ style
+// CHECK-FIXES: // ******************************
+int calculateSomething() { return 1;}
+// Comment at end of complex line
+int complexCalculation = calculateSomething(); /* Result of complex calculation */
+// CHECK-MESSAGES: :[[@LINE-1]]:48: warning: use C++ style comments '//' instead of C style comments '/*...*/' [modernize-use-cpp-style-comments]
+// CHECK-FIXES: int complexCalculation = calculateSomething(); // Result of complex calculation
+
+// Nested comments and edge cases
+void edgeCaseFunction() {
+ int x = 10 /* First value */ + 20 /* Second value */; // Inline comments should not transform
+
+ /* Comment with special characters !@#$%^&*()_+ */
+ // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use C++ style comments '//' instead of C style comments '/*...*/' [modernize-use-cpp-style-comments]
+ // CHECK-FIXES: // Comment with special characters !@#$%^&*()_+
+}
+
+// Multiline comment with various indentations
+ /* This comment is indented
+ and should preserve indentation when converted */
+// CHECK-MESSAGES: :[[@LINE-2]]:5: warning: use C++ style comments '//' instead of C style comments '/*...*/' [modernize-use-cpp-style-comments]
+// CHECK-FIXES: // This comment is indented
+// CHECK-FIXES: // and should preserve indentation when converted
+
+// Complex function with mixed comment types
+void complexFunction() {
+ /* Full line comment at start of block */
+ // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: use C++ style comments '//' instead of C style comments '/*...*/' [modernize-use-cpp-style-comments]
+ // CHECK-FIXES: // Full line comment at start of block
+
+ int x = 10; /* Inline comment not to be transformed */
+ // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: use C++ style comments '//' instead of C style comments '/*...*/' [modernize-use-cpp-style-comments]
+ // CHECK-FIXES: int x = 10; // Inline comment not to be transformed
+}
\ No newline at end of file
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
Thank you for working on this check! |
clang-tools-extra/clang-tidy/modernize/UseCppStyleCommentsCheck.cpp
Outdated
Show resolved
Hide resolved
clang-tools-extra/clang-tidy/modernize/UseCppStyleCommentsCheck.h
Outdated
Show resolved
Hide resolved
clang-tools-extra/clang-tidy/modernize/UseCppStyleCommentsCheck.cpp
Outdated
Show resolved
Hide resolved
clang-tools-extra/clang-tidy/modernize/UseCppStyleCommentsCheck.cpp
Outdated
Show resolved
Hide resolved
clang-tools-extra/clang-tidy/modernize/UseCppStyleCommentsCheck.cpp
Outdated
Show resolved
Hide resolved
} | ||
} | ||
|
||
Check.diag( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add test like
/* aaa
bbbb
ccc */ int a = 1;
It may not be processed correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to ask, but the thing is, how shall I handle this kind of case? The way this code is written looks like a bad Coding practice. Also, If I want to correct it, what will the correct comment-code order be? l
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ignoring this type of comments will be the best option, so I am working on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HerrCai0907 I have done this thing. Can you please verify this?
clang-tools-extra/clang-tidy/modernize/UseCppStyleCommentsCheck.cpp
Outdated
Show resolved
Hide resolved
clang-tools-extra/clang-tidy/modernize/UseCppStyleCommentsCheck.cpp
Outdated
Show resolved
Hide resolved
clang-tools-extra/clang-tidy/modernize/UseCppStyleCommentsCheck.cpp
Outdated
Show resolved
Hide resolved
clang-tools-extra/clang-tidy/modernize/UseCppStyleCommentsCheck.h
Outdated
Show resolved
Hide resolved
clang-tools-extra/docs/clang-tidy/checks/modernize/use-cpp-style-comments.rst
Outdated
Show resolved
Hide resolved
clang-tools-extra/test/clang-tidy/checkers/modernize/use-cpp-style-comments.cpp
Outdated
Show resolved
Hide resolved
clang-tools-extra/docs/clang-tidy/checks/modernize/use-cpp-style-comments.rst
Outdated
Show resolved
Hide resolved
Can anyone please help me? Why is Test Documentation build is failing? I am in no clue. |
Restore clang-tools-extra/clang-tidy/modernize/CMakeLists.txt and clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp as they were before (with no changes to them). |
clang-tools-extra/clang-tidy/readability/UseCppStyleCommentsCheck.cpp
Outdated
Show resolved
Hide resolved
clang-tools-extra/clang-tidy/readability/UseCppStyleCommentsCheck.cpp
Outdated
Show resolved
Hide resolved
clang-tools-extra/docs/clang-tidy/checks/readability/use-cpp-style-comments.rst
Outdated
Show resolved
Hide resolved
clang-tools-extra/docs/clang-tidy/checks/readability/use-cpp-style-comments.rst
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- code formatting (looks sometimes strange)
- check performance (avoid creating new strings, copies)
- few nits
InnerText.erase(InnerText.size() - 2, 2); | ||
|
||
std::string Result; | ||
std::istringstream Stream(InnerText); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid using istringstream , thats heavy to construct due to locales, just split string by '\n or \r'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done Thanks! Can you please Review it?
if (StartPos != std::string::npos) { | ||
Line = Line.substr(StartPos); | ||
} else { | ||
Line.clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid text copy, instead of generate list of "ranges to be replaced" and then generate FixIt for every of them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done Thanks! Can you please Review it?
const SourceLocation LineBegin = | ||
SM.translateLineCol(SM.getFileID(CommentEnd), EndLine, EndCol); | ||
const SourceLocation LineEnd = | ||
SM.translateLineCol(SM.getFileID(CommentEnd), EndLine, | ||
std::numeric_limits<unsigned>::max()); | ||
const StringRef AfterComment = | ||
Lexer::getSourceText(CharSourceRange::getCharRange(LineBegin, LineEnd), | ||
SM, PP.getLangOpts()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe better work on offsets instead of lines/collumns, you could just get next token after comment and check if there is new line character between them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done Thanks! Can you please Review it?
} | ||
|
||
SmallVector<StringRef> Matches; | ||
if (!CStyleCommentMatch.match(Text, &Matches)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add also custom regexp as configuration option and called it ExcludedComents or something, in such case if this match comment, then exclude.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done Thanks! Can you please Review it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PiotrZSL Can you please review it? like and tell me what next to be done.
clang-tools-extra/clang-tidy/readability/UseCppStyleCommentsCheck.cpp
Outdated
Show resolved
Hide resolved
clang-tools-extra/clang-tidy/readability/UseCppStyleCommentsCheck.cpp
Outdated
Show resolved
Hide resolved
clang-tools-extra/test/clang-tidy/checkers/readability/use-cpp-style-comments.cpp
Outdated
Show resolved
Hide resolved
clang-tools-extra/clang-tidy/readability/UseCppStyleCommentsCheck.h
Outdated
Show resolved
Hide resolved
clang-tools-extra/docs/clang-tidy/checks/readability/use-cpp-style-comments.rst
Outdated
Show resolved
Hide resolved
@EugeneZelenko @vbvictor @PiotrZSL @HerrCai0907 Can anyone please guide me further? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nit.
clang-tools-extra/clang-tidy/readability/UseCppStyleCommentsCheck.cpp
Outdated
Show resolved
Hide resolved
public: | ||
UseCppStyleCommentsCheck(StringRef Name, ClangTidyContext *Context); | ||
|
||
~UseCppStyleCommentsCheck() override; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not need to override default destructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The virtual destructor of the UseCppStyleCommentsCheck will need size of class CStyleCommentHandler cause the destructor of unique_ptr Handler will try to destroy class CStyleCommentHandler. This is a issue like due to forward declaration of the member class CStyleCommentHandler.
clang-tools-extra/clang-tidy/readability/UseCppStyleCommentsCheck.cpp
Outdated
Show resolved
Hide resolved
clang-tools-extra/docs/clang-tidy/checks/readability/use-cpp-style-comments.rst
Outdated
Show resolved
Hide resolved
Can anyone please tell me what to be done next? @EugeneZelenko @HerrCai0907 @PiotrZSL |
clang-tools-extra/docs/clang-tidy/checks/readability/use-cpp-style-comments.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: EugeneZelenko <eugene.zelenko@gmail.com>
…tyle-comments.rst Co-authored-by: EugeneZelenko <eugene.zelenko@gmail.com>
If everything looks good, then can it be merged? @PiotrZSL @HerrCai0907 @EugeneZelenko |
Can anyone please guide me for what to be done next? @EugeneZelenko @HerrCai0907 @vbvictor @PiotrZSL |
I think we should wait from re-review from PiotrZSL, then it will be ready to merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with minor docs issues/suggestions.
If there wouldn't be any new reviews in the upcoming month, I think we should merge this check before LLVM21 is released.
clang-tools-extra/docs/clang-tidy/checks/readability/use-cpp-style-comments.rst
Outdated
Show resolved
Hide resolved
clang-tools-extra/docs/clang-tidy/checks/readability/use-cpp-style-comments.rst
Show resolved
Hide resolved
clang-tools-extra/test/clang-tidy/checkers/readability/use-cpp-style-comments.cpp
Outdated
Show resolved
Hide resolved
clang-tools-extra/docs/clang-tidy/checks/readability/use-cpp-style-comments.rst
Show resolved
Hide resolved
…-style-comments.cpp adding support for c++98 or later Co-authored-by: Baranov Victor <bar.victor.2002@gmail.com>
…tyle-comments.rst fmt' Co-authored-by: EugeneZelenko <eugene.zelenko@gmail.com>
Yeah sure! |
Ping @PiotrZSL @carlosgalvezp If you wish to review this check @4m4n-x-B4w4ne, note that tests failed (probably because of c++98..) |
it failed before this c++98orlater commit too. Maybe their is some merges in the meantime that is causing this issue. I am checking it. |
Fixes: #24841.
I have also cherry-picked commit a3c7fca.
@LegalizeAdulthood @PiotrZSL