[flang-commits] [flang] [flang][test] Recognize !$acc and !$omp spelled with capital letters (PR #118666)

Krzysztof Parzyszek via flang-commits flang-commits at lists.llvm.org
Thu Dec 5 04:16:27 PST 2024


https://github.com/kparzysz updated https://github.com/llvm/llvm-project/pull/118666

>From ed9457c9e55620cf8675e399a7b23e59428fabe4 Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Wed, 4 Dec 2024 10:40:25 -0600
Subject: [PATCH 1/2] [flang][test] Recognize !$acc and !$omp spelled with
 capital letters

If there are any continuation lines in the source, they will be printed
using capital letters (at least in case of OpenMP). To avoid having them
stripped out, recognize their spellings using capital letters as well.
---
 flang/test/Semantics/test_symbols.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/test/Semantics/test_symbols.py b/flang/test/Semantics/test_symbols.py
index 24dc5004a42293..98f3b61e78b949 100755
--- a/flang/test/Semantics/test_symbols.py
+++ b/flang/test/Semantics/test_symbols.py
@@ -29,7 +29,7 @@
 # Strips out blank lines and all comments except for "!DEF:", "!REF:", "!$acc" and "!$omp"
 with open(src, "r") as text_in:
     for line in text_in:
-        text = re.sub(r"!(?![DR]EF:|\$omp|\$acc).*", "", line)
+        text = re.sub(r"!(?![DR]EF:|\$[Oo][Mm][Pp]|\$[Aa][Cc][Cc]).*", "", line)
         text = re.sub(r"^\s*$", "", text)
         diff1 += text
 

>From 289daca3d5d96b307bb73a5547f2e9dcf1b8eca8 Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Thu, 5 Dec 2024 06:16:16 -0600
Subject: [PATCH 2/2] use re.I instead of [Xx] for each letter

Co-authored-by: Michael Kruse <github at meinersbur.de>
---
 flang/test/Semantics/test_symbols.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/test/Semantics/test_symbols.py b/flang/test/Semantics/test_symbols.py
index 98f3b61e78b949..aca55acc8d402a 100755
--- a/flang/test/Semantics/test_symbols.py
+++ b/flang/test/Semantics/test_symbols.py
@@ -29,7 +29,7 @@
 # Strips out blank lines and all comments except for "!DEF:", "!REF:", "!$acc" and "!$omp"
 with open(src, "r") as text_in:
     for line in text_in:
-        text = re.sub(r"!(?![DR]EF:|\$[Oo][Mm][Pp]|\$[Aa][Cc][Cc]).*", "", line)
+        text = re.sub(r"!(?![DR]EF:|\$omp|\$acc).*", "", line, re.I)
         text = re.sub(r"^\s*$", "", text)
         diff1 += text
 



More information about the flang-commits mailing list