mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-20 12:05:48 -04:00

Summary: We currently don't support offsetof in the expression evaluator as it is implemented as a macro (which then calls __builtin_offsetof) in stddef.h. The best solution would be to include that header (or even better, import Clang's builtin module), but header-parsing and (cross-platform) importing modules is not ready yet. Until we get this working with modules I would say we add the macro to our existing macro list as we already do with other macros from stddef.h/stdint.h. We should be able to drop all of them once we can import the relevant modules by default. rdar://26040641 Reviewers: shafik, davide Reviewed By: davide Subscribers: clayborg, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D64917 llvm-svn: 366476
26 lines
440 B
C++
26 lines
440 B
C++
#include <cstdint>
|
|
|
|
class Base {
|
|
int32_t a;
|
|
};
|
|
class Class1 : Base {
|
|
public:
|
|
int32_t b;
|
|
};
|
|
|
|
class EmptyBase {
|
|
};
|
|
class Class2 : EmptyBase {
|
|
public:
|
|
int32_t b;
|
|
};
|
|
|
|
int main(int argc, char **argv) {
|
|
Class1 c1;
|
|
Class2 c2;
|
|
//% self.expect("expr offsetof(Base, a)", substrs=["= 0"])
|
|
//% self.expect("expr offsetof(Class1, b)", substrs=["= 4"])
|
|
//% self.expect("expr offsetof(Class2, b)", substrs=["= 0"])
|
|
return c1.b + c2.b;
|
|
}
|