From: Chris Lattner Date: Sun, 4 May 2008 01:11:46 +0000 (+0000) Subject: improve array type comments. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=da2d71a50fe724c881b148fcc2c05a5e9b56e3a5;p=clang improve array type comments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50609 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h index 313c243c4f..8781ff309e 100644 --- a/include/clang/AST/Type.h +++ b/include/clang/AST/Type.h @@ -618,6 +618,9 @@ public: static bool classof(const ArrayType *) { return true; } }; +/// ConstantArrayType - This class represents C arrays with a specified constant +/// size. For example 'int A[100]' has ConstantArrayType where the element type +/// is 'int' and the size is 100. class ConstantArrayType : public ArrayType { llvm::APInt Size; // Allows us to unique the type. @@ -660,6 +663,9 @@ protected: friend class Type; }; +/// IncompleteArrayType - This class represents C arrays with an unspecified +/// size. For example 'int A[]' has an IncompleteArrayType where the element +/// type is 'int' and the size is unspecified. class IncompleteArrayType : public ArrayType { IncompleteArrayType(QualType et, QualType can, ArraySizeModifier sm, unsigned tq) @@ -690,7 +696,21 @@ protected: friend class Type; }; -// FIXME: VariableArrayType's aren't uniqued (since expressions aren't). +/// VariableArrayType - This class represents C arrays with a specified size +/// which is not an integer-constant-expression. For example, 'int s[x+foo()]'. +/// Since the size expression is an arbitrary expression, we store it as such. +/// +/// Note: VariableArrayType's aren't uniqued (since the expressions aren't) and +/// should not be: two lexically equivalent variable array types could mean +/// different things, for example, these variables do not have the same type +/// dynamically: +/// +/// void foo(int x) { +/// int Y[x]; +/// ++x; +/// int Z[x]; +/// } +/// class VariableArrayType : public ArrayType { /// SizeExpr - An assignment expression. VLA's are only permitted within /// a function block.