aboutsummaryrefslogtreecommitdiff
path: root/clang/test/OpenMP/nowait_ast_print.cpp
blob: df0a77c4fe8320166331bc7bbedeb2829987764c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Check no warnings/errors
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 -fsyntax-only -verify %s
// expected-no-diagnostics

// Check AST and unparsing
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 -ast-dump  %s | FileCheck %s --check-prefix=DUMP
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 -ast-print %s | FileCheck %s --check-prefix=PRINT

// Check same results after serialization round-trip
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 -emit-pch -o %t %s
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 -include-pch %t -ast-dump-all %s | FileCheck %s --check-prefix=DUMP
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 -include-pch %t -ast-print    %s | FileCheck %s --check-prefix=PRINT

#ifndef HEADER
#define HEADER

void nowait() {
  int A=1;

  // DUMP: OMPTargetDirective
  // DUMP-NEXT: OMPNowaitClause
  // PRINT: #pragma omp target nowait
  #pragma omp target nowait
  {
  }

  // DUMP: OMPTargetDirective
  // DUMP-NEXT: OMPNowaitClause
  // DUMP-NEXT: XXBoolLiteralExpr {{.*}} 'bool' false
  // PRINT: #pragma omp target nowait(false)
  #pragma omp target nowait(false)
  {
  }

  // DUMP: OMPTargetDirective
  // DUMP-NEXT: OMPNowaitClause
  // DUMP-NEXT: XXBoolLiteralExpr {{.*}} 'bool' true
  // PRINT: #pragma omp target nowait(true)
  #pragma omp target nowait(true)
  {
  }

  // DUMP: OMPTargetDirective
  // DUMP-NEXT: OMPNowaitClause
  // DUMP-NEXT: BinaryOperator {{.*}} 'bool' '>'
  // DUMP-NEXT: ImplicitCastExpr {{.*}} 'int' <LValueToRValue>
  // DUMP-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'A' 'int'
  // DUMP-NEXT: IntegerLiteral {{.*}} 'int' 5
  // PRINT: #pragma omp target nowait(A > 5)
  #pragma omp target nowait(A>5)
  {
  }

}
#endif