[clang] 03eba20 - [OpenACC] Fix ast-print of device_type clause

via cfe-commits cfe-commits at lists.llvm.org
Tue May 14 06:48:02 PDT 2024


Author: erichkeane
Date: 2024-05-14T06:47:57-07:00
New Revision: 03eba209852c769ab6993be3bc01cdcc57d787b0

URL: https://github.com/llvm/llvm-project/commit/03eba209852c769ab6993be3bc01cdcc57d787b0
DIFF: https://github.com/llvm/llvm-project/commit/03eba209852c769ab6993be3bc01cdcc57d787b0.diff

LOG: [OpenACC] Fix ast-print of device_type clause

When writing the test for this I seemingly forgot to put 'CHECK' on the
lines, so I didn't notice that I was printing the identifiers as
pointers rather than their names.  This patch corrects the tests and the
print behavior.

Added: 
    

Modified: 
    clang/lib/AST/OpenACCClause.cpp
    clang/test/AST/ast-print-openacc-compute-construct.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/OpenACCClause.cpp b/clang/lib/AST/OpenACCClause.cpp
index f80ecc90d3963..8ff6dabcbc48e 100644
--- a/clang/lib/AST/OpenACCClause.cpp
+++ b/clang/lib/AST/OpenACCClause.cpp
@@ -473,7 +473,7 @@ void OpenACCClausePrinter::VisitDeviceTypeClause(
                           if (Arch.first == nullptr)
                             OS << "*";
                           else
-                            OS << Arch.first;
+                            OS << Arch.first->getName();
                         });
   OS << ")";
 }

diff  --git a/clang/test/AST/ast-print-openacc-compute-construct.cpp b/clang/test/AST/ast-print-openacc-compute-construct.cpp
index cdd9ab3377d01..19965e7491414 100644
--- a/clang/test/AST/ast-print-openacc-compute-construct.cpp
+++ b/clang/test/AST/ast-print-openacc-compute-construct.cpp
@@ -111,23 +111,23 @@ void foo() {
   bool SomeB;
   struct SomeStruct{} SomeStructImpl;
 
-//#pragma acc parallel dtype(SomeB)
+//CHECK: #pragma acc parallel dtype(SomeB)
 #pragma acc parallel dtype(SomeB)
   while(true);
 
-//#pragma acc parallel device_type(SomeStruct)
+//CHECK: #pragma acc parallel device_type(SomeStruct)
 #pragma acc parallel device_type(SomeStruct)
   while(true);
 
-//#pragma acc parallel device_type(int)
+//CHECK: #pragma acc parallel device_type(int)
 #pragma acc parallel device_type(int)
   while(true);
 
-//#pragma acc parallel dtype(bool)
+//CHECK: #pragma acc parallel dtype(bool)
 #pragma acc parallel dtype(bool)
   while(true);
 
-//#pragma acc parallel device_type (SomeStructImpl)
+//CHECK: #pragma acc parallel device_type(SomeStructImpl)
 #pragma acc parallel device_type (SomeStructImpl)
   while(true);
 }


        


More information about the cfe-commits mailing list