Skip to content

Commit e3b86ec

Browse files
committed
Better error
1 parent 6a7b5fe commit e3b86ec

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,10 +1316,10 @@ void CGOpenMPRuntimeGPU::emitTargetCall(
13161316
llvm::function_ref<llvm::Value *(CodeGenFunction &CGF,
13171317
const OMPLoopDirective &D)>
13181318
SizeEmitter) {
1319-
SmallString<256> Buffer;
1320-
llvm::raw_svector_ostream Out(Buffer);
1321-
Out << "Cannot emit a '#pragma omp target' on the GPU";
1322-
CGM.Error(D.getBeginLoc(), Out.str());
1319+
unsigned DiagID = CGM.getDiags().getCustomDiagID(
1320+
DiagnosticsEngine::Error,
1321+
"Cannot emit a '#pragma omp target' region on the GPU");
1322+
CGM.getDiags().Report(D.getBeginLoc(), DiagID);
13231323
}
13241324

13251325
void CGOpenMPRuntimeGPU::emitCriticalRegion(

clang/test/OpenMP/gpu_target_messages.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -x c++ -triple nvptx64-nvidia-cuda -emit-llvm %s
33

44
void foo() {
5-
#pragma omp target // expected-error {{Cannot emit a '#pragma omp target' on the GPU}}
5+
#pragma omp target // expected-error {{Cannot emit a '#pragma omp target' region on the GPU}}
66
;
77
}

0 commit comments

Comments
 (0)