aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Frontend/PCHBitCodes.h4
-rw-r--r--lib/Frontend/PCHReader.cpp17
-rw-r--r--lib/Frontend/PCHWriter.cpp6
-rw-r--r--test/PCH/cxx-templates.h1
4 files changed, 25 insertions, 3 deletions
diff --git a/include/clang/Frontend/PCHBitCodes.h b/include/clang/Frontend/PCHBitCodes.h
index fec40c825d..9bb537a490 100644
--- a/include/clang/Frontend/PCHBitCodes.h
+++ b/include/clang/Frontend/PCHBitCodes.h
@@ -425,7 +425,9 @@ namespace clang {
/// \brief A DependentNameType record.
TYPE_DEPENDENT_NAME = 31,
/// \brief A DependentTemplateSpecializationType record.
- TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION = 32
+ TYPE_DEPENDENT_TEMPLATE_SPECIALIZATION = 32,
+ /// \brief A DependentSizedArrayType record.
+ TYPE_DEPENDENT_SIZED_ARRAY = 33
};
/// \brief The type IDs for special types constructed by semantic
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index a526fd6dc5..b5ddc86369 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -2226,6 +2226,23 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) {
return Context->getDependentTemplateSpecializationType(Keyword, NNS, Name,
Args.size(), Args.data());
}
+
+ case pch::TYPE_DEPENDENT_SIZED_ARRAY: {
+ unsigned Idx = 0;
+
+ // ArrayType
+ QualType ElementType = GetType(Record[Idx++]);
+ ArrayType::ArraySizeModifier ASM
+ = (ArrayType::ArraySizeModifier)Record[Idx++];
+ unsigned IndexTypeQuals = Record[Idx++];
+
+ // DependentSizedArrayType
+ Expr *NumElts = ReadExpr();
+ SourceRange Brackets = ReadSourceRange(Record, Idx);
+
+ return Context->getDependentSizedArrayType(ElementType, NumElts, ASM,
+ IndexTypeQuals, Brackets);
+ }
case pch::TYPE_TEMPLATE_SPECIALIZATION: {
unsigned Idx = 0;
diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp
index d947f7250d..41815314d7 100644
--- a/lib/Frontend/PCHWriter.cpp
+++ b/lib/Frontend/PCHWriter.cpp
@@ -230,8 +230,10 @@ PCHTypeWriter::VisitTemplateSpecializationType(
void
PCHTypeWriter::VisitDependentSizedArrayType(const DependentSizedArrayType *T) {
- // FIXME: Serialize this type (C++ only)
- assert(false && "Cannot serialize dependent sized array types");
+ VisitArrayType(T);
+ Writer.AddStmt(T->getSizeExpr());
+ Writer.AddSourceRange(T->getBracketsRange(), Record);
+ Code = pch::TYPE_DEPENDENT_SIZED_ARRAY;
}
void
diff --git a/test/PCH/cxx-templates.h b/test/PCH/cxx-templates.h
index bfc0def146..c089e1c5a9 100644
--- a/test/PCH/cxx-templates.h
+++ b/test/PCH/cxx-templates.h
@@ -22,6 +22,7 @@ template <typename T, int y>
T templ_f(T x) {
int z = templ_f<int, 5>(3);
z = tmpl_f2<y+2>();
+ T data[y];
return x+y;
}