Skip to content

Commit a4f835c

Browse files
authored
[clang-tidy][NFC] Fix uninitialized pointer field. (#117173)
Non-static class member `PP` is not initialized in this constructor nor in any functions that it calls.
1 parent 01c9a14 commit a4f835c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ AST_MATCHER(StringLiteral, isOrdinary) { return Node.isOrdinary(); }
2323
} // namespace
2424

2525
UseStdPrintCheck::UseStdPrintCheck(StringRef Name, ClangTidyContext *Context)
26-
: ClangTidyCheck(Name, Context),
26+
: ClangTidyCheck(Name, Context), PP(nullptr),
2727
StrictMode(Options.getLocalOrGlobal("StrictMode", false)),
2828
PrintfLikeFunctions(utils::options::parseStringList(
2929
Options.get("PrintfLikeFunctions", ""))),
@@ -131,6 +131,7 @@ void UseStdPrintCheck::check(const MatchFinder::MatchResult &Result) {
131131
utils::FormatStringConverter::Configuration ConverterConfig;
132132
ConverterConfig.StrictMode = StrictMode;
133133
ConverterConfig.AllowTrailingNewlineRemoval = true;
134+
assert(PP && "Preprocessor should be set by registerPPCallbacks");
134135
utils::FormatStringConverter Converter(
135136
Result.Context, Printf, FormatArgOffset, ConverterConfig, getLangOpts(),
136137
*Result.SourceManager, *PP);

0 commit comments

Comments
 (0)