clang-tools 20.0.0git
|
Convert a printf-style format string to a std::formatter-style one, and prepare any casts that are required to wrap the arguments to retain printf compatibility. More...
#include <FormatStringConverter.h>
Classes | |
struct | Configuration |
Public Types | |
using | ConversionSpecifier = clang::analyze_format_string::ConversionSpecifier |
using | PrintfSpecifier = analyze_printf::PrintfSpecifier |
Public Member Functions | |
FormatStringConverter (ASTContext *Context, const CallExpr *Call, unsigned FormatArgOffset, Configuration Config, const LangOptions &LO, SourceManager &SM, Preprocessor &PP) | |
bool | canApply () const |
const std::string & | conversionNotPossibleReason () const |
void | applyFixes (DiagnosticBuilder &Diag, SourceManager &SM) |
Called by the check when it is ready to apply the fixes. | |
bool | usePrintNewlineFunction () const |
Convert a printf-style format string to a std::formatter-style one, and prepare any casts that are required to wrap the arguments to retain printf compatibility.
This class is expecting to work on the already-cooked format string (i.e. all the escapes have been converted) so we have to convert them back. This means that we might not convert them back using the same form.
Definition at line 30 of file FormatStringConverter.h.
using clang::tidy::utils::FormatStringConverter::ConversionSpecifier = clang::analyze_format_string::ConversionSpecifier |
Definition at line 33 of file FormatStringConverter.h.
using clang::tidy::utils::FormatStringConverter::PrintfSpecifier = analyze_printf::PrintfSpecifier |
Definition at line 34 of file FormatStringConverter.h.
clang::tidy::utils::FormatStringConverter::FormatStringConverter | ( | ASTContext * | Context, |
const CallExpr * | Call, | ||
unsigned | FormatArgOffset, | ||
Configuration | Config, | ||
const LangOptions & | LO, | ||
SourceManager & | SM, | ||
Preprocessor & | PP | ||
) |
Definition at line 199 of file FormatStringConverter.cpp.
void clang::tidy::utils::FormatStringConverter::applyFixes | ( | DiagnosticBuilder & | Diag, |
SourceManager & | SM | ||
) |
Called by the check when it is ready to apply the fixes.
Definition at line 749 of file FormatStringConverter.cpp.
References Offset, and clang::tidy::utils::withoutCStrReplacement().
Referenced by clang::tidy::modernize::UseStdFormatCheck::check(), and clang::tidy::modernize::UseStdPrintCheck::check().
|
inline |
Definition at line 46 of file FormatStringConverter.h.
Referenced by clang::tidy::modernize::UseStdFormatCheck::check(), and clang::tidy::modernize::UseStdPrintCheck::check().
|
inline |
Definition at line 47 of file FormatStringConverter.h.
Referenced by clang::tidy::modernize::UseStdFormatCheck::check(), and clang::tidy::modernize::UseStdPrintCheck::check().
|
inline |
Definition at line 51 of file FormatStringConverter.h.
Referenced by clang::tidy::modernize::UseStdPrintCheck::check().