From 51e4aa87e05c45bebf9658a47980b1934c88be31 Mon Sep 17 00:00:00 2001 From: Tyker Date: Sun, 14 Jun 2020 14:39:14 +0200 Subject: attempt to fix failing buildbots after 3bab88b7baa20b276faaee0aa7ca87f636c91877 Prevent IR-gen from emitting consteval declarations Summary: with this patch instead of emitting calls to consteval function. the IR-gen will emit a store of the already computed result. --- clang/lib/CodeGen/CodeGenModule.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 26d34fa293e4..887df8a97f34 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -3336,6 +3336,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"); // If there was no specific requested type, just convert it now. if (!Ty) { const auto *FD = cast(GD.getDecl()); @@ -5330,6 +5332,11 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { if (D->isTemplated()) return; + // Consteval function shouldn't be emitted. + if (auto *FD = dyn_cast(D)) + if (FD->isConsteval()) + return; + switch (D->getKind()) { case Decl::CXXConversion: case Decl::CXXMethod: -- cgit v1.2.3