r189908 - Documentation fix: remove advice to use cast/dyn_cast on TypeLocs, updating

David Blaikie dblaikie at gmail.com
Tue Sep 3 20:08:08 PDT 2013


On Tue, Sep 3, 2013 at 7:47 PM, James Dennett <jdennett at google.com> wrote:
> Author: jdennett
> Date: Tue Sep  3 21:47:23 2013
> New Revision: 189908
>
> URL: http://llvm.org/viewvc/llvm-project?rev=189908&view=rev
> Log:
> Documentation fix: remove advice to use cast/dyn_cast on TypeLocs, updating
> it to refer to castAs/getAs.
>
> The original change to remove the (broken) cast/dyn_cast support from TypeLoc
> was in r175462.  (Thanks to David Blaikie for the reference.)

Thanks for the doc update - sorry I missed it.

>
> Modified:
>     cfe/trunk/include/clang/AST/TypeLoc.h
>
> Modified: cfe/trunk/include/clang/AST/TypeLoc.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TypeLoc.h?rev=189908&r1=189907&r2=189908&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/AST/TypeLoc.h (original)
> +++ cfe/trunk/include/clang/AST/TypeLoc.h Tue Sep  3 21:47:23 2013
> @@ -6,9 +6,10 @@
>  // License. See LICENSE.TXT for details.
>  //
>  //===----------------------------------------------------------------------===//
> -//
> -//  This file defines the TypeLoc interface and subclasses.
> -//
> +///
> +/// \file
> +/// \brief Defines the clang::TypeLoc interface and its subclasses.
> +///
>  //===----------------------------------------------------------------------===//
>
>  #ifndef LLVM_CLANG_AST_TYPELOC_H
> @@ -34,8 +35,8 @@ namespace clang {
>
>  /// \brief Base wrapper for a particular "section" of type source info.
>  ///
> -/// A client should use the TypeLoc subclasses through cast/dyn_cast in order to
> -/// get at the actual information.
> +/// A client should use the TypeLoc subclasses through castAs()/getAs()
> +/// in order to get at the actual information.
>  class TypeLoc {
>  protected:
>    // The correctness of this relies on the property that, for Type *Ty,
> @@ -46,6 +47,8 @@ protected:
>  public:
>    /// \brief Convert to the specified TypeLoc type, asserting that this TypeLoc
>    /// is of the desired type.
> +  ///
> +  /// \pre T::isKind(*this)
>    template<typename T>
>    T castAs() const {
>      assert(T::isKind(*this));
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list