[PATCH] D73667: Speed up compilation of ASTImporter

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 29 15:02:57 PST 2020


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





More information about the cfe-commits mailing list