xref: /llvm-project/lldb/test/API/lang/cpp/alignas_base_class/TestAlignAsBaseClass.py (revision 46e848a23b212204b01abdc898a53b553d9a57c0)
163b0f8c7Sshafikimport lldb
263b0f8c7Sshafikfrom lldbsuite.test.decorators import *
363b0f8c7Sshafikfrom lldbsuite.test.lldbtest import *
463b0f8c7Sshafikfrom lldbsuite.test import lldbutil
563b0f8c7Sshafik
663b0f8c7Sshafik
72238dcc3SJonas Devlieghereclass TestCase(TestBase):
863b0f8c7Sshafik    @no_debug_info_test
963b0f8c7Sshafik    def test(self):
1063b0f8c7Sshafik        self.build()
1163b0f8c7Sshafik        self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
1263b0f8c7Sshafik
1363b0f8c7Sshafik        # The offset of f2 should be 8 because of `alignas(8)`.
1463b0f8c7Sshafik        self.expect_expr("(intptr_t)&d3g.f2 - (intptr_t)&d3g", result_value="8")
15439b16e2SHaojian Wu
16439b16e2SHaojian Wu        # Verify specified class alignments.
17439b16e2SHaojian Wu        self.expect_expr("alignof(B2)", result_value="8")
18439b16e2SHaojian Wu        self.expect_expr("alignof(EmptyClassAlign8)", result_value="8")
19*46e848a2SMichael Buch        self.expect_expr("alignof(Derived)", result_value="8")
20