[PATCH] D77918: [OpenMP] Avoid crash in preparation for diagnose of unsupported type

Johannes Doerfert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 14 12:24:43 PDT 2020


jdoerfert marked an inline comment as done.
jdoerfert added inline comments.


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:1831
          "OpenMP device compilation mode is expected.");
+  // TODO: Do not check outside of functions for now as the targetDiag below
+  //       requires one.
----------------
Fznamznon wrote:
> Please ignore my comment if it says nonsense. It actually can since I don't know a lot about OpenMP but,
> looking into `targetDiag`, I would say that underlying function (`diagIfOpenMPDeviceCode` in case of OpenMP device mode) should check that we actually have current function because it does `getCurFunctionDecl()` call.
> Otherwise any attempt to emit diagnostic in OpenMP device mode using `targetDiag` or `diagIfOpenMPDeviceCode` will fail outside of functions.
It's not nonsense. I think the current system is not meant for non-function diagnostics. That said, I could probably bail later in the call chain, e.g. in `diagIfOpenMPDeviceCode`. Later we should rethink how this is done as we adopt to a more user-friendly model.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77918





More information about the cfe-commits mailing list