[Lldb-commits] [PATCH] D83008: Fix ItaniumRecordLayoutBuilder so that is grabs the correct bases class offsets from the external source
Shafik Yaghmour via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Jul 8 10:07:30 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG63b0f8c788d8: [RecordLayout] Fix ItaniumRecordLayoutBuilder so that is grabs the correct… (authored by shafik).
Herald added projects: clang, LLDB.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83008/new/
https://reviews.llvm.org/D83008
Files:
clang/lib/AST/RecordLayoutBuilder.cpp
lldb/test/API/lang/cpp/alignas_base_class/Makefile
lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
lldb/test/API/lang/cpp/alignas_base_class/main.cpp
Index: lldb/test/API/lang/cpp/alignas_base_class/main.cpp
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/alignas_base_class/main.cpp
@@ -0,0 +1,13 @@
+struct B1 {
+ char f1;
+};
+
+struct alignas(8) B2 {
+ char f2;
+};
+
+struct D : B1, B2 {};
+
+D d3g;
+
+int main() {}
Index: lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py
@@ -0,0 +1,16 @@
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @no_debug_info_test
+ def test(self):
+ self.build()
+ self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
+
+ # The offset of f2 should be 8 because of `alignas(8)`.
+ self.expect_expr("(intptr_t)&d3g.f2 - (intptr_t)&d3g", result_value="8")
Index: lldb/test/API/lang/cpp/alignas_base_class/Makefile
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/alignas_base_class/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
Index: clang/lib/AST/RecordLayoutBuilder.cpp
===================================================================
--- clang/lib/AST/RecordLayoutBuilder.cpp
+++ clang/lib/AST/RecordLayoutBuilder.cpp
@@ -1187,11 +1187,10 @@
// Query the external layout to see if it provides an offset.
bool HasExternalLayout = false;
if (UseExternalLayout) {
- // FIXME: This appears to be reversed.
if (Base->IsVirtual)
- HasExternalLayout = External.getExternalNVBaseOffset(Base->Class, Offset);
- else
HasExternalLayout = External.getExternalVBaseOffset(Base->Class, Offset);
+ else
+ HasExternalLayout = External.getExternalNVBaseOffset(Base->Class, Offset);
}
// Clang <= 6 incorrectly applied the 'packed' attribute to base classes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83008.276475.patch
Type: text/x-patch
Size: 2096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200708/dd0a0c09/attachment.bin>
More information about the lldb-commits
mailing list