https://github.com/tgs-sc updated 
https://github.com/llvm/llvm-project/pull/154134

>From 207f70213dd70ae8faf7dcc1250e99fee4156bc1 Mon Sep 17 00:00:00 2001
From: Timur Golubovich <[email protected]>
Date: Mon, 18 Aug 2025 18:08:27 +0300
Subject: [PATCH] [clang][AST] Added assert to prevent infinite recursion in
 computing layout

While computing class layout, I met with infinite recursion. This
happened while executing user expression in lldb as record type was
incorrectly received from dwarf. This assert will replace the infinite
recursion with an error and will simplify further debugging of such cases.
---
 clang/lib/AST/RecordLayoutBuilder.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp 
b/clang/lib/AST/RecordLayoutBuilder.cpp
index 6d819031cbef4..38618eefc5a87 100644
--- a/clang/lib/AST/RecordLayoutBuilder.cpp
+++ b/clang/lib/AST/RecordLayoutBuilder.cpp
@@ -187,6 +187,7 @@ void EmptySubobjectMap::ComputeEmptySubobjectSizes() {
   // Check the bases.
   for (const CXXBaseSpecifier &Base : Class->bases()) {
     const CXXRecordDecl *BaseDecl = Base.getType()->getAsCXXRecordDecl();
+    assert(BaseDecl != Class && "Class cannot inherit from itself.");
 
     CharUnits EmptySize;
     const ASTRecordLayout &Layout = Context.getASTRecordLayout(BaseDecl);

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to