From 467688527017efb611b09c0cbf92f2d3ecdd1724 Mon Sep 17 00:00:00 2001 From: Corentin Jabot Date: Mon, 8 May 2023 12:18:43 +0200 Subject: [clang] Implement P2564 "consteval must propagate up" Reviewed By: aaron.ballman, #clang-language-wg Differential Revision: https://reviews.llvm.org/D151094 --- clang/lib/CodeGen/CodeGenModule.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 41ceebfba404..ac8ff6455612 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -4231,8 +4231,8 @@ llvm::Constant *CodeGenModule::GetAddrOfFunction(GlobalDecl GD, bool ForVTable, bool DontDefer, ForDefinition_t IsForDefinition) { - assert(!cast(GD.getDecl())->isConsteval() && - "consteval function should never be emitted"); + assert(!cast(GD.getDecl())->isImmediateFunction() && + "an immediate function should never be emitted"); // If there was no specific requested type, just convert it now. if (!Ty) { const auto *FD = cast(GD.getDecl()); @@ -6333,9 +6333,8 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { return; // Consteval function shouldn't be emitted. - if (auto *FD = dyn_cast(D)) - if (FD->isConsteval()) - return; + if (auto *FD = dyn_cast(D); FD && FD->isImmediateFunction()) + return; switch (D->getKind()) { case Decl::CXXConversion: -- cgit v1.2.3