Read/write C++0x static_assert for PCH.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109123 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/PCHReaderDecl.cpp b/lib/Frontend/PCHReaderDecl.cpp
index 7297fef..d1f8b3a 100644
--- a/lib/Frontend/PCHReaderDecl.cpp
+++ b/lib/Frontend/PCHReaderDecl.cpp
@@ -1035,7 +1035,9 @@
}
void PCHDeclReader::VisitStaticAssertDecl(StaticAssertDecl *D) {
- assert(false && "cannot read StaticAssertDecl");
+ VisitDecl(D);
+ D->AssertExpr = Reader.ReadExpr();
+ D->Message = cast<StringLiteral>(Reader.ReadExpr());
}
std::pair<uint64_t, uint64_t>
@@ -1412,7 +1414,7 @@
D = TemplateTemplateParmDecl::Create(*Context, 0, SourceLocation(),0,0,0,0);
break;
case pch::DECL_STATIC_ASSERT:
- assert(false && "cannot read StaticAssertDecl");
+ D = StaticAssertDecl::Create(*Context, 0, SourceLocation(), 0, 0);
break;
case pch::DECL_OBJC_METHOD:
diff --git a/lib/Frontend/PCHWriterDecl.cpp b/lib/Frontend/PCHWriterDecl.cpp
index 122bd3d..f6c6cde 100644
--- a/lib/Frontend/PCHWriterDecl.cpp
+++ b/lib/Frontend/PCHWriterDecl.cpp
@@ -989,7 +989,10 @@
}
void PCHDeclWriter::VisitStaticAssertDecl(StaticAssertDecl *D) {
- assert(false && "cannot write StaticAssertDecl");
+ VisitDecl(D);
+ Writer.AddStmt(D->getAssertExpr());
+ Writer.AddStmt(D->getMessage());
+ Code = pch::DECL_STATIC_ASSERT;
}
/// \brief Emit the DeclContext part of a declaration context decl.