r247389 - [OPENMP] Fix printing of array section with single index.

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 10 21:54:29 PDT 2015


Author: abataev
Date: Thu Sep 10 23:54:28 2015
New Revision: 247389

URL: http://llvm.org/viewvc/llvm-project?rev=247389&view=rev
Log:
[OPENMP] Fix printing of array section with single index.

Modified:
    cfe/trunk/lib/AST/StmtPrinter.cpp
    cfe/trunk/test/OpenMP/task_ast_print.cpp

Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=247389&r1=247388&r2=247389&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Thu Sep 10 23:54:28 2015
@@ -1300,9 +1300,11 @@ void StmtPrinter::VisitOMPArraySectionEx
   OS << "[";
   if (Node->getLowerBound())
     PrintExpr(Node->getLowerBound());
-  OS << ":";
-  if (Node->getLength())
-    PrintExpr(Node->getLength());
+  if (Node->getColonLoc().isValid()) {
+    OS << ":";
+    if (Node->getLength())
+      PrintExpr(Node->getLength());
+  }
   OS << "]";
 }
 

Modified: cfe/trunk/test/OpenMP/task_ast_print.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/task_ast_print.cpp?rev=247389&r1=247388&r2=247389&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/task_ast_print.cpp (original)
+++ cfe/trunk/test/OpenMP/task_ast_print.cpp Thu Sep 10 23:54:28 2015
@@ -87,8 +87,8 @@ int main(int argc, char **argv) {
 #pragma omp threadprivate(a)
   Enum ee;
 // CHECK: Enum ee;
-#pragma omp task untied mergeable depend(out:argv[1], (arr)[0:]) if(task: argc > 0)
-  // CHECK-NEXT: #pragma omp task untied mergeable depend(out : argv[1],(arr)[0:]) if(task: argc > 0)
+#pragma omp task untied mergeable depend(out:argv[:a][1], (arr)[0:]) if(task: argc > 0)
+  // CHECK-NEXT: #pragma omp task untied mergeable depend(out : argv[:a][1],(arr)[0:]) if(task: argc > 0)
   a = 2;
 // CHECK-NEXT: a = 2;
 #pragma omp task default(none), private(argc, b) firstprivate(argv) if (argc > 0) final(a > 0) depend(inout : a, argv[:argc],arr[:a])




More information about the cfe-commits mailing list