rnk added a comment.

The `Expected<std::tuple<Ts...>>` and `std::tie<Ts...>` instantiations are 
still expensive, and they seem avoidable. We could use this code pattern 
instead:

  ExpectedType
  ASTNodeImporter::VisitVariableArrayType(const VariableArrayType *T) {
    QualType ToElementType = T->getElementType();
    Expr *ToSizeExpr = T->getSizeExpr();
    SourceRange ToBracketsRange = T->getBracketsRange();
    if (Error E = importSeq(ToElementType, ToSizeExpr, ToBracketsRange))
      return E;
  
    return Importer.getToContext().getVariableArrayType(
        ToElementType, ToSizeExpr, T->getSizeModifier(),
        T->getIndexTypeCVRQualifiers(), ToBracketsRange);
  }

Compare to the current pattern:
https://github.com/llvm/llvm-project/blob/master/clang/lib/AST/ASTImporter.cpp#L1176

`importSeq` would take its parameters by reference. One by one, it would 
replace them in place, or report an error.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73667/new/

https://reviews.llvm.org/D73667



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to