================
@@ -1279,13 +1308,19 @@ void CodeGenFunction::EmitOMPPrivateClause(
   for (const auto *C : D.getClausesOfKind<OMPPrivateClause>()) {
     auto IRef = C->varlist_begin();
     for (const Expr *IInit : C->private_copies()) {
-      const auto *OrigVD = cast<VarDecl>(cast<DeclRefExpr>(*IRef)->getDecl());
-      if (EmittedAsPrivate.insert(OrigVD->getCanonicalDecl()).second) {
+      const auto *OrigDecl = cast<DeclRefExpr>(*IRef)->getDecl();
+      bool ShouldEmit = true;
+      if (const auto *VD = dyn_cast<VarDecl>(OrigDecl)) {
+        if (!EmittedAsPrivate.insert(VD->getCanonicalDecl()).second) {
+          ShouldEmit = false; // Already emitted.
+        }
+      }
+      if (ShouldEmit) {
----------------
zahiraam wrote:

Removed.

https://github.com/llvm/llvm-project/pull/190832
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to