Skip to content
Commit 423fcec8 authored by Tim Keith's avatar Tim Keith
Browse files

[flang] Add a way to check and dereference a pointer

It is common to get a pointer, check it is not null, and dereference it.
Sometimes that requires a named temporary just to be able to do the check.

The macro `DEREF(p)` provides this capability: it asserts that `p` is not null
and returns `*p`. This is analagous to `.value()` on an `std::optional`.

We might want to add a way to disable `CHECK` and the check in `DEREF` together.

This change also includes some examples of making use of `DEREF`.

Original-commit: flang-compiler/f18@d7aa90e55ac80c7f2460ab7b0cb6d1ef0c068938
Reviewed-on: https://github.com/flang-compiler/f18/pull/608
parent de551721
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment