diff --git a/clang/include/clang/Sema/SemaConcept.h b/clang/include/clang/Sema/SemaConcept.h index fa5309a597b3a..5c599a70532f6 100644 --- a/clang/include/clang/Sema/SemaConcept.h +++ b/clang/include/clang/Sema/SemaConcept.h @@ -135,31 +135,20 @@ struct NormalizedConstraint { return *this; } - bool isAtomic() const { return Constraint.is(); } + bool isAtomic() const { return llvm::isa(Constraint); } bool isFoldExpanded() const { - return Constraint.is(); + return llvm::isa(Constraint); } - bool isCompound() const { return Constraint.is(); } + bool isCompound() const { return llvm::isa(Constraint); } - CompoundConstraintKind getCompoundKind() const { - assert(isCompound() && "getCompoundKind on a non-compound constraint.."); - return Constraint.get().getInt(); - } + CompoundConstraintKind getCompoundKind() const; NormalizedConstraint &getLHS() const; NormalizedConstraint &getRHS() const; - AtomicConstraint *getAtomicConstraint() const { - assert(isAtomic() && - "getAtomicConstraint called on non-atomic constraint."); - return Constraint.get(); - } + AtomicConstraint *getAtomicConstraint() const; - FoldExpandedConstraint *getFoldExpandedConstraint() const { - assert(isFoldExpanded() && - "getFoldExpandedConstraint called on non-fold-expanded constraint."); - return Constraint.get(); - } + FoldExpandedConstraint *getFoldExpandedConstraint() const; private: static std::optional diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp index ff1df7b71b1a4..539de00bd104f 100644 --- a/clang/lib/Sema/SemaConcept.cpp +++ b/clang/lib/Sema/SemaConcept.cpp @@ -1958,3 +1958,21 @@ concepts::TypeRequirement::TypeRequirement(TypeSourceInfo *T) : Value(T), Status(T->getType()->isInstantiationDependentType() ? SS_Dependent : SS_Satisfied) {} + +NormalizedConstraint::CompoundConstraintKind +NormalizedConstraint::getCompoundKind() const { + assert(isCompound() && "getCompoundKind on a non-compound constraint.."); + return cast(Constraint).getInt(); +} + +AtomicConstraint *NormalizedConstraint::getAtomicConstraint() const { + assert(isAtomic() && "getAtomicConstraint called on non-atomic constraint."); + return cast(Constraint); +} + +FoldExpandedConstraint * +NormalizedConstraint::getFoldExpandedConstraint() const { + assert(isFoldExpanded() && + "getFoldExpandedConstraint called on non-fold-expanded constraint."); + return cast(Constraint); +}