Refactoring: Replace Expression::op check followed by static cast to Expression::is<ExpressionType> (#3141)

This may negatively impact performance, as the (final, i.e.,
non-virtual) Expression::is... family is implemented in D and not
available inline in the C++ headers.
This commit is contained in:
Martin Kinkelin 2020-01-15 12:54:05 +01:00 committed by GitHub
parent ec1c37a5a4
commit 26673c174f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 112 additions and 132 deletions

View file

@ -875,14 +875,13 @@ DSliceValue *DtoCatArrays(Loc &loc, Type *arrayType, Expression *exp1,
llvm::SmallVector<llvm::Value *, 3> args;
LLFunction *fn = nullptr;
if (exp1->op == TOKcat) { // handle multiple concat
if (auto ce = exp1->isCatExp()) { // handle multiple concat
fn = getRuntimeFunction(loc, gIR->module, "_d_arraycatnTX");
// Create array of slices
typedef llvm::SmallVector<llvm::Value *, 16> ArgVector;
ArgVector arrs;
arrs.push_back(DtoSlicePtr(exp2));
CatExp *ce = static_cast<CatExp *>(exp1);
do {
arrs.push_back(DtoSlicePtr(ce->e2));
ce = static_cast<CatExp *>(ce->e1);