diff options
| author | Corentin Jabot <corentinjabot@gmail.com> | 2023-05-08 12:18:43 +0200 |
|---|---|---|
| committer | Corentin Jabot <corentinjabot@gmail.com> | 2023-06-07 20:45:36 +0200 |
| commit | 467688527017efb611b09c0cbf92f2d3ecdd1724 (patch) | |
| tree | 17431b11e4a5d89809ac2819549c077c73a5c5d3 /clang/lib/CodeGen/CodeGenModule.cpp | |
| parent | dd72b81334bb155e6e3511311f9137550aff915e (diff) | |
[clang] Implement P2564 "consteval must propagate up"
Reviewed By: aaron.ballman, #clang-language-wg
Differential Revision: https://reviews.llvm.org/D151094
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
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<FunctionDecl>(GD.getDecl())->isConsteval() && - "consteval function should never be emitted"); + assert(!cast<FunctionDecl>(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<FunctionDecl>(GD.getDecl()); @@ -6333,9 +6333,8 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { return; // Consteval function shouldn't be emitted. - if (auto *FD = dyn_cast<FunctionDecl>(D)) - if (FD->isConsteval()) - return; + if (auto *FD = dyn_cast<FunctionDecl>(D); FD && FD->isImmediateFunction()) + return; switch (D->getKind()) { case Decl::CXXConversion: |
