Skip to content

Commit ee6eb03

Browse files
committed
Remove toDataLengthPair from character helper
This is a legacy function, it was kept to protect from array character in context that are not array ready. It fired in createUnboxChar where it is OK to get arrays. Remove it and enforce the arrays bans on caller sides where it make sens.
1 parent 6861426 commit ee6eb03

File tree

2 files changed

+1
-20
lines changed

2 files changed

+1
-20
lines changed

flang/include/flang/Lower/CharacterExpr.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class CharacterExprHelper {
6868
const fir::CharBoxValue &rhs);
6969

7070
/// LEN_TRIM intrinsic.
71-
mlir::Value createLenTrim(mlir::Value str);
71+
mlir::Value createLenTrim(const fir::CharBoxValue &str);
7272

7373
/// Embox \p addr and \p len and return fir.boxchar.
7474
/// Take care of type conversions before emboxing.
@@ -163,7 +163,6 @@ class CharacterExprHelper {
163163
/// FIXME: the implementation also needs a clean-up now that
164164
/// CharBoxValue are better propagated.
165165
fir::CharBoxValue materializeValue(mlir::Value str);
166-
fir::CharBoxValue toDataLengthPair(mlir::Value character);
167166
mlir::Type getReferenceType(const fir::CharBoxValue &c) const;
168167
mlir::Type getReferenceType(mlir::Value str) const;
169168
mlir::Type getSeqTy(const fir::CharBoxValue &c) const;
@@ -174,7 +173,6 @@ class CharacterExprHelper {
174173
void createLengthOneAssign(const fir::CharBoxValue &lhs,
175174
const fir::CharBoxValue &rhs);
176175
void createAssign(const fir::CharBoxValue &lhs, const fir::CharBoxValue &rhs);
177-
mlir::Value createLenTrim(const fir::CharBoxValue &str);
178176
mlir::Value createBlankConstantCode(fir::CharacterType type);
179177

180178
private:

flang/lib/Lower/CharacterExpr.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -632,20 +632,3 @@ Fortran::lower::CharacterExprHelper::readLengthFromBox(mlir::Value box) {
632632
}
633633
return size;
634634
}
635-
636-
bool Fortran::lower::CharacterExprHelper::hasConstantLengthInType(
637-
const fir::ExtendedValue &exv) {
638-
auto type = fir::getBase(exv).getType();
639-
if (auto boxTy = type.dyn_cast<fir::BoxType>())
640-
type = boxTy.getEleTy();
641-
if (auto eleTy = fir::dyn_cast_ptrEleTy(type))
642-
type = eleTy;
643-
if (auto seqTy = type.dyn_cast<fir::SequenceType>()) {
644-
assert(seqTy.getEleTy().isa<fir::CharacterType>() &&
645-
"entity is not a character");
646-
assert(seqTy.getShape().size() > 0 && "character has empty shape");
647-
auto lenVal = seqTy.getShape()[0];
648-
return lenVal != fir::SequenceType::getUnknownExtent();
649-
}
650-
return false;
651-
}

0 commit comments

Comments
 (0)