Skip to content

Commit 7cdf8f0

Browse files
spallvinay-deshmukh
authored andcommitted
[HLSL] enable Wconversion by default for HLSL (llvm#166617)
Add WConversion by default to cc1 args. Closes llvm#134761
1 parent 500ce29 commit 7cdf8f0

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

clang/lib/Driver/ToolChains/HLSL.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,3 +567,7 @@ bool HLSLToolChain::isLastJob(DerivedArgList &Args,
567567
// output to the result file.
568568
return true;
569569
}
570+
571+
void HLSLToolChain::addClangWarningOptions(ArgStringList &CC1Args) const {
572+
CC1Args.push_back("-Wconversion");
573+
}

clang/lib/Driver/ToolChains/HLSL.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ class LLVM_LIBRARY_VISIBILITY HLSLToolChain : public ToolChain {
9191
// Set default DWARF version to 4 for DXIL uses version 4.
9292
unsigned GetDefaultDwarfVersion() const override { return 4; }
9393

94+
void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const override;
95+
9496
private:
9597
mutable std::unique_ptr<tools::hlsl::Validator> Validator;
9698
mutable std::unique_ptr<tools::hlsl::MetalConverter> MetalConverter;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: %clang_dxc -T lib_6_7 %s -### %s 2>&1 | FileCheck %s --check-prefixes=CONV
2+
// RUN: %clang_dxc -T lib_6_7 -Wno-conversion %s -### %s 2>&1 | FileCheck %s --check-prefixes=NOCONV
3+
4+
// make sure we generate -Wconversion by default
5+
// CONV: "-Wconversion"
6+
// make sure -Wno-conversion still works
7+
// NOCONV: "-Wno-conversion"

0 commit comments

Comments
 (0)