summaryrefslogtreecommitdiff
path: root/flang/include/flang/Lower/Mangler.h
diff options
context:
space:
mode:
Diffstat (limited to 'flang/include/flang/Lower/Mangler.h')
-rw-r--r--flang/include/flang/Lower/Mangler.h28
1 files changed, 10 insertions, 18 deletions
diff --git a/flang/include/flang/Lower/Mangler.h b/flang/include/flang/Lower/Mangler.h
index 9e6f82bc1959..e32132a6692a 100644
--- a/flang/include/flang/Lower/Mangler.h
+++ b/flang/include/flang/Lower/Mangler.h
@@ -54,7 +54,7 @@ std::string mangleName(const semantics::DerivedTypeSpec &, ScopeBlockIdMap &);
std::string demangleName(llvm::StringRef name);
std::string
-mangleArrayLiteral(const uint8_t *addr, size_t size,
+mangleArrayLiteral(size_t size,
const Fortran::evaluate::ConstantSubscripts &shape,
Fortran::common::TypeCategory cat, int kind = 0,
Fortran::common::ConstantSubscript charLen = -1,
@@ -64,9 +64,8 @@ template <Fortran::common::TypeCategory TC, int KIND>
std::string mangleArrayLiteral(
mlir::Type,
const Fortran::evaluate::Constant<Fortran::evaluate::Type<TC, KIND>> &x) {
- return mangleArrayLiteral(
- reinterpret_cast<const uint8_t *>(x.values().data()),
- x.values().size() * sizeof(x.values()[0]), x.shape(), TC, KIND);
+ return mangleArrayLiteral(x.values().size() * sizeof(x.values()[0]),
+ x.shape(), TC, KIND);
}
template <int KIND>
@@ -74,25 +73,18 @@ std::string
mangleArrayLiteral(mlir::Type,
const Fortran::evaluate::Constant<Fortran::evaluate::Type<
Fortran::common::TypeCategory::Character, KIND>> &x) {
- return mangleArrayLiteral(
- reinterpret_cast<const uint8_t *>(x.values().data()),
- x.values().size() * sizeof(x.values()[0]), x.shape(),
- Fortran::common::TypeCategory::Character, KIND, x.LEN());
+ return mangleArrayLiteral(x.values().size() * sizeof(x.values()[0]),
+ x.shape(), Fortran::common::TypeCategory::Character,
+ KIND, x.LEN());
}
-// FIXME: derived type mangling is safe but not reproducible between two
-// compilation of a same file because `values().data()` is a nontrivial compile
-// time data structure containing pointers and vectors. In particular, this
-// means that similar structure constructors are not "combined" into the same
-// global constant by lowering.
inline std::string mangleArrayLiteral(
mlir::Type eleTy,
const Fortran::evaluate::Constant<Fortran::evaluate::SomeDerived> &x) {
- return mangleArrayLiteral(
- reinterpret_cast<const uint8_t *>(x.values().data()),
- x.values().size() * sizeof(x.values()[0]), x.shape(),
- Fortran::common::TypeCategory::Derived, /*kind=*/0, /*charLen=*/-1,
- eleTy.cast<fir::RecordType>().getName());
+ return mangleArrayLiteral(x.values().size() * sizeof(x.values()[0]),
+ x.shape(), Fortran::common::TypeCategory::Derived,
+ /*kind=*/0, /*charLen=*/-1,
+ eleTy.cast<fir::RecordType>().getName());
}
/// Return the compiler-generated name of a static namelist variable descriptor.