llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: None (tgs-sc) <details> <summary>Changes</summary> 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. --- Full diff: https://github.com/llvm/llvm-project/pull/154134.diff 1 Files Affected: - (modified) clang/lib/AST/RecordLayoutBuilder.cpp (+2) ``````````diff diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp index 6d819031cbef4..93571543f1c7d 100644 --- a/clang/lib/AST/RecordLayoutBuilder.cpp +++ b/clang/lib/AST/RecordLayoutBuilder.cpp @@ -187,6 +187,8 @@ void EmptySubobjectMap::ComputeEmptySubobjectSizes() { // Check the bases. for (const CXXBaseSpecifier &Base : Class->bases()) { const CXXRecordDecl *BaseDecl = Base.getType()->getAsCXXRecordDecl(); + // Assert to prevent infinite recursion. + assert(BaseDecl != Class && "Class cannot inherit from itself."); CharUnits EmptySize; const ASTRecordLayout &Layout = Context.getASTRecordLayout(BaseDecl); `````````` </details> https://github.com/llvm/llvm-project/pull/154134 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits