[PATCH] D132874: [clang] Don't emit debug vtable information for consteval functions
Luke Nihlen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 29 11:08:35 PDT 2022
luken-google created this revision.
Herald added a project: All.
luken-google requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Fixes https://github.com/llvm/llvm-project/issues/55065
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D132874
Files:
clang/docs/ReleaseNotes.rst
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGenCXX/cxx20-consteval-crash.cpp
Index: clang/test/CodeGenCXX/cxx20-consteval-crash.cpp
===================================================================
--- clang/test/CodeGenCXX/cxx20-consteval-crash.cpp
+++ clang/test/CodeGenCXX/cxx20-consteval-crash.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-linux-gnu -std=c++20 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-obj -debug-info-kind=constructor -std=c++20 %s -o -
namespace PR50787 {
// This code would previously cause a crash.
@@ -71,3 +72,22 @@
return function(Item{'a'}, Item{'a'});
}
} // namespace Issue58871
+
+namespace Issue55065 {
+struct Base {
+ consteval virtual int Get() const = 0;
+};
+
+struct Derived : Base {
+ consteval int Get() const override {
+ return 42;
+ }
+};
+
+int foo() {
+ constexpr Derived a;
+
+ auto val = a.Get();
+ return val;
+}
+} // namespace Issue55065
\ No newline at end of file
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1758,7 +1758,7 @@
llvm::DISubprogram::DISPFlags SPFlags = llvm::DISubprogram::SPFlagZero;
int ThisAdjustment = 0;
- if (Method->isVirtual()) {
+ if (Method->isVirtual() && !Method->isConsteval()) {
if (Method->isPure())
SPFlags |= llvm::DISubprogram::SPFlagPureVirtual;
else
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -188,10 +188,11 @@
and `DR1734 <https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1734>`_.
- Class member variables are now in scope when parsing a ``requires`` clause. Fixes
`GH55216 <https://github.com/llvm/llvm-project/issues/55216>`_.
-
- Correctly set expression evaluation context as 'immediate function context' in
consteval functions.
This fixes `GH51182 <https://github.com/llvm/llvm-project/issues/51182>`
+- Fixes an assert crash caused by looking up missing vtable information on ``consteval``
+ virtual functions. Fixes `GH55065 <https://github.com/llvm/llvm-project/issues/55065>`_.
C++2b Feature Support
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132874.456416.patch
Type: text/x-patch
Size: 2227 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220829/43c09624/attachment.bin>
More information about the cfe-commits
mailing list