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/Analysis/ThreadSafetyCommon.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/Analysis/ThreadSafetyCommon.cpp')
-rw-r--r-- | clang/lib/Analysis/ThreadSafetyCommon.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/clang/lib/Analysis/ThreadSafetyCommon.cpp b/clang/lib/Analysis/ThreadSafetyCommon.cpp index f560dd8..68c27ee 100644 --- a/clang/lib/Analysis/ThreadSafetyCommon.cpp +++ b/clang/lib/Analysis/ThreadSafetyCommon.cpp @@ -83,13 +83,11 @@ static std::pair<StringRef, bool> classifyCapability(QualType QT) { // We need to look at the declaration of the type of the value to determine // which it is. The type should either be a record or a typedef, or a pointer // or reference thereof. - if (const auto *RT = QT->getAs<RecordType>()) { - if (const auto *RD = RT->getOriginalDecl()) - return classifyCapability(*RD->getDefinitionOrSelf()); - } else if (const auto *TT = QT->getAs<TypedefType>()) { - if (const auto *TD = TT->getDecl()) - return classifyCapability(*TD); - } else if (QT->isPointerOrReferenceType()) + if (const auto *RD = QT->getAsRecordDecl()) + return classifyCapability(*RD); + if (const auto *TT = QT->getAs<TypedefType>()) + return classifyCapability(*TT->getDecl()); + if (QT->isPointerOrReferenceType()) return classifyCapability(QT->getPointeeType()); return ClassifyCapabilityFallback; |