diff options
author | Timm Bäder <tbaeder@redhat.com> | 2024-02-13 15:00:19 +0100 |
---|---|---|
committer | Timm Bäder <tbaeder@redhat.com> | 2024-02-13 15:01:17 +0100 |
commit | bb60c066a24eda6e6276fba9021cad85c4892343 (patch) | |
tree | 005d49c870d831e02fcd48ec3eb760cfa7a2c932 | |
parent | 880afa1c5d1b099eed5034340a67e56b9dda4c09 (diff) | |
download | llvm-bb60c066a24eda6e6276fba9021cad85c4892343.zip llvm-bb60c066a24eda6e6276fba9021cad85c4892343.tar.gz llvm-bb60c066a24eda6e6276fba9021cad85c4892343.tar.bz2 |
[clang][Interp] Handle Requires- and ConceptSpecializationExprs
Just emit their satisfaction state, which is what the current
interpreter does as well.
-rw-r--r-- | clang/lib/AST/Interp/ByteCodeExprGen.cpp | 13 | ||||
-rw-r--r-- | clang/lib/AST/Interp/ByteCodeExprGen.h | 2 | ||||
-rw-r--r-- | clang/test/SemaCXX/concept-crash-on-diagnostic.cpp | 1 |
3 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index 880e338..91b9985 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -2119,6 +2119,19 @@ bool ByteCodeExprGen<Emitter>::VisitCXXUuidofExpr(const CXXUuidofExpr *E) { return this->emitInitPtr(E); } +template <class Emitter> +bool ByteCodeExprGen<Emitter>::VisitRequiresExpr(const RequiresExpr *E) { + assert(classifyPrim(E->getType()) == PT_Bool); + return this->emitConstBool(E->isSatisfied(), E); +} + +template <class Emitter> +bool ByteCodeExprGen<Emitter>::VisitConceptSpecializationExpr( + const ConceptSpecializationExpr *E) { + assert(classifyPrim(E->getType()) == PT_Bool); + return this->emitConstBool(E->isSatisfied(), E); +} + template <class Emitter> bool ByteCodeExprGen<Emitter>::discard(const Expr *E) { if (E->containsErrors()) return false; diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.h b/clang/lib/AST/Interp/ByteCodeExprGen.h index c723170..eeb56dc 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.h +++ b/clang/lib/AST/Interp/ByteCodeExprGen.h @@ -114,6 +114,8 @@ public: bool VisitCXXInheritedCtorInitExpr(const CXXInheritedCtorInitExpr *E); bool VisitExpressionTraitExpr(const ExpressionTraitExpr *E); bool VisitCXXUuidofExpr(const CXXUuidofExpr *E); + bool VisitRequiresExpr(const RequiresExpr *E); + bool VisitConceptSpecializationExpr(const ConceptSpecializationExpr *E); protected: bool visitExpr(const Expr *E) override; diff --git a/clang/test/SemaCXX/concept-crash-on-diagnostic.cpp b/clang/test/SemaCXX/concept-crash-on-diagnostic.cpp index 00a39f9..71e55c8 100644 --- a/clang/test/SemaCXX/concept-crash-on-diagnostic.cpp +++ b/clang/test/SemaCXX/concept-crash-on-diagnostic.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -std=c++20 -verify %s +// RUN: %clang_cc1 -fsyntax-only -std=c++20 -verify %s -fexperimental-new-constant-interpreter template <typename Iterator> class normal_iterator {}; |