diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-08-07 22:49:24 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-08-07 22:49:24 +0000 |
| commit | 885e6382eb6aa3604cc931d11df78c9ec31b0740 (patch) | |
| tree | 1c4bd54ea73e3d90fbc93b31bbf73888936e9079 /llvm/utils/unittest | |
| parent | d9f952948e7f17a13b6068818238e66cf9ff7e2b (diff) | |
| download | bcm5719-llvm-885e6382eb6aa3604cc931d11df78c9ec31b0740.tar.gz bcm5719-llvm-885e6382eb6aa3604cc931d11df78c9ec31b0740.zip | |
Modifications to dyn_cast/cast to make them work for objects too, instead of only pointers.
The use case is if you have a wrapper class:
class Base {
void *Ptr;
public:
Base() : Ptr(0) { }
operator bool() const { return Ptr; }
.....
}
and sub-wrappers that have exactly the same size:
class Sub : public Base {
public:
....
static bool classof(const Base*);
}
and in the code you would do:
void f(Base b) {
Sub sub = dyn_cast<Sub>(b);
if (sub) {
....
}
}
llvm-svn: 78424
Diffstat (limited to 'llvm/utils/unittest')
0 files changed, 0 insertions, 0 deletions

