Xiangling_L added inline comments.
================ Comment at: clang/lib/AST/RecordLayoutBuilder.cpp:666 + FirstNonOverlappingEmptyFieldHandled + } FirstNonOverlappingEmptyFieldStatus; + ---------------- efriedma wrote: > Instead of specifically tracking whether you've found an OverlappingEmpty > field, could you just have something like "bool FoundNonOverlappingEmptyField > = false;", and set it to true when you handle a field that isn't > OverlappingEmpty? I don't think we need to specifically track whether we've > found an OverlappingEmpty field. I think you are right. We do not need to specifically track whether we've found an OverlappingEmpty field. But I think we do need an enum to track if the first non-OverlappingEmptyField is handled or not. Or the following case is problematic: ``` struct A { int : 0; double d; }; ``` The `double d` will mistakenly match `FieldOffset == CharUnits::Zero() && D->getFieldIndex() != 0 && !IsOverlappingEmptyField && FoundNonOverlappingEmptyField `, which we shouldn't because it is not the first member of the struct. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D79719/new/ https://reviews.llvm.org/D79719 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits