[clang] [clang][AST] fix dereference on class/struct layouts check. (PR #83686)
https://github.com/devnexen closed https://github.com/llvm/llvm-project/pull/83686 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][AST] fix dereference on class/struct layouts check. (PR #83686)
Sirraide wrote: > it seems [there is an ongoing > fix](https://github.com/llvm/llvm-project/pull/83688), could you possibly try > so we can just close this one. Yeah, it seems that the pr I opened for #83684 also fixes both the reduced test cases for this issue (and it also doesn’t crash anymore if I try to compile the file that was linked in the issue), though it should be noted that that’s only after I noticed that there was another problem and fixed that too. I think we should be able to close this one, unless someone comes up with a test case that still crashes anyway. https://github.com/llvm/llvm-project/pull/83686 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][AST] fix dereference on class/struct layouts check. (PR #83686)
Endilll wrote: I posted a different, even shorter reduction in https://github.com/llvm/llvm-project/issues/83671. https://github.com/llvm/llvm-project/pull/83686 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][AST] fix dereference on class/struct layouts check. (PR #83686)
devnexen wrote: it seems [there is an ongoing fix](https://github.com/llvm/llvm-project/pull/83688), could you possibly try so we can just close this one. https://github.com/llvm/llvm-project/pull/83686 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][AST] fix dereference on class/struct layouts check. (PR #83686)
bjrjk wrote: Hello, this is a mininal reproducer execute with `clang++ -Xclang -fdump-record-layouts-complete test.cpp`: ```cpp template struct integral_constant { static constexpr const _Tp value = __v; typedef integral_constant type; }; template using _BoolConstant = integral_constant; template struct is_same : _BoolConstant<__is_same(_Tp, _Up)> {}; ``` https://github.com/llvm/llvm-project/pull/83686 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][AST] fix dereference on class/struct layouts check. (PR #83686)
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/83686 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][AST] fix dereference on class/struct layouts check. (PR #83686)
https://github.com/shafik edited https://github.com/llvm/llvm-project/pull/83686 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][AST] fix dereference on class/struct layouts check. (PR #83686)
https://github.com/shafik requested changes to this pull request. We need a minimal reproducer here. Looking at the bug report it is not clear to me if this is the correct fix or not. After we have a reproducer we would need a test added to the PR and a release note. https://github.com/llvm/llvm-project/pull/83686 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][AST] fix dereference on class/struct layouts check. (PR #83686)
llvmbot wrote: @llvm/pr-subscribers-clang Author: David CARLIER (devnexen) Changes close #83671. --- Full diff: https://github.com/llvm/llvm-project/pull/83686.diff 1 Files Affected: - (modified) clang/lib/AST/RecordLayoutBuilder.cpp (+3-3) ``diff diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp index a3b7431f7ffd6d..195f17d2e5a42f 100644 --- a/clang/lib/AST/RecordLayoutBuilder.cpp +++ b/clang/lib/AST/RecordLayoutBuilder.cpp @@ -205,15 +205,15 @@ void EmptySubobjectMap::ComputeEmptySubobjectSizes() { // Check the fields. for (const FieldDecl *FD : Class->fields()) { +const CXXRecordDecl *MemberDecl; const RecordType *RT = Context.getBaseElementType(FD->getType())->getAs(); -// We only care about record types. -if (!RT) +// We only care about members layout. +if (!RT || !(MemberDecl = RT->getAsCXXRecordDecl())) continue; CharUnits EmptySize; -const CXXRecordDecl *MemberDecl = RT->getAsCXXRecordDecl(); const ASTRecordLayout &Layout = Context.getASTRecordLayout(MemberDecl); if (MemberDecl->isEmpty()) { // If the class decl is empty, get its size. `` https://github.com/llvm/llvm-project/pull/83686 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][AST] fix dereference on class/struct layouts check. (PR #83686)
https://github.com/devnexen created https://github.com/llvm/llvm-project/pull/83686 close #83671. >From 49c888993ee4ce566db8f5b8d4932cee81b8f701 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 2 Mar 2024 18:00:10 + Subject: [PATCH] [clang][AST] fix dereference on class/struct layouts check. close #83671. --- clang/lib/AST/RecordLayoutBuilder.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp index a3b7431f7ffd6d..195f17d2e5a42f 100644 --- a/clang/lib/AST/RecordLayoutBuilder.cpp +++ b/clang/lib/AST/RecordLayoutBuilder.cpp @@ -205,15 +205,15 @@ void EmptySubobjectMap::ComputeEmptySubobjectSizes() { // Check the fields. for (const FieldDecl *FD : Class->fields()) { +const CXXRecordDecl *MemberDecl; const RecordType *RT = Context.getBaseElementType(FD->getType())->getAs(); -// We only care about record types. -if (!RT) +// We only care about members layout. +if (!RT || !(MemberDecl = RT->getAsCXXRecordDecl())) continue; CharUnits EmptySize; -const CXXRecordDecl *MemberDecl = RT->getAsCXXRecordDecl(); const ASTRecordLayout &Layout = Context.getASTRecordLayout(MemberDecl); if (MemberDecl->isEmpty()) { // If the class decl is empty, get its size. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits