[clang] [SYCL][Driver] Pass -lsycl by default for SYCL compilation. (PR #174877)
Michael Toguchi via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 12 13:18:09 PST 2026
================
@@ -7,25 +7,36 @@
//===----------------------------------------------------------------------===//
#include "SYCL.h"
#include "clang/Driver/CommonArgs.h"
+#include "llvm/Support/VirtualFileSystem.h"
using namespace clang::driver;
using namespace clang::driver::toolchains;
using namespace clang::driver::tools;
using namespace clang;
using namespace llvm::opt;
+SYCLInstallationDetector::SYCLInstallationDetector(const Driver &D)
+ : D(D), InstallationCandidates() {
+ InstallationCandidates.emplace_back(D.Dir + "/..");
+}
+
SYCLInstallationDetector::SYCLInstallationDetector(
const Driver &D, const llvm::Triple &HostTriple,
- const llvm::opt::ArgList &Args) {}
+ const llvm::opt::ArgList &Args)
+ : SYCLInstallationDetector(D) {}
void SYCLInstallationDetector::addSYCLIncludeArgs(
const ArgList &DriverArgs, ArgStringList &CC1Args) const {
if (DriverArgs.hasArg(options::OPT_nobuiltininc))
return;
- // Add the SYCL header search locations in the specified order.
- // FIXME: Add the header file locations once the SYCL library and headers
- // are properly established within the build.
+ // Add the SYCL header search locations.
+ // These are included for both SYCL host and device compilations.
+ SmallString<128> IncludePath(D.Dir);
+ llvm::sys::path::append(IncludePath, "..");
+ llvm::sys::path::append(IncludePath, "include");
----------------
mdtoguchi wrote:
```suggestion
llvm::sys::path::append(IncludePath, "..", "include");
```
append can take multiple items.
https://github.com/llvm/llvm-project/pull/174877
More information about the cfe-commits
mailing list