aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp b/clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp
index f4945b2..127de30 100644
--- a/clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp
+++ b/clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp
@@ -245,7 +245,7 @@ FormatStringConverter::formatStringContainsUnreplaceableMacro(
// inhibit conversion. The whole format string will appear to come from that
// macro, as will the function call.
std::optional<StringRef> MaybeSurroundingMacroName;
- if (SourceLocation BeginCallLoc = Call->getBeginLoc();
+ if (const SourceLocation BeginCallLoc = Call->getBeginLoc();
BeginCallLoc.isMacroID())
MaybeSurroundingMacroName =
Lexer::getImmediateMacroName(BeginCallLoc, SM, PP.getLangOpts());
@@ -283,7 +283,8 @@ FormatStringConverter::formatStringContainsUnreplaceableMacro(
void FormatStringConverter::emitAlignment(const PrintfSpecifier &FS,
std::string &FormatSpec) {
- ConversionSpecifier::Kind ArgKind = FS.getConversionSpecifier().getKind();
+ const ConversionSpecifier::Kind ArgKind =
+ FS.getConversionSpecifier().getKind();
// We only care about alignment if a field width is specified
if (FS.getFieldWidth().getHowSpecified() != OptionalAmount::NotSpecified) {
@@ -499,7 +500,8 @@ bool FormatStringConverter::emitIntegerArgument(
/// @returns true on success, false on failure
bool FormatStringConverter::emitType(const PrintfSpecifier &FS, const Expr *Arg,
std::string &FormatSpec) {
- ConversionSpecifier::Kind ArgKind = FS.getConversionSpecifier().getKind();
+ const ConversionSpecifier::Kind ArgKind =
+ FS.getConversionSpecifier().getKind();
switch (ArgKind) {
case ConversionSpecifier::Kind::sArg:
emitStringArgument(FS.getArgIndex() + ArgsOffset, Arg);
@@ -798,7 +800,7 @@ void FormatStringConverter::applyFixes(DiagnosticBuilder &Diag,
}
for (const auto &[ArgIndex, Replacement] : ArgFixes) {
- SourceLocation AfterOtherSide =
+ const SourceLocation AfterOtherSide =
Lexer::findNextToken(Args[ArgIndex]->getEndLoc(), SM, LangOpts)
->getLocation();