[PATCH] D152472: [Clang][MS] Remove assertion on BaseOffset can't be smaller than Size.
Zequan Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 8 14:43:10 PDT 2023
zequanwu created this revision.
zequanwu added a reviewer: rnk.
Herald added a project: All.
zequanwu requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
This assertion triggered when we have two base classes sharing the same offset
and the first base is empty and the second class is non-empty.
Remove it for correctness.
I can't add a test case for this because -foverride-record-layout doesn't read
base class info at all. I can add that support later for testing if needed.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D152472
Files:
clang/lib/AST/RecordLayoutBuilder.cpp
Index: clang/lib/AST/RecordLayoutBuilder.cpp
===================================================================
--- clang/lib/AST/RecordLayoutBuilder.cpp
+++ clang/lib/AST/RecordLayoutBuilder.cpp
@@ -2926,8 +2926,7 @@
bool FoundBase = false;
if (UseExternalLayout) {
FoundBase = External.getExternalNVBaseOffset(BaseDecl, BaseOffset);
- if (FoundBase) {
- assert(BaseOffset >= Size && "base offset already allocated");
+ if (BaseOffset > Size) {
Size = BaseOffset;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152472.529733.patch
Type: text/x-patch
Size: 507 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230608/d35d63e7/attachment-0001.bin>
More information about the cfe-commits
mailing list