[llvm-commits] [llvm] r95557 - /llvm/trunk/include/llvm/Type.h

Chris Lattner clattner at apple.com
Mon Feb 8 12:51:59 PST 2010


On Feb 8, 2010, at 11:36 AM, Duncan Sands wrote:

> Author: baldrick
> Date: Mon Feb  8 13:36:51 2010
> New Revision: 95557
>
> URL: http://llvm.org/viewvc/llvm-project?rev=95557&view=rev
> Log:
> Flesh out the list of predicates, for those who like this style.  I  
> was
> looking for isPointer, and added the rest for uniformity.

Why not just use isa<PointerType>?

This encourages code to diverge in style.

-Chris

>
> Modified:
>    llvm/trunk/include/llvm/Type.h
>
> Modified: llvm/trunk/include/llvm/Type.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Type.h?rev=95557&r1=95556&r2=95557&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/include/llvm/Type.h (original)
> +++ llvm/trunk/include/llvm/Type.h Mon Feb  8 13:36:51 2010
> @@ -233,7 +233,27 @@
>   /// isFPOrFPVector - Return true if this is a FP type or a vector  
> of FP types.
>   ///
>   bool isFPOrFPVector() const;
> -
> +
> +  /// isFunction - True if this is an instance of FunctionType.
> +  ///
> +  bool isFunction() const { return ID == FunctionTyID; }
> +
> +  /// isStruct - True if this is an instance of StructType.
> +  ///
> +  bool isStruct() const { return ID == StructTyID; }
> +
> +  /// isArray - True if this is an instance of ArrayType.
> +  ///
> +  bool isArray() const { return ID == ArrayTyID; }
> +
> +  /// isPointer - True if this is an instance of PointerType.
> +  ///
> +  bool isPointer() const { return ID == PointerTyID; }
> +
> +  /// isVector - True if this is an instance of VectorType.
> +  ///
> +  bool isVector() const { return ID == VectorTyID; }
> +
>   /// isAbstract - True if the type is either an Opaque type, or is  
> a derived
>   /// type that includes an opaque type somewhere in it.
>   ///
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list