Fix broken PCH support for CXXDefaultArgExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107541 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/PCHWriterStmt.cpp b/lib/Frontend/PCHWriterStmt.cpp
index 11b1afd..12fcde8 100644
--- a/lib/Frontend/PCHWriterStmt.cpp
+++ b/lib/Frontend/PCHWriterStmt.cpp
@@ -983,13 +983,14 @@
void PCHStmtWriter::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E) {
VisitExpr(E);
- Writer.AddSourceLocation(E->getUsedLocation(), Record);
- if (E->isExprStored()) {
- Record.push_back(1);
+
+ bool HasOtherExprStored = E->Param.getInt();
+ // Store these first, the reader reads them before creation.
+ Record.push_back(HasOtherExprStored);
+ if (HasOtherExprStored)
Writer.AddStmt(E->getExpr());
- } else {
- Record.push_back(0);
- }
+ Writer.AddDeclRef(E->getParam(), Record);
+ Writer.AddSourceLocation(E->getUsedLocation(), Record);
Code = pch::EXPR_CXX_DEFAULT_ARG;
}