Implemented serialization of UnaryOperator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43858 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/AST/StmtSerialization.cpp b/AST/StmtSerialization.cpp
index 91caff8..437d8c6 100644
--- a/AST/StmtSerialization.cpp
+++ b/AST/StmtSerialization.cpp
@@ -119,6 +119,9 @@
case SwitchStmtClass:
return SwitchStmt::directMaterialize(D);
+ case UnaryOperatorClass:
+ return UnaryOperator::directMaterialize(D);
+
case WhileStmtClass:
return WhileStmt::directMaterialize(D);
}
@@ -532,6 +535,21 @@
return stmt;
}
+void UnaryOperator::directEmit(Serializer& S) const {
+ S.Emit(getType());
+ S.Emit(Loc);
+ S.EmitInt(Opc);
+ S.EmitOwnedPtr(Val);
+}
+
+UnaryOperator* UnaryOperator::directMaterialize(Deserializer& D) {
+ QualType t = QualType::ReadVal(D);
+ SourceLocation L = SourceLocation::ReadVal(D);
+ Opcode Opc = static_cast<Opcode>(D.ReadInt());
+ Expr* Val = D.ReadOwnedPtr<Expr>();
+ return new UnaryOperator(Val,Opc,t,L);
+}
+
void WhileStmt::directEmit(Serializer& S) const {
S.Emit(WhileLoc);
S.EmitOwnedPtr(getCond());