================ @@ -5776,6 +5826,51 @@ QualType ASTContext::getBTFTagAttributedType(const BTFTypeTagAttr *BTFAttr, return QualType(Ty, 0); } +QualType ASTContext::getOverflowBehaviorType(const OverflowBehaviorAttr *Attr, + QualType Underlying) const { + IdentifierInfo *II = Attr->getBehaviorKind(); + StringRef IdentName = II->getName(); + OverflowBehaviorType::OverflowBehaviorKind Kind; + if (IdentName == "wrap") { + Kind = OverflowBehaviorType::OverflowBehaviorKind::Wrap; + } else if (IdentName == "no_wrap") { + Kind = OverflowBehaviorType::OverflowBehaviorKind::NoWrap; + } else { + return Underlying; + } + + return getOverflowBehaviorType(Kind, Underlying); +} + +QualType ASTContext::getOverflowBehaviorType( + OverflowBehaviorType::OverflowBehaviorKind Kind, + QualType Underlying) const { + llvm::FoldingSetNodeID ID; + OverflowBehaviorType::Profile(ID, Underlying, Kind); + void *InsertPos = nullptr; + + if (OverflowBehaviorType *OBT = + OverflowBehaviorTypes.FindNodeOrInsertPos(ID, InsertPos)) { + return QualType(OBT, 0); + } + + QualType Canonical; + if (!Underlying.isCanonical()) { + Canonical = getOverflowBehaviorType(Kind, getCanonicalType(Underlying)); + OverflowBehaviorType *NewOBT = + OverflowBehaviorTypes.FindNodeOrInsertPos(ID, InsertPos); + assert(!NewOBT && "Shouldn't be in the map!"); + (void)NewOBT; ---------------- mizvekov wrote:
```suggestion [[maybe_unused]] OverflowBehaviorType *NewOBT = OverflowBehaviorTypes.FindNodeOrInsertPos(ID, InsertPos); assert(!NewOBT && "Shouldn't be in the map!"); ``` https://github.com/llvm/llvm-project/pull/148914 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits