[clang] [Clang][OpenMP] Fix `!isNull() && "Cannot retrieve a NULL type pointer"' fail. (PR #81015)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 7 09:46:51 PST 2024


================
@@ -21124,6 +21124,8 @@ Sema::ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data,
               ExprTy = ATy->getElementType();
             else
               ExprTy = BaseType->getPointeeType();
+            if (ExprTy.isNull())
+              continue;
----------------
jhuber6 wrote:

We do `continue` above where we throw another error, so I figured it was fine. But you're right now that I look at it harder. We should do instead. (Github reviews don't allow code suggestion on lines that aren't altered).
```c
if (BaseType.isNull() || ExprTy.isNull())
  return nullptr;
```

I think both are correct, but this is probably better. Thanks.

https://github.com/llvm/llvm-project/pull/81015


More information about the cfe-commits mailing list