clang-tools 23.0.0git
UppercaseLiteralSuffixCheck.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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_READABILITY_UPPERCASELITERALSUFFIXCHECK_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_UPPERCASELITERALSUFFIXCHECK_H
11
12#include "../ClangTidyCheck.h"
13
15
16/// Detects when the integral literal or floating point literal has
17/// non-uppercase suffix, and suggests to make the suffix uppercase.
18/// Alternatively, a list of destination suffixes can be provided.
19///
20/// For the user-facing documentation see:
21/// https://clang.llvm.org/extra/clang-tidy/checks/readability/uppercase-literal-suffix.html
23public:
24 UppercaseLiteralSuffixCheck(StringRef Name, ClangTidyContext *Context);
25 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
26 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
27 void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
28 std::optional<TraversalKind> getCheckTraversalKind() const override {
29 return TK_IgnoreUnlessSpelledInSource;
30 }
31
32private:
33 const std::vector<StringRef> NewSuffixes;
34 const bool IgnoreMacros;
35};
36
37} // namespace clang::tidy::readability
38
39#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_UPPERCASELITERALSUFFIXCHECK_H
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
UppercaseLiteralSuffixCheck(StringRef Name, ClangTidyContext *Context)
std::optional< TraversalKind > getCheckTraversalKind() const override
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
void registerMatchers(ast_matchers::MatchFinder *Finder) override
llvm::StringMap< ClangTidyValue > OptionMap