[PATCH] D101658: [flang] Use CFI_TYPE_LAST instead of CFI_type_struct
Diana Picus via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 30 12:21:04 PDT 2021
rovka created this revision.
rovka added reviewers: klausler, tskeith, jeanPerier.
rovka added a project: Flang.
Herald added a subscriber: jdoerfert.
rovka requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
It looks like CFI_type_struct was once used as the last valid CFI_type
value, but in the meantime CFI_type_char16_t and CFI_type_char32_t were
added, making that assumption no longer true. Luckily, in the meantime
we also got a define for CFI_TYPE_LAST, which we can now use to allow
CFI_establish and CFI_allocate to work with descriptors of
CFI_type_char16_t, CFI_type_char32_t and any other future types.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D101658
Files:
flang/runtime/ISO_Fortran_binding.cpp
flang/unittests/Evaluate/ISO-Fortran-binding.cpp
Index: flang/unittests/Evaluate/ISO-Fortran-binding.cpp
===================================================================
--- flang/unittests/Evaluate/ISO-Fortran-binding.cpp
+++ flang/unittests/Evaluate/ISO-Fortran-binding.cpp
@@ -130,7 +130,7 @@
++numErr;
expectedRetCode = CFI_INVALID_RANK;
}
- if (type < 0 || type > CFI_type_struct) {
+ if (type < 0 || type > CFI_TYPE_LAST) {
++numErr;
expectedRetCode = CFI_INVALID_TYPE;
}
@@ -166,7 +166,7 @@
CFI_attribute_t attrCases[]{
CFI_attribute_pointer, CFI_attribute_allocatable, CFI_attribute_other};
CFI_type_t typeCases[]{CFI_type_int, CFI_type_struct, CFI_type_double,
- CFI_type_char, CFI_type_other, CFI_type_struct + 1};
+ CFI_type_char, CFI_type_other, CFI_TYPE_LAST + 1};
CFI_index_t *extentCases[]{extents, nullptr};
void *baseAddrCases[]{dummyAddr, nullptr};
CFI_rank_t rankCases[]{0, 1, CFI_MAX_RANK, CFI_MAX_RANK + 1};
@@ -330,7 +330,7 @@
++numErr;
expectedRetCode = CFI_INVALID_RANK;
}
- if (type < 0 || type > CFI_type_struct) {
+ if (type < 0 || type > CFI_TYPE_LAST) {
++numErr;
expectedRetCode = CFI_INVALID_TYPE;
}
@@ -375,7 +375,7 @@
CFI_attribute_t attrCases[]{
CFI_attribute_pointer, CFI_attribute_allocatable, CFI_attribute_other};
CFI_type_t typeCases[]{CFI_type_int, CFI_type_struct, CFI_type_double,
- CFI_type_char, CFI_type_other, CFI_type_struct + 1};
+ CFI_type_char, CFI_type_other, CFI_TYPE_LAST + 1};
void *baseAddrCases[]{dummyAddr, nullptr};
CFI_rank_t rankCases[]{0, 1, CFI_MAX_RANK, CFI_MAX_RANK + 1};
std::size_t lenCases[]{0, 42};
Index: flang/runtime/ISO_Fortran_binding.cpp
===================================================================
--- flang/runtime/ISO_Fortran_binding.cpp
+++ flang/runtime/ISO_Fortran_binding.cpp
@@ -56,7 +56,7 @@
return CFI_INVALID_RANK;
}
if (descriptor->type < CFI_type_signed_char ||
- descriptor->type > CFI_type_struct) {
+ descriptor->type > CFI_TYPE_LAST) {
return CFI_INVALID_TYPE;
}
if (!IsCharacterType(descriptor->type)) {
@@ -228,7 +228,7 @@
if (rank > 0 && base_addr && !extents) {
return CFI_INVALID_EXTENT;
}
- if (type < CFI_type_signed_char || type > CFI_type_struct) {
+ if (type < CFI_type_signed_char || type > CFI_TYPE_LAST) {
return CFI_INVALID_TYPE;
}
if (!descriptor) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101658.342007.patch
Type: text/x-patch
Size: 2393 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210430/21629d8e/attachment.bin>
More information about the llvm-commits
mailing list