================ @@ -0,0 +1,161 @@ +//===--- UseBuiltinLiteralsCheck.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 "UseBuiltinLiteralsCheck.h" +#include "clang/AST/ASTContext.h" +#include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/Lex/Lexer.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" +#include <optional> + +using namespace clang::ast_matchers; + +namespace clang::tidy::readability { + +namespace { + +using RuleOnStd = bool (*)(const LangStandard &LS); + +struct Replacement { + Replacement(StringRef Seq, const RuleOnStd Std = nullptr) + : Seq(Seq), Std(Std) {} + bool operator()(const LangOptions &LO) const { + return Std ? Std(LangStandard::getLangStandardForKind(LO.LangStd)) : true; + } + StringRef Seq; + RuleOnStd Std; +}; + +} // namespace + +static const llvm::Regex CharRegex("^(u8|u|U|L)?"); +static const llvm::StringMap<Replacement> CharPrefix({ + {"char", {""}}, + {"char8_t", {"u8"}}, + {"char16_t", {"u"}}, + {"char32_t", {"U"}}, ---------------- PiotrZSL wrote:
Missing check for C++17. https://github.com/llvm/llvm-project/pull/76065 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits