forked from OSchip/llvm-project
Modified serialization of BinaryOperator and CaseStmt to use the new
BatchEmitOwnedPtrs() and BatchReadOwnedPtrs() methods. Modified serialization of all Stmts to start their own record in the bitstream. llvm-svn: 43846
This commit is contained in:
parent
e079cb7b08
commit
9d2bf704de
|
@ -19,6 +19,7 @@
|
||||||
using namespace clang;
|
using namespace clang;
|
||||||
|
|
||||||
void Stmt::Emit(llvm::Serializer& S) const {
|
void Stmt::Emit(llvm::Serializer& S) const {
|
||||||
|
S.FlushRecord();
|
||||||
S.EmitInt(getStmtClass());
|
S.EmitInt(getStmtClass());
|
||||||
directEmit(S);
|
directEmit(S);
|
||||||
}
|
}
|
||||||
|
@ -112,16 +113,16 @@ void BinaryOperator::directEmit(llvm::Serializer& S) const {
|
||||||
S.EmitInt(Opc);
|
S.EmitInt(Opc);
|
||||||
S.Emit(OpLoc);;
|
S.Emit(OpLoc);;
|
||||||
S.Emit(getType());
|
S.Emit(getType());
|
||||||
S.EmitOwnedPtr(getLHS());
|
S.BatchEmitOwnedPtrs(getLHS(),getRHS());
|
||||||
S.EmitOwnedPtr(getRHS());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BinaryOperator* BinaryOperator::directMaterialize(llvm::Deserializer& D) {
|
BinaryOperator* BinaryOperator::directMaterialize(llvm::Deserializer& D) {
|
||||||
Opcode Opc = static_cast<Opcode>(D.ReadInt());
|
Opcode Opc = static_cast<Opcode>(D.ReadInt());
|
||||||
SourceLocation OpLoc = SourceLocation::ReadVal(D);
|
SourceLocation OpLoc = SourceLocation::ReadVal(D);
|
||||||
QualType Result = QualType::ReadVal(D);
|
QualType Result = QualType::ReadVal(D);
|
||||||
Expr* LHS = D.ReadOwnedPtr<Expr>();
|
Expr *LHS, *RHS;
|
||||||
Expr* RHS = D.ReadOwnedPtr<Expr>();
|
D.BatchReadOwnedPtrs(LHS,RHS);
|
||||||
|
|
||||||
return new BinaryOperator(LHS,RHS,Opc,Result,OpLoc);
|
return new BinaryOperator(LHS,RHS,Opc,Result,OpLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,21 +137,18 @@ BreakStmt* BreakStmt::directMaterialize(llvm::Deserializer& D) {
|
||||||
|
|
||||||
void CaseStmt::directEmit(llvm::Serializer& S) const {
|
void CaseStmt::directEmit(llvm::Serializer& S) const {
|
||||||
S.Emit(CaseLoc);
|
S.Emit(CaseLoc);
|
||||||
S.EmitOwnedPtr(getLHS());
|
|
||||||
S.EmitOwnedPtr(getRHS());
|
|
||||||
S.EmitOwnedPtr(getSubStmt());
|
|
||||||
S.EmitPtr(getNextSwitchCase());
|
S.EmitPtr(getNextSwitchCase());
|
||||||
|
S.BatchEmitOwnedPtrs(getLHS(),getRHS(),getSubStmt());
|
||||||
}
|
}
|
||||||
|
|
||||||
CaseStmt* CaseStmt::directMaterialize(llvm::Deserializer& D) {
|
CaseStmt* CaseStmt::directMaterialize(llvm::Deserializer& D) {
|
||||||
SourceLocation CaseLoc = SourceLocation::ReadVal(D);
|
SourceLocation CaseLoc = SourceLocation::ReadVal(D);
|
||||||
Expr* LHS = D.ReadOwnedPtr<Expr>();
|
Expr *LHS, *RHS;
|
||||||
Expr* RHS = D.ReadOwnedPtr<Expr>();
|
Stmt* SubStmt;
|
||||||
Stmt* SubStmt = D.ReadOwnedPtr<Stmt>();
|
D.BatchReadOwnedPtrs(LHS,RHS,SubStmt);
|
||||||
|
|
||||||
CaseStmt* stmt = new CaseStmt(LHS,RHS,SubStmt,CaseLoc);
|
CaseStmt* stmt = new CaseStmt(LHS,RHS,SubStmt,CaseLoc);
|
||||||
stmt->setNextSwitchCase(D.ReadPtr<SwitchCase>());
|
stmt->setNextSwitchCase(D.ReadPtr<SwitchCase>());
|
||||||
|
|
||||||
return stmt;
|
return stmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue