Fix serialization of uninstantiated exception specifications. Patch by Li Kan,
test by me.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155289 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index 06b42f3..fd0c171 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -3866,6 +3866,9 @@
EPI.Exceptions = Exceptions.data();
} else if (EST == EST_ComputedNoexcept) {
EPI.NoexceptExpr = ReadExpr(*Loc.F);
+ } else if (EST == EST_Uninstantiated) {
+ EPI.ExceptionSpecDecl = ReadDeclAs<FunctionDecl>(*Loc.F, Record, Idx);
+ EPI.ExceptionSpecTemplate = ReadDeclAs<FunctionDecl>(*Loc.F, Record, Idx);
}
return Context.getFunctionType(ResultType, ParamTypes.data(), NumParams,
EPI);
diff --git a/lib/Serialization/ASTWriter.cpp b/lib/Serialization/ASTWriter.cpp
index e9c0596..29ea01b 100644
--- a/lib/Serialization/ASTWriter.cpp
+++ b/lib/Serialization/ASTWriter.cpp
@@ -195,6 +195,9 @@
Writer.AddTypeRef(T->getExceptionType(I), Record);
} else if (T->getExceptionSpecType() == EST_ComputedNoexcept) {
Writer.AddStmt(T->getNoexceptExpr());
+ } else if (T->getExceptionSpecType() == EST_Uninstantiated) {
+ Writer.AddDeclRef(T->getExceptionSpecDecl(), Record);
+ Writer.AddDeclRef(T->getExceptionSpecTemplate(), Record);
}
Code = TYPE_FUNCTION_PROTO;
}