summaryrefslogtreecommitdiff
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.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp b/clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp
index 0df8e913100f..0d0834dc38fc 100644
--- a/clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp
+++ b/clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp
@@ -460,10 +460,9 @@ bool FormatStringConverter::emitIntegerArgument(
// be passed as its underlying type. However, printf will have forced
// the signedness based on the format string, so we need to do the
// same.
- if (const auto *ET = ArgType->getAs<EnumType>()) {
- if (const std::optional<std::string> MaybeCastType = castTypeForArgument(
- ArgKind,
- ET->getOriginalDecl()->getDefinitionOrSelf()->getIntegerType()))
+ if (const auto *ED = ArgType->getAsEnumDecl()) {
+ if (const std::optional<std::string> MaybeCastType =
+ castTypeForArgument(ArgKind, ED->getIntegerType()))
ArgFixes.emplace_back(
ArgIndex, (Twine("static_cast<") + *MaybeCastType + ">(").str());
else