Skip to content

Commit 47cc846

Browse files
committed
Adjust toolchain files to address a few review comments
- Improve commenting for unsupported sanitizer options - Update visibility of the HostTC, SYCLInstallation and debug info - cleanup un-needed header file inclusions
1 parent 4112034 commit 47cc846

File tree

2 files changed

+17
-33
lines changed

2 files changed

+17
-33
lines changed

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,7 @@
77
//===----------------------------------------------------------------------===//
88
#include "SYCL.h"
99
#include "CommonArgs.h"
10-
#include "clang/Driver/Action.h"
11-
#include "clang/Driver/Compilation.h"
12-
#include "clang/Driver/Driver.h"
13-
#include "clang/Driver/DriverDiagnostic.h"
14-
#include "clang/Driver/InputInfo.h"
15-
#include "clang/Driver/Options.h"
16-
#include "llvm/Option/Option.h"
17-
#include "llvm/Support/CommandLine.h"
18-
#include "llvm/Support/FileSystem.h"
1910
#include "llvm/Support/Path.h"
20-
#include <algorithm>
21-
#include <sstream>
2211

2312
using namespace clang::driver;
2413
using namespace clang::driver::toolchains;
@@ -64,32 +53,29 @@ void SYCLInstallationDetector::print(llvm::raw_ostream &OS) const {
6453
}
6554
}
6655

67-
// Unsupported options for SYCL device compilation
68-
// -fcf-protection, -fsanitize, -fprofile-generate, -fprofile-instr-generate
69-
// -ftest-coverage, -fcoverage-mapping, -fcreate-profile, -fprofile-arcs
70-
// -fcs-profile-generate -forder-file-instrumentation, --coverage
71-
static std::vector<OptSpecifier> getUnsupportedOpts(void) {
56+
// Unsupported options for SYCL device compilation.
57+
static std::vector<OptSpecifier> getUnsupportedOpts() {
7258
std::vector<OptSpecifier> UnsupportedOpts = {
73-
options::OPT_fsanitize_EQ,
74-
options::OPT_fcf_protection_EQ,
59+
options::OPT_fsanitize_EQ, // -fsanitize
60+
options::OPT_fcf_protection_EQ, // -fcf-protection
7561
options::OPT_fprofile_generate,
7662
options::OPT_fprofile_generate_EQ,
77-
options::OPT_fno_profile_generate,
63+
options::OPT_fno_profile_generate, // -f[no-]profile-generate
7864
options::OPT_ftest_coverage,
79-
options::OPT_fno_test_coverage,
65+
options::OPT_fno_test_coverage, // -f[no-]test-coverage
8066
options::OPT_fcoverage_mapping,
81-
options::OPT_fno_coverage_mapping,
82-
options::OPT_coverage,
67+
options::OPT_fno_coverage_mapping, // -f[no-]coverage-mapping
68+
options::OPT_coverage, // --coverage
8369
options::OPT_fprofile_instr_generate,
8470
options::OPT_fprofile_instr_generate_EQ,
71+
options::OPT_fno_profile_instr_generate, // -f[no-]profile-instr-generate
8572
options::OPT_fprofile_arcs,
86-
options::OPT_fno_profile_arcs,
87-
options::OPT_fno_profile_instr_generate,
88-
options::OPT_fcreate_profile,
73+
options::OPT_fno_profile_arcs, // -f[no-]profile-arcs
74+
options::OPT_fcreate_profile, // -fcreate-profile
8975
options::OPT_fprofile_instr_use,
90-
options::OPT_fprofile_instr_use_EQ,
91-
options::OPT_forder_file_instrumentation,
92-
options::OPT_fcs_profile_generate,
76+
options::OPT_fprofile_instr_use_EQ, // -fprofile-instr-use
77+
options::OPT_forder_file_instrumentation, // -forder-file-instrumentation
78+
options::OPT_fcs_profile_generate, // -fcs-profile-generate
9379
options::OPT_fcs_profile_generate_EQ};
9480
return UnsupportedOpts;
9581
}
@@ -105,7 +91,7 @@ SYCLToolChain::SYCLToolChain(const Driver &D, const llvm::Triple &Triple,
10591
for (OptSpecifier Opt : getUnsupportedOpts()) {
10692
if (const Arg *A = Args.getLastArg(Opt)) {
10793
// All sanitizer options are not currently supported, except
108-
// AddressSanitizer
94+
// AddressSanitizer.
10995
if (A->getOption().getID() == options::OPT_fsanitize_EQ &&
11096
A->getValues().size() == 1) {
11197
std::string SanitizeVal = A->getValue();

clang/lib/Driver/ToolChains/SYCL.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ class LLVM_LIBRARY_VISIBILITY SYCLToolChain : public ToolChain {
4848
bool useIntegratedAs() const override { return true; }
4949
bool isPICDefault() const override { return false; }
5050
llvm::codegenoptions::DebugInfoFormat getDefaultDebugFormat() const override {
51-
if (this->HostTC.getTriple().isWindowsMSVCEnvironment())
52-
return this->HostTC.getDefaultDebugFormat();
53-
return ToolChain::getDefaultDebugFormat();
51+
return this->HostTC.getDefaultDebugFormat();
5452
}
5553
bool isPIEDefault(const llvm::opt::ArgList &Args) const override {
5654
return false;
@@ -69,8 +67,8 @@ class LLVM_LIBRARY_VISIBILITY SYCLToolChain : public ToolChain {
6967

7068
SanitizerMask getSupportedSanitizers() const override;
7169

70+
private:
7271
const ToolChain &HostTC;
73-
7472
SYCLInstallationDetector SYCLInstallation;
7573
};
7674

0 commit comments

Comments
 (0)