[clang] [OpenAC][CIR] func-local-declare 'copy' clause lowering (PR #169115)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 21 16:07:48 PST 2025


================
@@ -19,18 +19,52 @@ using namespace clang::CIRGen;
 
 namespace {
 struct OpenACCDeclareCleanup final : EHScopeStack::Cleanup {
+  SourceRange declareRange;
   mlir::acc::DeclareEnterOp enterOp;
 
-  OpenACCDeclareCleanup(mlir::acc::DeclareEnterOp enterOp) : enterOp(enterOp) {}
+  OpenACCDeclareCleanup(SourceRange declareRange,
+                        mlir::acc::DeclareEnterOp enterOp)
+      : declareRange(declareRange), enterOp(enterOp) {}
+
+  template <typename OutTy, typename InTy>
+  void createOutOp(CIRGenFunction &cgf, InTy inOp) {
+    auto outOp =
+        OutTy::create(cgf.getBuilder(), inOp.getLoc(), inOp, inOp.getVarPtr(),
+                      inOp.getStructured(), inOp.getImplicit(),
+                      inOp.getName() ? *inOp.getName() : "", inOp.getBounds());
----------------
erichkeane wrote:

Its an `optional<StringRef>`.  So the goofy dereference is caused by that.  That said, I COULD just do `inOp.getNameAttr` wrapped in a Twine?  I didn't realize that would work, I'll give it a shot!

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


More information about the cfe-commits mailing list