On Oct 14, 2008, at 9:57 AM, Daniel Dunbar wrote:

> +void ShuffleVectorExpr::EmitImpl(llvm::Serializer& S) const {
> +  S.Emit(getType());
> +  S.Emit(BuiltinLoc);
> +  S.Emit(RParenLoc);
> +  S.EmitInt(NumExprs);
> +  for (unsigned i = 0; i < NumExprs; ++i)
> +    S.EmitOwnedPtr(getExpr(i));
> +}
> +
> +ShuffleVectorExpr*  
> ShuffleVectorExpr::CreateImpl(llvm::Deserializer& D,
> +                                                 ASTContext& C) {
> +  QualType T = QualType::ReadVal(D);
> +  SourceLocation BL = SourceLocation::ReadVal(D);
> +  SourceLocation RP = SourceLocation::ReadVal(D);
> +  unsigned NumExprs = D.ReadInt();
> +  llvm::SmallVector<Expr*, 4> Exprs(NumExprs);
> +  for (unsigned i = 0; i < NumExprs; ++i)
> +    Exprs[i] = D.ReadOwnedPtr<Expr>(C);
> +
> +  return new ShuffleVectorExpr(Exprs.begin(), NumExprs, T, BL, RP);
> +}

Daniel,

You might want to consider using BatchEmitOwnedPtr instead of emitting  
each owned pointer out separately using EmitOwnedPtr.  It has two  
benefits:

(a) less code

(b) smaller footprint on disk (all of the persistent pointers are  
stored together, followed by the separate records for each object they  
point to).

Ted
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to