diff options
author | Matheus Izvekov <mizvekov@gmail.com> | 2025-08-25 20:18:56 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-25 20:18:56 -0300 |
commit | dc8596d5485a52abee2967cec72f81ef4872270c (patch) | |
tree | 5d0b5cbc1fed95f3b9aae2b39387c0f2b4d0e47c /clang/lib/CodeGen/CGDecl.cpp | |
parent | 1ba8b36fef84bedb0a657b570076ec1a47e9061d (diff) | |
download | llvm-dc8596d5485a52abee2967cec72f81ef4872270c.zip llvm-dc8596d5485a52abee2967cec72f81ef4872270c.tar.gz llvm-dc8596d5485a52abee2967cec72f81ef4872270c.tar.bz2 |
[clang] NFC: change more places to use Type::getAsTagDecl and friends (#155313)
This changes a bunch of places which use getAs<TagType>, including
derived types, just to obtain the tag definition.
This is preparation for #155028, offloading all the changes that PR used
to introduce which don't depend on any new helpers.
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 8a16758..8693f3c 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -1568,10 +1568,9 @@ CodeGenFunction::EmitAutoVarAlloca(const VarDecl &D) { ReturnValue.getElementType(), ReturnValue.getAlignment()); address = MaybeCastStackAddressSpace(AllocaAddr, Ty.getAddressSpace()); - if (const RecordType *RecordTy = Ty->getAs<RecordType>()) { - const auto *RD = RecordTy->getOriginalDecl()->getDefinitionOrSelf(); - const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD); - if ((CXXRD && !CXXRD->hasTrivialDestructor()) || + if (const auto *RD = Ty->getAsRecordDecl()) { + if (const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD); + (CXXRD && !CXXRD->hasTrivialDestructor()) || RD->isNonTrivialToPrimitiveDestroy()) { // Create a flag that is used to indicate when the NRVO was applied // to this variable. Set it to zero to indicate that NRVO was not |