1#include <cstdint>
2
3class Base {
4 int32_t a;
5};
6class Class1 : Base {
7public:
8 int32_t b;
9};
10
11class EmptyBase {
12};
13class Class2 : EmptyBase {
14public:
15 int32_t b;
16};
17
18int main(int argc, char **argv) {
19 Class1 c1;
20 Class2 c2;
21 //% self.expect("expr offsetof(Base, a)", substrs=["= 0"])
22 //% self.expect("expr offsetof(Class1, b)", substrs=["= 4"])
23 //% self.expect("expr offsetof(Class2, b)", substrs=["= 0"])
24 return c1.b + c2.b;
25}
26

source code of lldb/test/API/lang/cpp/offsetof/main.cpp