[clang] [Clang] Implement consteval blocks for C++26 (PR #188665)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 14 15:47:59 PDT 2026
================
@@ -3650,6 +3655,48 @@ StaticAssertDecl *StaticAssertDecl::CreateDeserialized(ASTContext &C,
nullptr, SourceLocation(), false);
}
+void ConstevalBlockDecl::anchor() {}
+
+ConstevalBlockDecl *ConstevalBlockDecl::Create(ASTContext &C, DeclContext *DC,
+ SourceLocation ConstevalLoc,
+ Expr *Call) {
+ assert(Call);
+ return new (C, DC) ConstevalBlockDecl(DC, ConstevalLoc, Call);
+}
+
+ConstevalBlockDecl *ConstevalBlockDecl::CreateDeserialized(ASTContext &C,
+ GlobalDeclID ID) {
+ return new (C, ID) ConstevalBlockDecl(nullptr, SourceLocation(), nullptr);
+}
+
+SourceRange ConstevalBlockDecl::getSourceRange() const {
+ assert(Call && "should not be called before deserialization is complete");
+ return {getLocation(), Call->getEndLoc()};
+}
+
+LambdaExpr *ConstevalBlockDecl::getLambda() {
+ auto *CE = cast<CallExpr>(Call);
----------------
Sirraide wrote:
Well, `cast` already asserts that it’s not-null
https://github.com/llvm/llvm-project/pull/188665
More information about the cfe-commits
mailing list