From 7e7eb3da052a6d80ddf2377cab0384c798f73f75 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Mon, 6 Jul 2009 15:59:29 +0000 Subject: Keep track of the Expr used to describe the size of an array type, from Enea Zaffanella! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74831 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/PCHReader.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'lib/Frontend/PCHReader.cpp') diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp index 95b166159e..7d65c4b658 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -1753,7 +1753,32 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) { unsigned IndexTypeQuals = Record[2]; unsigned Idx = 3; llvm::APInt Size = ReadAPInt(Record, Idx); - return Context->getConstantArrayType(ElementType, Size, ASM,IndexTypeQuals); + return Context->getConstantArrayType(ElementType, Size, + ASM, IndexTypeQuals); + } + + case pch::TYPE_CONSTANT_ARRAY_WITH_EXPR: { + QualType ElementType = GetType(Record[0]); + ArrayType::ArraySizeModifier ASM = (ArrayType::ArraySizeModifier)Record[1]; + unsigned IndexTypeQuals = Record[2]; + SourceLocation LBLoc = SourceLocation::getFromRawEncoding(Record[3]); + SourceLocation RBLoc = SourceLocation::getFromRawEncoding(Record[4]); + unsigned Idx = 5; + llvm::APInt Size = ReadAPInt(Record, Idx); + return Context->getConstantArrayWithExprType(ElementType, + Size, ReadTypeExpr(), + ASM, IndexTypeQuals, + SourceRange(LBLoc, RBLoc)); + } + + case pch::TYPE_CONSTANT_ARRAY_WITHOUT_EXPR: { + QualType ElementType = GetType(Record[0]); + ArrayType::ArraySizeModifier ASM = (ArrayType::ArraySizeModifier)Record[1]; + unsigned IndexTypeQuals = Record[2]; + unsigned Idx = 3; + llvm::APInt Size = ReadAPInt(Record, Idx); + return Context->getConstantArrayWithoutExprType(ElementType, Size, + ASM, IndexTypeQuals); } case pch::TYPE_INCOMPLETE_ARRAY: { @@ -1767,8 +1792,11 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) { QualType ElementType = GetType(Record[0]); ArrayType::ArraySizeModifier ASM = (ArrayType::ArraySizeModifier)Record[1]; unsigned IndexTypeQuals = Record[2]; + SourceLocation LBLoc = SourceLocation::getFromRawEncoding(Record[3]); + SourceLocation RBLoc = SourceLocation::getFromRawEncoding(Record[4]); return Context->getVariableArrayType(ElementType, ReadTypeExpr(), - ASM, IndexTypeQuals); + ASM, IndexTypeQuals, + SourceRange(LBLoc, RBLoc)); } case pch::TYPE_VECTOR: { -- cgit v1.2.3-18-g5258