diff options
Diffstat (limited to 'include/llvm/Support/Casting.h')
-rw-r--r-- | include/llvm/Support/Casting.h | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/include/llvm/Support/Casting.h b/include/llvm/Support/Casting.h index dccbfadfa3051..c589171bbafe6 100644 --- a/include/llvm/Support/Casting.h +++ b/include/llvm/Support/Casting.h @@ -236,73 +236,6 @@ inline typename cast_retty<X, Y>::ret_type dyn_cast_or_null(const Y &Val) { return (Val && isa<X>(Val)) ? cast<X, Y>(Val) : 0; } - -#ifdef DEBUG_CAST_OPERATORS -#include "llvm/Support/raw_ostream.h" - -struct bar { - bar() {} -private: - bar(const bar &); -}; -struct foo { - void ext() const; - /* static bool classof(const bar *X) { - cerr << "Classof: " << X << "\n"; - return true; - }*/ -}; - -template <> struct isa_impl<foo,bar> { - static inline bool doit(const bar &Val) { - dbgs() << "Classof: " << &Val << "\n"; - return true; - } -}; - - -bar *fub(); -void test(bar &B1, const bar *B2) { - // test various configurations of const - const bar &B3 = B1; - const bar *const B4 = B2; - - // test isa - if (!isa<foo>(B1)) return; - if (!isa<foo>(B2)) return; - if (!isa<foo>(B3)) return; - if (!isa<foo>(B4)) return; - - // test cast - foo &F1 = cast<foo>(B1); - const foo *F3 = cast<foo>(B2); - const foo *F4 = cast<foo>(B2); - const foo &F8 = cast<foo>(B3); - const foo *F9 = cast<foo>(B4); - foo *F10 = cast<foo>(fub()); - - // test cast_or_null - const foo *F11 = cast_or_null<foo>(B2); - const foo *F12 = cast_or_null<foo>(B2); - const foo *F13 = cast_or_null<foo>(B4); - const foo *F14 = cast_or_null<foo>(fub()); // Shouldn't print. - - // These lines are errors... - //foo *F20 = cast<foo>(B2); // Yields const foo* - //foo &F21 = cast<foo>(B3); // Yields const foo& - //foo *F22 = cast<foo>(B4); // Yields const foo* - //foo &F23 = cast_or_null<foo>(B1); - //const foo &F24 = cast_or_null<foo>(B3); -} - -bar *fub() { return 0; } -void main() { - bar B; - test(B, &B); -} - -#endif - } // End llvm namespace #endif |