[clang-tools-extra] [clang-tidy] Replace /* ... */ single-line comments with // ... comments (PR #124319)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 27 09:15:56 PST 2025
================
@@ -0,0 +1,40 @@
+//===--- UseCppStyleCommentsCheck.h - clang-tidy-----------------*- C++ -*-===//
+//
+// 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_READABILITY_USECPPSTYLECOMMENTSCHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_USECPPSTYLECOMMENTSCHECK_H
+
+#include "../ClangTidyCheck.h"
+
+namespace clang::tidy::readability {
+/// 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/readability/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;
----------------
EugeneZelenko wrote:
Please include `memory`.
https://github.com/llvm/llvm-project/pull/124319
More information about the cfe-commits
mailing list