[PATCH] D112381: [flang] Checks for pointers to intrinsic functions

Peter Klausler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 25 09:47:06 PDT 2021


klausler accepted this revision.
klausler added inline comments.


================
Comment at: flang/lib/Evaluate/characteristics.cpp:421
               // declaration checking in Semantics.
-              return context.intrinsics().IsSpecificIntrinsicFunction(
-                  symbol.name().ToString());
+              if (const auto intrinsic{
+                      context.intrinsics().IsSpecificIntrinsicFunction(
----------------
Possibly easier to follow:

  auto intrinsic{...};
  if (intrinsic && intrinsic->isRestrictedSpecific) {
    intrinsic.reset(); // exclude intrinsics from table 16.3
  }
  return intrinsic.



================
Comment at: flang/lib/Semantics/check-declarations.cpp:636
                 ultimate.name(), symbol.name());
           }
         } else if (!ultimate.attrs().test(Attr::EXTERNAL) &&
----------------
You could emit distinct messages for the two possible error cases (!intrinsic for one, intrinsic->isRestrictedSpecific for the other).

If you choose to emit just the one message, the predicate could be made easier to follow as:

  !intrinsic || intrinsic->isRestrictedSpecific

to avoid making the reader of the code have to figure out multiple negations.


================
Comment at: flang/lib/Semantics/check-declarations.cpp:785
+            !(intrinsic && !intrinsic->isRestrictedSpecific)) { // C1515
           messages_.Say(
+              "Intrinsic procedure '%s' is not an unrestricted specific "
----------------
My comments from line ca. 630 above also apply here.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112381/new/

https://reviews.llvm.org/D112381



More information about the llvm-commits mailing list