summaryrefslogtreecommitdiff
path: root/flang/runtime
diff options
context:
space:
mode:
authorpeter klausler <pklausler@nvidia.com>2018-08-06 09:43:43 -0700
committerpeter klausler <pklausler@nvidia.com>2018-08-06 09:43:43 -0700
commitd2703b38e59edc4ba24a8845259b3cfa453dbd2b (patch)
treed0bed423b1c17d924cebad2ddf146e5d0106d375 /flang/runtime
parentd4b12d4e84393b3602f142eeab14f0051ad86db8 (diff)
downloadllvm-d2703b38e59edc4ba24a8845259b3cfa453dbd2b.tar.gz
[flang] address review comments
Original-commit: flang-compiler/f18@a98942e396bc035aa1f1f886a271458b6ad0c63f Reviewed-on: https://github.com/flang-compiler/f18/pull/162
Diffstat (limited to 'flang/runtime')
-rw-r--r--flang/runtime/descriptor.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/flang/runtime/descriptor.cc b/flang/runtime/descriptor.cc
index 8b8faeba69db..0281b413ea2c 100644
--- a/flang/runtime/descriptor.cc
+++ b/flang/runtime/descriptor.cc
@@ -31,8 +31,10 @@ void Descriptor::Establish(TypeCode t, std::size_t elementBytes, void *p,
CHECK(ISO::CFI_establish(&raw_, p, attribute, t.raw(), elementBytes, rank,
extent) == CFI_SUCCESS);
raw_.f18Addendum = addendum;
- if (addendum) {
- new (Addendum()) DescriptorAddendum{};
+ DescriptorAddendum *a{Addendum()};
+ CHECK(addendum == (a != nullptr));
+ if (a) {
+ new (a) DescriptorAddendum{};
}
}
@@ -46,8 +48,10 @@ void Descriptor::Establish(TypeCategory c, int kind, void *p, int rank,
CHECK(ISO::CFI_establish(&raw_, p, attribute, TypeCode(c, kind).raw(),
elementBytes, rank, extent) == CFI_SUCCESS);
raw_.f18Addendum = addendum;
- if (addendum) {
- new (Addendum()) DescriptorAddendum{};
+ DescriptorAddendum *a{Addendum()};
+ CHECK(addendum == (a != nullptr));
+ if (a) {
+ new (a) DescriptorAddendum{};
}
}
@@ -56,7 +60,9 @@ void Descriptor::Establish(const DerivedType &dt, void *p, int rank,
CHECK(ISO::CFI_establish(&raw_, p, attribute, CFI_type_struct,
dt.SizeInBytes(), rank, extent) == CFI_SUCCESS);
raw_.f18Addendum = true;
- new (Addendum()) DescriptorAddendum{&dt};
+ DescriptorAddendum *a{Addendum()};
+ CHECK(a != nullptr);
+ new (a) DescriptorAddendum{&dt};
}
std::unique_ptr<Descriptor> Descriptor::Create(TypeCode t,