clang-tools 18.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>
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, bool StrictMode, const LangOptions &LO) | |
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, | ||
bool | StrictMode, | ||
const LangOptions & | LO | ||
) |
Definition at line 198 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 688 of file FormatStringConverter.cpp.
References Offset, and clang::tidy::utils::withoutCStrReplacement().
Referenced by clang::tidy::modernize::UseStdPrintCheck::check().
|
inline |
Definition at line 39 of file FormatStringConverter.h.
Referenced by clang::tidy::modernize::UseStdPrintCheck::check().
|
inline |
Definition at line 40 of file FormatStringConverter.h.
Referenced by clang::tidy::modernize::UseStdPrintCheck::check().
|
inline |
Definition at line 44 of file FormatStringConverter.h.
Referenced by clang::tidy::modernize::UseStdPrintCheck::check().