Skip to content

Commit e9d74b2

Browse files
[SM6.10][HLK][Bugfix] Remove using std from common header (#8358)
`using namespace std;` is generally considered a bad practice so it should be removed anyways but this was causing downstream ambeguity errors so it needs to be fix. Completely removing is was going to cause a bunch of min/max headaches so those were added in as more precise using statements. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent aba4445 commit e9d74b2

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

include/dxc/Test/HlslTestUtils.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
#include "dxc/Test/TestConfig.h"
4848
#endif
4949

50-
using namespace std;
50+
using std::max;
51+
using std::min;
5152

5253
#ifndef HLSLDATAFILEPARAM
5354
#define HLSLDATAFILEPARAM L"HlslDataDir"
@@ -121,12 +122,12 @@ static constexpr wchar_t wideWhitespaceChars[] = L" \t\r\n";
121122

122123
inline std::string strltrim(const std::string &value) {
123124
size_t first = value.find_first_not_of(whitespaceChars);
124-
return first == string::npos ? value : value.substr(first);
125+
return first == std::string::npos ? value : value.substr(first);
125126
}
126127

127128
inline std::string strrtrim(const std::string &value) {
128129
size_t last = value.find_last_not_of(whitespaceChars);
129-
return last == string::npos ? value : value.substr(0, last + 1);
130+
return last == std::string::npos ? value : value.substr(0, last + 1);
130131
}
131132

132133
inline std::string strtrim(const std::string &value) {

tools/clang/unittests/HLSLExec/ExecutionTest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9739,8 +9739,8 @@ TEST_F(ExecutionTest, PackUnpackTest) {
97399739
return;
97409740
}
97419741
#else
9742-
string args = "-enable-16bit-types";
9743-
string target = "cs_6_6";
9742+
std::string args = "-enable-16bit-types";
9743+
std::string target = "cs_6_6";
97449744

97459745
if (!createDevice(&pDevice, D3D_SHADER_MODEL_6_6)) {
97469746
return;
@@ -10211,7 +10211,7 @@ TEST_F(ExecutionTest, DynamicResourcesDynamicIndexingTest) {
1021110211
st::ParseShaderOpSetFromStream(pStream, ShaderOpSet.get());
1021210212
st::ShaderOp *pShaderOp =
1021310213
ShaderOpSet->GetShaderOp("DynamicResourcesDynamicIndexing");
10214-
vector<st::ShaderOpRootValue> fallbackRootValues = pShaderOp->RootValues;
10214+
std::vector<st::ShaderOpRootValue> fallbackRootValues = pShaderOp->RootValues;
1021510215

1021610216
bool Skipped = true;
1021710217

0 commit comments

Comments
 (0)