diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/lib/Parse/ParseOpenMP.cpp @@ -2529,7 +2529,9 @@ TPA.Revert(); // End of the first iteration. Parser is reset to the start of metadirective - TargetOMPContext OMPCtx(ASTContext, /* DiagUnknownTrait */ nullptr, + std::function DiagUnknownTrait = [this, Loc]( + StringRef ISATrait) {}; + TargetOMPContext OMPCtx(ASTContext, std::move(DiagUnknownTrait), /* CurrentFunctionDecl */ nullptr, ArrayRef()); diff --git a/clang/test/OpenMP/metadirective_implementation_codegen.c b/clang/test/OpenMP/metadirective_implementation_codegen.c --- a/clang/test/OpenMP/metadirective_implementation_codegen.c +++ b/clang/test/OpenMP/metadirective_implementation_codegen.c @@ -35,10 +35,14 @@ : parallel) default(parallel for) for (int i = 0; i < 100; i++) ; +#pragma omp metadirective when(device = {isa("flat-address-space")} \ + : parallel) default(target teams) + bar(); } // CHECK: void @foo() // CHECK-COUNT-6: ...) @__kmpc_fork_call( +// CHECK: call void @__omp_offloading_{{.*}}() // CHECK: ret void // CHECK: define internal void @.omp_outlined.( @@ -68,4 +72,11 @@ // NO-CHECK: call void @__kmpc_for_static_fini // CHECK: ret void +// CHECK: define internal void @__omp_offloading_ +// CHECK: ...) @__kmpc_fork_teams({{.*}}@.omp_outlined..6 +// CHECK: ret void + +// CHECK: define internal void @.omp_outlined..6( +// CHECK: @bar +// CHECK: ret void #endif diff --git a/clang/test/OpenMP/metadirective_implementation_codegen.cpp b/clang/test/OpenMP/metadirective_implementation_codegen.cpp --- a/clang/test/OpenMP/metadirective_implementation_codegen.cpp +++ b/clang/test/OpenMP/metadirective_implementation_codegen.cpp @@ -35,6 +35,9 @@ : parallel) default(parallel for) for (int i = 0; i < 100; i++) ; +#pragma omp metadirective when(device = {isa("flat-address-space")} \ + : parallel) default(target teams) + bar(); } // CHECK-LABEL: void @_Z3foov() @@ -44,6 +47,7 @@ // CHECK: @__kmpc_fork_call(%struct.ident_t* {{.+}}, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* [[OUTLINED_5:@.+]] to void // CHECK: @__kmpc_fork_call(%struct.ident_t* {{.+}}, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* [[OUTLINED_6:@.+]] to void // CHECK: @__kmpc_fork_call(%struct.ident_t* {{.+}}, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* [[OUTLINED_7:@.+]] to void +// CHECK: call void @__omp_offloading_{{.*}}() // CHECK: ret void // CHECK: define internal void [[OUTLINED_2]]( @@ -73,4 +77,11 @@ // NO-CHECK: call void @__kmpc_for_static_fini // CHECK: ret void +// CHECK: define internal void @__omp_offloading_ +// CHECK: ...) @__kmpc_fork_teams({{.*}}@.omp_outlined..6 +// CHECK: ret void + +// CHECK: define internal void @.omp_outlined..6( +// CHECK: @_Z3barv +// CHECK: ret void #endif