brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.1 KiB · c5e27a5 Raw
135 lines · cpp
1// expected-no-diagnostics2 3//RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp \4//RUN:   -x c++ -std=c++14 -fexceptions -fcxx-exceptions                   \5//RUN:   -Wno-source-uses-openmp -Wno-openmp-clauses                       \6//RUN:   -ast-print %s | FileCheck %s --check-prefix=PRINT7 8//RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp \9//RUN:   -x c++ -std=c++14 -fexceptions -fcxx-exceptions                   \10//RUN:   -Wno-source-uses-openmp -Wno-openmp-clauses                       \11//RUN:   -ast-dump %s | FileCheck %s --check-prefix=DUMP12 13//RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp \14//RUN:   -x c++ -std=c++14 -fexceptions -fcxx-exceptions                   \15//RUN:   -Wno-source-uses-openmp -Wno-openmp-clauses                       \16//RUN:   -emit-pch -o %t %s17 18//RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp \19//RUN:   -x c++ -std=c++14 -fexceptions -fcxx-exceptions                   \20//RUN:   -Wno-source-uses-openmp -Wno-openmp-clauses                       \21//RUN:   -include-pch %t -ast-print %s | FileCheck %s --check-prefix=PRINT22 23//RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp \24//RUN:   -x c++ -std=c++14 -fexceptions -fcxx-exceptions                   \25//RUN:   -Wno-source-uses-openmp -Wno-openmp-clauses                       \26//RUN:   -include-pch %t -ast-dump-all %s | FileCheck %s --check-prefix=DUMP27 28#ifndef HEADER29#define HEADER30 31typedef enum omp_allocator_handle_t {32  omp_null_allocator = 0,33  omp_default_mem_alloc = 1,34  omp_large_cap_mem_alloc = 2,35  omp_const_mem_alloc = 3,36  omp_high_bw_mem_alloc = 4,37  omp_low_lat_mem_alloc = 5,38  omp_cgroup_mem_alloc = 6,39  omp_pteam_mem_alloc = 7,40  omp_thread_mem_alloc = 8,41  KMP_ALLOCATOR_MAX_HANDLE = __UINTPTR_MAX__42} omp_allocator_handle_t;43 44int foo1() {45  char a;46#pragma omp allocate(a) align(4) allocator(omp_pteam_mem_alloc)47  return a;48}49// DUMP: FunctionDecl {{.*}}50// DUMP: DeclStmt {{.*}}51// DUMP: VarDecl {{.*}}a 'char'52// DUMP: OMPAllocateDeclAttr {{.*}}OMPPTeamMemAlloc53// DUMP: DeclRefExpr {{.*}}'omp_allocator_handle_t' EnumConstant {{.*}} 'omp_pteam_mem_alloc' 'omp_allocator_handle_t'54// DUMP: ConstantExpr {{.*}}'int'55// DUMP: value: Int 456// DUMP: IntegerLiteral {{.*}}'int' 457// DUMP: DeclStmt {{.*}}58// DUMP: OMPAllocateDecl {{.*}}59// DUMP: DeclRefExpr {{.*}}'char' lvalue Var {{.*}} 'a' 'char'60// DUMP: OMPAlignClause {{.*}}61// DUMP: ConstantExpr {{.*}}'int'62// DUMP: value: Int 463// DUMP: IntegerLiteral {{.*}}'int' 464// DUMP: OMPAllocatorClause {{.*}}65// DUMP: DeclRefExpr {{.*}}'omp_allocator_handle_t' EnumConstant {{.*}}'omp_pteam_mem_alloc' 'omp_allocator_handle_t'66// PRINT: #pragma omp allocate(a) align(4) allocator(omp_pteam_mem_alloc)67 68int foo2() {69  char b;70#pragma omp allocate(b) allocator(omp_low_lat_mem_alloc) align(2)71  return b;72}73// DUMP: FunctionDecl {{.*}}74// DUMP: DeclStmt {{.*}}75// DUMP: VarDecl {{.*}}b 'char'76// DUMP: OMPAllocateDeclAttr {{.*}}Implicit OMPLowLatMemAlloc77// DUMP: DeclRefExpr {{.*}}'omp_allocator_handle_t' EnumConstant {{.*}} 'omp_low_lat_mem_alloc' 'omp_allocator_handle_t'78// DUMP: ConstantExpr {{.*}}'int'79// DUMP: value: Int 280// DUMP: IntegerLiteral {{.*}}'int' 281// DUMP: DeclStmt {{.*}}82// DUMP: OMPAllocateDecl {{.*}}83// DUMP: DeclRefExpr {{.*}}'char' lvalue Var {{.*}} 'b' 'char'84// DUMP: OMPAllocatorClause {{.*}}85// DUMP: DeclRefExpr {{.*}}'omp_allocator_handle_t' EnumConstant {{.*}} 'omp_low_lat_mem_alloc' 'omp_allocator_handle_t'86// DUMP: OMPAlignClause {{.*}}87// DUMP:  ConstantExpr {{.*}}'int'88// DUMP: value: Int 289// DUMP: IntegerLiteral {{.*}}'int' 290// PRINT: #pragma omp allocate(b) allocator(omp_low_lat_mem_alloc) align(2)91 92template <typename T, unsigned size>93T run() {94  T foo;95#pragma omp allocate(foo) align(size)96  return size;97}98 99int template_test() {100  double d;101  d = run<double, 1>();102  return 0;103}104 105// DUMP: FunctionTemplateDecl {{.*}}106// DUMP: TemplateTypeParmDecl {{.*}}107// DUMP: NonTypeTemplateParmDecl {{.*}}'unsigned int' depth 0 index 1 size108// DUMP: FunctionDecl {{.*}}'T ()'109// DUMP: DeclStmt {{.*}}110// DUMP: OMPAllocateDecl {{.*}}111// DUMP: DeclRefExpr {{.*}}'T' lvalue Var {{.*}} 'foo' 'T'112// DUMP: OMPAlignClause {{.*}}113// DUMP: DeclRefExpr {{.*}}'unsigned int' NonTypeTemplateParm {{.*}} 'size' 'unsigned int'114// DUMP: FunctionDecl {{.*}}run 'double ()'115// DUMP: TemplateArgument type 'double'116// DUMP: BuiltinType {{.*}}'double'117// DUMP: TemplateArgument integral '1U'118// DUMP: OMPAllocateDeclAttr {{.*}}Implicit OMPNullMemAlloc119// DUMP: ConstantExpr {{.*}}'unsigned int'120// DUMP: value: Int 1121// DUMP: SubstNonTypeTemplateParmExpr {{.*}}'unsigned int'122// DUMP: NonTypeTemplateParmDecl {{.*}}'unsigned int' depth 0 index 1 size123// DUMP: IntegerLiteral {{.*}}'unsigned int' 1124// DUMP: OMPAllocateDecl {{.*}}125// DUMP: DeclRefExpr {{.*}}'double' lvalue Var {{.*}} 'foo' 'double'126// DUMP: OMPAlignClause {{.*}}127// DUMP: ConstantExpr {{.*}}'unsigned int'128// DUMP: value: Int 1129// DUMP: SubstNonTypeTemplateParmExpr {{.*}}'unsigned int'130// DUMP: NonTypeTemplateParmDecl {{.*}}'unsigned int' depth 0 index 1 size131// DUMP: IntegerLiteral {{.*}}'unsigned int' 1132// PRINT: #pragma omp allocate(foo) align(size)133// PRINT: #pragma omp allocate(foo) align(1U)134#endif // HEADER135