diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/include/clang/AST/CanonicalType.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/include/clang/AST/CanonicalType.h b/clang/include/clang/AST/CanonicalType.h index 38e6b41977f..6cce88868db 100644 --- a/clang/include/clang/AST/CanonicalType.h +++ b/clang/include/clang/AST/CanonicalType.h @@ -108,6 +108,8 @@ public: /// or a derived class thereof, a NULL canonical type. template<typename U> CanProxy<U> getAs() const; + template<typename U> CanProxy<U> castAs() const; + /// \brief Overloaded arrow operator that produces a canonical type /// proxy. CanProxy<T> operator->() const; @@ -753,6 +755,13 @@ CanProxy<U> CanQual<T>::getAs() const { } template<typename T> +template<typename U> +CanProxy<U> CanQual<T>::castAs() const { + assert(!Stored.isNull() && isa<U>(Stored.getTypePtr())); + return CanQual<U>::CreateUnsafe(Stored); +} + +template<typename T> CanProxy<T> CanQual<T>::operator->() const { return CanProxy<T>(*this); } |