[PATCH] D68660: [tooling] Teach Tooling to understand compilation with offloading.
Michael Liao via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 8 12:41:06 PDT 2019
hliao created this revision.
hliao added reviewers: tra, yaxunl.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
- So far, we only recognize the compilation with offloading and skip the offloading part.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D68660
Files:
clang/lib/Tooling/Tooling.cpp
clang/test/Tooling/clang-check-offload.cpp
Index: clang/test/Tooling/clang-check-offload.cpp
===================================================================
--- /dev/null
+++ clang/test/Tooling/clang-check-offload.cpp
@@ -0,0 +1,4 @@
+// RUN: not clang-check "%s" -- -c -x hip -nogpulib 2>&1 | FileCheck %s
+
+// CHECK: C++ requires
+invalid;
Index: clang/lib/Tooling/Tooling.cpp
===================================================================
--- clang/lib/Tooling/Tooling.cpp
+++ clang/lib/Tooling/Tooling.cpp
@@ -91,7 +91,20 @@
// We expect to get back exactly one Command job, if we didn't something
// failed. Extract that job from the Compilation.
const driver::JobList &Jobs = Compilation->getJobs();
- if (Jobs.size() != 1 || !isa<driver::Command>(*Jobs.begin())) {
+ bool OffloadCompilation = false;
+ if (Jobs.size() > 1) {
+ for (auto &A : Compilation->getActions()){
+ // On MacOSX real actions may end up being wrapped in BindArchAction
+ if (isa<driver::BindArchAction>(A))
+ A = *A->input_begin();
+ if (isa<driver::OffloadAction>(A)) {
+ OffloadCompilation = true;
+ break;
+ }
+ }
+ }
+ if (Jobs.size() == 0 || !isa<driver::Command>(*Jobs.begin()) ||
+ (Jobs.size() > 1 && !OffloadCompilation)) {
SmallString<256> error_msg;
llvm::raw_svector_ostream error_stream(error_msg);
Jobs.Print(error_stream, "; ", true);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68660.223923.patch
Type: text/x-patch
Size: 1377 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191008/d2d2fbd2/attachment.bin>
More information about the cfe-commits
mailing list