aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Compiler.cpp
diff options
context:
space:
mode:
authorMatheus Izvekov <mizvekov@gmail.com>2025-08-26 16:05:59 -0300
committerGitHub <noreply@github.com>2025-08-26 16:05:59 -0300
commit2ec71d93ad888d9523425930ef8c35fe8f0b2485 (patch)
treee2a0c680ae74184edaee5cbe4df8794f4915f667 /clang/lib/AST/ByteCode/Compiler.cpp
parent2bfbae99b93ab17cf6a53d826301ba51c52b6129 (diff)
downloadllvm-2ec71d93ad888d9523425930ef8c35fe8f0b2485.zip
llvm-2ec71d93ad888d9523425930ef8c35fe8f0b2485.tar.gz
llvm-2ec71d93ad888d9523425930ef8c35fe8f0b2485.tar.bz2
[clang] NFC: introduce Type::getAsEnumDecl, and cast variants for all TagDecls (#155463)
And make use of those. These changes are split from prior PR #155028, in order to decrease the size of that PR and facilitate review.
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Compiler.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 8610267..0079d93 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -559,8 +559,7 @@ bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) {
// Possibly diagnose casts to enum types if the target type does not
// have a fixed size.
if (Ctx.getLangOpts().CPlusPlus && CE->getType()->isEnumeralType()) {
- const auto *ET = CE->getType().getCanonicalType()->castAs<EnumType>();
- const auto *ED = ET->getOriginalDecl()->getDefinitionOrSelf();
+ const auto *ED = CE->getType()->castAsEnumDecl();
if (!ED->isFixed()) {
if (!this->emitCheckEnumValue(*FromT, ED, CE))
return false;