[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
Tue Aug 30 12:10:30 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc9aba6007451: [clang] Don't emit debug vtable information for consteval functions (authored by luken-google).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132874/new/
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,23 @@
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
+
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -26,6 +26,7 @@
#include "clang/AST/Expr.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/RecursiveASTVisitor.h"
+#include "clang/AST/VTableBuilder.h"
#include "clang/Basic/CodeGenOptions.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
@@ -1758,7 +1759,7 @@
llvm::DISubprogram::DISPFlags SPFlags = llvm::DISubprogram::SPFlagZero;
int ThisAdjustment = 0;
- if (Method->isVirtual()) {
+ if (VTableContextBase::hasVtableSlot(Method)) {
if (Method->isPure())
SPFlags |= llvm::DISubprogram::SPFlagPureVirtual;
else
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -198,10 +198,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.456747.patch
Type: text/x-patch
Size: 2481 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220830/8325a488/attachment.bin>
More information about the cfe-commits
mailing list