Class ArrayType

All Implemented Interfaces:
ASTLocusTag.ASTLocusTagProvider, TypeComparator.SemanticEqualityOp, Cloneable

public class ArrayType extends MemoryLayoutType implements Cloneable
Represents an array type. This differs from a pointer type in C syntax by the use of "[]" rather than "*". The length may or may not be known; if the length is unknown then a negative number should be passed in to the constructor.
  • Constructor Details

    • ArrayType

      public ArrayType(Type elementType, SizeThunk sizeInBytes, int length, int cvAttributes)
    • ArrayType

      public ArrayType(Type elementType, SizeThunk sizeInBytes, int length, int cvAttributes, ASTLocusTag astLocus)
  • Method Details

    • hashCodeImpl

      protected int hashCodeImpl()
      Specified by:
      hashCodeImpl in class Type
    • equalsImpl

      protected boolean equalsImpl(Type arg)
      Specified by:
      equalsImpl in class Type
    • hashCodeSemanticsImpl

      protected int hashCodeSemanticsImpl()
      Specified by:
      hashCodeSemanticsImpl in class Type
    • equalSemanticsImpl

      protected boolean equalSemanticsImpl(Type arg)
      Specified by:
      equalSemanticsImpl in class Type
    • isAnon

      public boolean isAnon()
      Overrides:
      isAnon in class Type
    • getName

      public String getName(boolean includeCVAttrs)
      Description copied from class: Type
      Returns the name of this type, optionally including const/volatile attributes. The returned string is suitable for use as a type specifier for Java.
      Overrides:
      getName in class Type
    • asArray

      public final ArrayType asArray()
      Description copied from class: Type
      Casts this to an ArrayType or returns null if not an ArrayType.
      Overrides:
      asArray in class Type
    • getElementType

      public Type getElementType()
    • getLength

      public int getLength()
    • hasLength

      public boolean hasLength()
    • getBaseElementType

      public final Type getBaseElementType()
      Description copied from class: Type
      Helper method to returns the bottom-most element type of this type.

      If this is a multidimensional array or pointer method returns the bottom-most element type, otherwise this.

      Overrides:
      getBaseElementType in class Type
    • arrayDimension

      public final int arrayDimension()
      Description copied from class: Type
      Helper method for determining how many array dimentions this type represents (i.e., "char[][]" returns 2). Returns 0 if this type is not an array type.
      Overrides:
      arrayDimension in class Type
    • toString

      public String toString()
      Description copied from class: Type
      Returns a string representation of this type. The returned string is suitable for use as a type specifier for native C. It does contain an expanded description of structs/unions, hence may not be suitable for type declarations.
      Overrides:
      toString in class Type
    • toString

      public String toString(String variableName)
    • visit

      public void visit(TypeVisitor arg)
      Description copied from class: Type
      Traverse this Type and all of its component types; for example, the return type and argument types of a FunctionType.
      Overrides:
      visit in class Type