[flang-commits] [flang] 2991c39 - [flang][openacc] Fix unparsing of bind clause on acc routine

Valentin Clement via flang-commits flang-commits at lists.llvm.org
Thu Aug 17 14:02:22 PDT 2023


Author: Valentin Clement
Date: 2023-08-17T14:02:17-07:00
New Revision: 2991c39de5634b8bced24556e739ab6cece0ccad

URL: https://github.com/llvm/llvm-project/commit/2991c39de5634b8bced24556e739ab6cece0ccad
DIFF: https://github.com/llvm/llvm-project/commit/2991c39de5634b8bced24556e739ab6cece0ccad.diff

LOG: [flang][openacc] Fix unparsing of bind clause on acc routine

unparsing for the bind clause was adding extra
parenthesis. This patch fixes that.

Reviewed By: razvanlupusoru

Differential Revision: https://reviews.llvm.org/D158210

Added: 
    

Modified: 
    flang/lib/Parser/unparse.cpp
    flang/test/Parser/acc-unparse.f90

Removed: 
    


################################################################################
diff  --git a/flang/lib/Parser/unparse.cpp b/flang/lib/Parser/unparse.cpp
index 69e1d994a17e1e..d86049886fc32c 100644
--- a/flang/lib/Parser/unparse.cpp
+++ b/flang/lib/Parser/unparse.cpp
@@ -1890,10 +1890,8 @@ class UnparseVisitor {
   }
   void Unparse(const AccBindClause &x) {
     common::visit(common::visitors{
-                      [&](const Name &y) { Put('('), Walk(y), Put(')'); },
-                      [&](const ScalarDefaultCharExpr &y) {
-                        Put('('), Walk(y), Put(')');
-                      },
+                      [&](const Name &y) { Walk(y); },
+                      [&](const ScalarDefaultCharExpr &y) { Walk(y); },
                   },
         x.u);
   }

diff  --git a/flang/test/Parser/acc-unparse.f90 b/flang/test/Parser/acc-unparse.f90
index fdc0218a551f68..e0a6c164f0de12 100644
--- a/flang/test/Parser/acc-unparse.f90
+++ b/flang/test/Parser/acc-unparse.f90
@@ -76,3 +76,13 @@ subroutine acc_loop()
 ! CHECK: !$ACC LOOP GANG(STATIC:gangstatic,DIM:gangdim)
 
 end subroutine
+
+subroutine routine1()
+  !$acc routine bind("routine1_")
+! CHECK: !$ACC ROUTINE BIND("routine1_")
+end subroutine
+
+subroutine routine2()
+  !$acc routine(routine2) bind(routine2)
+! CHECK: !$ACC ROUTINE(routine2) BIND(routine2)
+end subroutine


        


More information about the flang-commits mailing list