aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGBlocks.cpp
diff options
context:
space:
mode:
authorMatheus Izvekov <mizvekov@gmail.com>2025-08-25 20:18:56 -0300
committerGitHub <noreply@github.com>2025-08-25 20:18:56 -0300
commitdc8596d5485a52abee2967cec72f81ef4872270c (patch)
tree5d0b5cbc1fed95f3b9aae2b39387c0f2b4d0e47c /clang/lib/CodeGen/CGBlocks.cpp
parent1ba8b36fef84bedb0a657b570076ec1a47e9061d (diff)
downloadllvm-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/CGBlocks.cpp')
-rw-r--r--clang/lib/CodeGen/CGBlocks.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp
index 74d92ef0..597127ab 100644
--- a/clang/lib/CodeGen/CGBlocks.cpp
+++ b/clang/lib/CodeGen/CGBlocks.cpp
@@ -420,14 +420,11 @@ static void addBlockLayout(CharUnits align, CharUnits size,
/// Determines if the given type is safe for constant capture in C++.
static bool isSafeForCXXConstantCapture(QualType type) {
- const RecordType *recordType =
- type->getBaseElementTypeUnsafe()->getAs<RecordType>();
+ const auto *record = type->getBaseElementTypeUnsafe()->getAsCXXRecordDecl();
// Only records can be unsafe.
- if (!recordType) return true;
-
- const auto *record =
- cast<CXXRecordDecl>(recordType->getOriginalDecl())->getDefinitionOrSelf();
+ if (!record)
+ return true;
// Maintain semantics for classes with non-trivial dtors or copy ctors.
if (!record->hasTrivialDestructor()) return false;