summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-05-04 01:11:46 +0000
committerChris Lattner <sabre@nondot.org>2008-05-04 01:11:46 +0000
commitc8cb4ca20212284652e6e92c216d229f935e2537 (patch)
tree3496e529c9aadc59da0b60dc01b843dd7c229bde
parent033352b036080ac0b07c93d9bde1e5897525a0bd (diff)
downloadbcm5719-llvm-c8cb4ca20212284652e6e92c216d229f935e2537.tar.gz
bcm5719-llvm-c8cb4ca20212284652e6e92c216d229f935e2537.zip
improve array type comments.
llvm-svn: 50609
-rw-r--r--clang/include/clang/AST/Type.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 313c243c4fa..8781ff309e2 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/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.
OpenPOWER on IntegriCloud