diff options
| author | Matheus Izvekov <mizvekov@gmail.com> | 2025-08-26 16:05:59 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-26 16:05:59 -0300 |
| commit | 2ec71d93ad888d9523425930ef8c35fe8f0b2485 (patch) | |
| tree | e2a0c680ae74184edaee5cbe4df8794f4915f667 /clang/lib/CodeGen/CGExprAgg.cpp | |
| parent | 2bfbae99b93ab17cf6a53d826301ba51c52b6129 (diff) | |
| download | llvm-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/CodeGen/CGExprAgg.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGExprAgg.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index ed90e98..5057536 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -424,10 +424,7 @@ AggExprEmitter::VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E) { Ctx.getAsConstantArrayType(E->getSubExpr()->getType()); assert(ArrayType && "std::initializer_list constructed from non-array"); - RecordDecl *Record = E->getType() - ->castAs<RecordType>() - ->getOriginalDecl() - ->getDefinitionOrSelf(); + auto *Record = E->getType()->castAsRecordDecl(); RecordDecl::field_iterator Field = Record->field_begin(); assert(Field != Record->field_end() && Ctx.hasSameType(Field->getType()->getPointeeType(), @@ -1809,10 +1806,7 @@ void AggExprEmitter::VisitCXXParenListOrInitListExpr( // the disadvantage is that the generated code is more difficult for // the optimizer, especially with bitfields. unsigned NumInitElements = InitExprs.size(); - RecordDecl *record = ExprToVisit->getType() - ->castAs<RecordType>() - ->getOriginalDecl() - ->getDefinitionOrSelf(); + RecordDecl *record = ExprToVisit->getType()->castAsRecordDecl(); // We'll need to enter cleanup scopes in case any of the element // initializers throws an exception. |
