Skip to content

Commit 3977679

Browse files
Pavel ChupinAaronBallman
andauthored
[SYCL] Fix warnings on clang-based build (#3570)
Co-authored-by: Aaron Ballman <[email protected]>
1 parent 0324c51 commit 3977679

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,10 @@ static bool FixupInvocation(CompilerInvocation &Invocation,
521521
static unsigned getOptimizationLevel(ArgList &Args, InputKind IK,
522522
DiagnosticsEngine &Diags) {
523523
unsigned DefaultOpt = llvm::CodeGenOpt::None;
524-
if ((IK.getLanguage() == Language::OpenCL ||
525-
IK.getLanguage() == Language::OpenCLCXX) &&
526-
!Args.hasArg(OPT_cl_opt_disable) || Args.hasArg(OPT_fsycl_is_device))
524+
if (((IK.getLanguage() == Language::OpenCL ||
525+
IK.getLanguage() == Language::OpenCLCXX) &&
526+
!Args.hasArg(OPT_cl_opt_disable)) ||
527+
Args.hasArg(OPT_fsycl_is_device))
527528
DefaultOpt = llvm::CodeGenOpt::Default;
528529

529530
if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3192,7 +3192,9 @@ class SyclKernelIntFooterCreator : public SyclKernelFieldHandler {
31923192

31933193
public:
31943194
SyclKernelIntFooterCreator(Sema &S, SYCLIntegrationFooter &F)
3195-
: SyclKernelFieldHandler(S), Footer(F) {}
3195+
: SyclKernelFieldHandler(S), Footer(F) {
3196+
(void)Footer; // workaround for unused field warning
3197+
}
31963198
};
31973199

31983200
} // namespace

sycl/source/detail/os_util.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ std::string OSUtil::getDirName(const char *Path) {
218218
// Remove trailing directory separators
219219
Tmp.erase(Tmp.find_last_not_of("/\\") + 1, std::string::npos);
220220

221-
int pos = Tmp.find_last_of("/\\");
221+
size_t pos = Tmp.find_last_of("/\\");
222222
if (pos != std::string::npos)
223223
return Tmp.substr(0, pos);
224224

0 commit comments

Comments
 (0)