From: Ted Kremenek Date: Tue, 30 Oct 2007 16:41:53 +0000 (+0000) Subject: Added vector to ASTContext to store references to "complete" VLA types X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=347b9f33b3216459bcf60cdd52c739fa3028321e;p=clang Added vector to ASTContext to store references to "complete" VLA types (VLAs with a specified size expresssion). This vector owns the references to these type objects. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43502 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/AST/ASTContext.cpp b/AST/ASTContext.cpp index ba8ee077c5..ee45c00831 100644 --- a/AST/ASTContext.cpp +++ b/AST/ASTContext.cpp @@ -455,10 +455,10 @@ QualType ASTContext::getVariableArrayType(QualType EltTy, Expr *NumElts, // Since we don't unique expressions, it isn't possible to unique VLA's // that have an expression provided for their size. - ArrayType *New = new VariableArrayType(EltTy, QualType(), NumElts, - ASM, EltTypeQuals); + VariableArrayType *New = new VariableArrayType(EltTy, QualType(), NumElts, + ASM, EltTypeQuals); - // FIXME: Also add non-uniqued VLAs into a list of their own. + CompleteVariableArrayTypes.push_back(New); Types.push_back(New); return QualType(New, 0); } diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index 9adb35aca2..dda0490f24 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -36,6 +36,7 @@ class ASTContext { llvm::FoldingSet ReferenceTypes; llvm::FoldingSet ArrayTypes; llvm::FoldingSet IncompleteVariableArrayTypes; + std::vector CompleteVariableArrayTypes; llvm::FoldingSet VectorTypes; llvm::FoldingSet FunctionTypeNoProtos; llvm::FoldingSet FunctionTypeProtos; @@ -90,7 +91,7 @@ public: ~ASTContext(); void PrintStats() const; - + //===--------------------------------------------------------------------===// // Type Constructors //===--------------------------------------------------------------------===//