Skip to content

Commit 3a0b62e

Browse files
mdtoguchibader
authored andcommitted
[SYCL][Driver] Prevent duplication of error diagnostics for -fsycl (#1007)
When performing -fsycl compilations, we compile a single file multiple times. If that file errors out, we should stop compiling as opposed to trying to compile the file again. This effectively reduces duplication of the error diagnostic. Signed-off-by: Michael D Toguchi <[email protected]>
1 parent 6104f16 commit 3a0b62e

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

clang/lib/Driver/Compilation.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,11 @@ static bool ActionFailed(const Action *A,
214214
if (FailingCommands.empty())
215215
return false;
216216

217-
// CUDA/HIP can have the same input source code compiled multiple times so do
218-
// not compiled again if there are already failures. It is OK to abort the
219-
// CUDA pipeline on errors.
220-
if (A->isOffloading(Action::OFK_Cuda) || A->isOffloading(Action::OFK_HIP))
217+
// CUDA/HIP/SYCL can have the same input source code compiled multiple times
218+
// so do not compile again if there are already failures. It is OK to abort
219+
// the CUDA pipeline on errors.
220+
if (A->isOffloading(Action::OFK_Cuda) || A->isOffloading(Action::OFK_HIP) ||
221+
A->isOffloading(Action::OFK_SYCL))
221222
return true;
222223

223224
for (const auto &CI : FailingCommands)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Tests to make sure that there is no duplicate error messaging for host
2+
// REQUIRES: x86-registered-target
3+
// RUN: not %clangxx -c -target x86_64-unknown-linux-gnu -fsycl %s \
4+
// RUN: 2>&1 | FileCheck %s
5+
6+
void foo() {
7+
foobar s;
8+
}
9+
10+
// CHECK: error: unknown type name 'foobar'
11+
// CHECK-NOT: error: unknown type name 'foobar'
12+

0 commit comments

Comments
 (0)