Skip to content

Commit fb54a70

Browse files
committed
enable wconversion by default and add test
1 parent 5e8a0d6 commit fb54a70

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ 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;
9495
private:
9596
mutable std::unique_ptr<tools::hlsl::Validator> Validator;
9697
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)