clang-tools  14.0.0git
CleanupCtadCheck.h
Go to the documentation of this file.
1 //===--- CleanupCtadCheck.h - clang-tidy ------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_CLEANUPCTADCHECK_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_CLEANUPCTADCHECK_H
11 
12 #include "../utils/TransformerClangTidyCheck.h"
13 
14 namespace clang {
15 namespace tidy {
16 namespace abseil {
17 
18 /// Suggests switching the initialization pattern of `absl::Cleanup`
19 /// instances from the factory function to class template argument
20 /// deduction (CTAD), in C++17 and higher.
21 ///
22 /// For the user-facing documentation see:
23 /// http://clang.llvm.org/extra/clang-tidy/checks/abseil-cleanup-ctad.html
25 public:
26  CleanupCtadCheck(StringRef Name, ClangTidyContext *Context);
27 
28  bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
29  return LangOpts.CPlusPlus17;
30  }
31 };
32 
33 } // namespace abseil
34 } // namespace tidy
35 } // namespace clang
36 
37 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_CLEANUPCTADCHECK_H
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition: ClangTidyDiagnosticConsumer.h:73
Name
static constexpr llvm::StringLiteral Name
Definition: UppercaseLiteralSuffixCheck.cpp:28
clang::tidy::utils::TransformerClangTidyCheck
A base class for defining a ClangTidy check based on a RewriteRule.
Definition: TransformerClangTidyCheck.h:39
clang::tidy::abseil::CleanupCtadCheck::CleanupCtadCheck
CleanupCtadCheck(StringRef Name, ClangTidyContext *Context)
Definition: CleanupCtadCheck.cpp:42
clang::tidy::abseil::CleanupCtadCheck
Suggests switching the initialization pattern of absl::Cleanup instances from the factory function to...
Definition: CleanupCtadCheck.h:24
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
clang::tidy::abseil::CleanupCtadCheck::isLanguageVersionSupported
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override
Override this to disable registering matchers and PP callbacks if an invalid language version is bein...
Definition: CleanupCtadCheck.h:28