mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-25 22:38:56 -04:00

It's always hard to remember when to include this file, and when you do include it it's hard to remember what preprocessor check it needs to be behind, and then you further have to remember whether it's windows.h or win32.h which you need to include. This patch changes the name to PosixApi.h, which is more appropriately named, and makes it independent of any preprocessor setting. There's still the issue of people not knowing when to include this, because there's not a well-defined set of things it exposes other than "whatever is missing on Windows", but at least this should make it less painful to fix when problems arise. This patch depends on LLVM revision r278170. llvm-svn: 278177
117 lines
2.4 KiB
C++
117 lines
2.4 KiB
C++
#include <stdio.h>
|
|
#include <stdint.h>
|
|
|
|
class A
|
|
{
|
|
public:
|
|
A () : m_pad ('c') {}
|
|
|
|
virtual ~A () {}
|
|
|
|
virtual const char * a()
|
|
{
|
|
return LLVM_PRETTY_FUNCTION;
|
|
}
|
|
|
|
virtual const char * b()
|
|
{
|
|
return LLVM_PRETTY_FUNCTION;
|
|
}
|
|
|
|
virtual const char * c()
|
|
{
|
|
return LLVM_PRETTY_FUNCTION;
|
|
}
|
|
protected:
|
|
char m_pad;
|
|
};
|
|
|
|
class AA
|
|
{
|
|
public:
|
|
AA () : m_pad('A') {}
|
|
virtual ~AA () {}
|
|
|
|
virtual const char * aa()
|
|
{
|
|
return LLVM_PRETTY_FUNCTION;
|
|
}
|
|
|
|
protected:
|
|
char m_pad;
|
|
};
|
|
|
|
class B : virtual public A, public AA
|
|
{
|
|
public:
|
|
B () : m_pad ('c') {}
|
|
|
|
virtual ~B () {}
|
|
|
|
virtual const char * a()
|
|
{
|
|
return LLVM_PRETTY_FUNCTION;
|
|
}
|
|
|
|
virtual const char * b()
|
|
{
|
|
return LLVM_PRETTY_FUNCTION;
|
|
}
|
|
protected:
|
|
char m_pad;
|
|
};
|
|
|
|
class C : public B, virtual public A
|
|
{
|
|
public:
|
|
C () : m_pad ('c') {}
|
|
|
|
virtual ~C () {}
|
|
|
|
virtual const char * a()
|
|
{
|
|
return LLVM_PRETTY_FUNCTION;
|
|
}
|
|
protected:
|
|
char m_pad;
|
|
};
|
|
|
|
int main (int argc, char const *argv[], char const *envp[])
|
|
{
|
|
A *a_as_A = new A();
|
|
B *b_as_B = new B();
|
|
A *b_as_A = b_as_B;
|
|
C *c_as_C = new C();
|
|
A *c_as_A = c_as_C;
|
|
|
|
char golden[4096];
|
|
char *p = golden;
|
|
char *end = p + sizeof golden;
|
|
p += snprintf(p, end-p, "a_as_A->a() = '%s'\n", a_as_A->a());
|
|
p += snprintf(p, end-p, "a_as_A->b() = '%s'\n", a_as_A->b());
|
|
p += snprintf(p, end-p, "a_as_A->c() = '%s'\n", a_as_A->c());
|
|
p += snprintf(p, end-p, "b_as_A->a() = '%s'\n", b_as_A->a());
|
|
p += snprintf(p, end-p, "b_as_A->b() = '%s'\n", b_as_A->b());
|
|
p += snprintf(p, end-p, "b_as_A->c() = '%s'\n", b_as_A->c());
|
|
p += snprintf(p, end-p, "b_as_B->aa() = '%s'\n", b_as_B->aa());
|
|
p += snprintf(p, end-p, "c_as_A->a() = '%s'\n", c_as_A->a());
|
|
p += snprintf(p, end-p, "c_as_A->b() = '%s'\n", c_as_A->b());
|
|
p += snprintf(p, end-p, "c_as_A->c() = '%s'\n", c_as_A->c());
|
|
p += snprintf(p, end-p, "c_as_C->aa() = '%s'\n", c_as_C->aa());
|
|
puts("");// Set first breakpoint here.
|
|
// then evaluate:
|
|
// expression a_as_A->a()
|
|
// expression a_as_A->b()
|
|
// expression a_as_A->c()
|
|
// expression b_as_A->a()
|
|
// expression b_as_A->b()
|
|
// expression b_as_A->c()
|
|
// expression b_as_B->aa()
|
|
// expression c_as_A->a()
|
|
// expression c_as_A->b()
|
|
// expression c_as_A->c()
|
|
// expression c_as_C->aa()
|
|
|
|
return 0;
|
|
}
|