diff options
| author | Mingming Liu <mingmingl@google.com> | 2025-09-10 15:25:31 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-10 15:25:31 -0700 |
| commit | 1417dafa1db9cb1b2b09438aa9f53ea5ab6e36e2 (patch) | |
| tree | 57f4b1f313c8cf74eed8819870f39c36ea263c68 /clang/lib/CodeGen/CodeGenTBAA.cpp | |
| parent | 898b813bc8a6d0276bf0f4769f5f2f64b34e632d (diff) | |
| parent | b8cefcb601ddaa18482555c4ff363c01a270c2fe (diff) | |
Merge branch 'main' into users/mingmingl-llvm/samplefdo-profile-formatusers/mingmingl-llvm/samplefdo-profile-format
Diffstat (limited to 'clang/lib/CodeGen/CodeGenTBAA.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenTBAA.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CodeGenTBAA.cpp b/clang/lib/CodeGen/CodeGenTBAA.cpp index bd2442f01cc5..f8c7d64cc1aa 100644 --- a/clang/lib/CodeGen/CodeGenTBAA.cpp +++ b/clang/lib/CodeGen/CodeGenTBAA.cpp @@ -142,10 +142,9 @@ static bool TypeHasMayAlias(QualType QTy) { /// Check if the given type is a valid base type to be used in access tags. static bool isValidBaseType(QualType QTy) { - if (const RecordType *TTy = QTy->getAs<RecordType>()) { - const RecordDecl *RD = TTy->getOriginalDecl()->getDefinition(); + if (const auto *RD = QTy->getAsRecordDecl()) { // Incomplete types are not valid base access types. - if (!RD) + if (!RD->isCompleteDefinition()) return false; if (RD->hasFlexibleArrayMember()) return false; @@ -296,7 +295,7 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) { // Be conservative if the type isn't a RecordType. We are specifically // required to do this for member pointers until we implement the // similar-types rule. - const auto *RT = Ty->getAs<RecordType>(); + const auto *RT = Ty->getAsCanonical<RecordType>(); if (!RT) return getAnyPtr(PtrDepth); @@ -425,7 +424,7 @@ CodeGenTBAA::CollectFields(uint64_t BaseOffset, bool MayAlias) { /* Things not handled yet include: C++ base classes, bitfields, */ - if (const RecordType *TTy = QTy->getAs<RecordType>()) { + if (const auto *TTy = QTy->getAsCanonical<RecordType>()) { if (TTy->isUnionType()) { uint64_t Size = Context.getTypeSizeInChars(QTy).getQuantity(); llvm::MDNode *TBAAType = getChar(); |
