Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions clang/include/clang/Sema/SemaConcept.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,31 +135,20 @@ struct NormalizedConstraint {
return *this;
}

bool isAtomic() const { return Constraint.is<AtomicConstraint *>(); }
bool isAtomic() const { return llvm::isa<AtomicConstraint *>(Constraint); }
bool isFoldExpanded() const {
return Constraint.is<FoldExpandedConstraint *>();
return llvm::isa<FoldExpandedConstraint *>(Constraint);
}
bool isCompound() const { return Constraint.is<CompoundConstraint>(); }
bool isCompound() const { return llvm::isa<CompoundConstraint>(Constraint); }

CompoundConstraintKind getCompoundKind() const {
assert(isCompound() && "getCompoundKind on a non-compound constraint..");
return Constraint.get<CompoundConstraint>().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 *>();
}
AtomicConstraint *getAtomicConstraint() const;

FoldExpandedConstraint *getFoldExpandedConstraint() const {
assert(isFoldExpanded() &&
"getFoldExpandedConstraint called on non-fold-expanded constraint.");
return Constraint.get<FoldExpandedConstraint *>();
}
FoldExpandedConstraint *getFoldExpandedConstraint() const;

private:
static std::optional<NormalizedConstraint>
Expand Down
18 changes: 18 additions & 0 deletions clang/lib/Sema/SemaConcept.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CompoundConstraint>(Constraint).getInt();
}

AtomicConstraint *NormalizedConstraint::getAtomicConstraint() const {
assert(isAtomic() && "getAtomicConstraint called on non-atomic constraint.");
return cast<AtomicConstraint *>(Constraint);
}

FoldExpandedConstraint *
NormalizedConstraint::getFoldExpandedConstraint() const {
assert(isFoldExpanded() &&
"getFoldExpandedConstraint called on non-fold-expanded constraint.");
return cast<FoldExpandedConstraint *>(Constraint);
}
Loading