Reland "Fix unit test for setting locale creating malformed HLSL shader code
Fix malformed HLSL shader code in other locales than classic"
This is a reland of 5f662c0042703344eb0eef6d1c123e902e3aefbf
Original change's description:
> Fix unit test for setting locale creating malformed HLSL shader code
> Fix malformed HLSL shader code in other locales than classic
>
> Bug: angleproject:1433
> Change-Id: I30bad0bd0cfda465ec7200e48e12800d7d8efd26
> Reviewed-on: https://chromium-review.googlesource.com/c/1447862
> Reviewed-by: Geoff Lang <geofflang@chromium.org>
> Reviewed-by: Jamie Madill <jmadill@chromium.org>
> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Bug: angleproject:1433
Change-Id: I94caf7b4c7179119e5a5567c3014d7232df45a13
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1516192
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index fcaca76..4b92375 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -611,7 +611,7 @@
return true;
}
- std::stringstream reasonStream;
+ std::stringstream reasonStream = sh::InitializeStream<std::stringstream>();
reasonStream << "l-value required";
if (!message.empty())
{
@@ -902,7 +902,7 @@
{
if (ContainsSampler(pType.userDef))
{
- std::stringstream reasonStream;
+ std::stringstream reasonStream = sh::InitializeStream<std::stringstream>();
reasonStream << reason << " (structure contains a sampler)";
std::string reasonStr = reasonStream.str();
error(line, reasonStr.c_str(), getBasicString(pType.type));
@@ -3066,7 +3066,7 @@
if (mComputeShaderLocalSize[i] < 1 ||
mComputeShaderLocalSize[i] > maxComputeWorkGroupSizeValue)
{
- std::stringstream reasonStream;
+ std::stringstream reasonStream = sh::InitializeStream<std::stringstream>();
reasonStream << "invalid value: Value must be at least 1 and no greater than "
<< maxComputeWorkGroupSizeValue;
const std::string &reason = reasonStream.str();
@@ -3891,7 +3891,7 @@
// one to the field's struct nesting.
if (1 + field.type()->getDeepestStructNesting() > kWebGLMaxStructNesting)
{
- std::stringstream reasonStream;
+ std::stringstream reasonStream = sh::InitializeStream<std::stringstream>();
if (field.type()->getStruct()->symbolType() == SymbolType::Empty)
{
// This may happen in case there are nested struct definitions. While they are also
@@ -4085,7 +4085,7 @@
ASSERT(index >= 0);
if (index >= arraySize)
{
- std::stringstream reasonStream;
+ std::stringstream reasonStream = sh::InitializeStream<std::stringstream>();
reasonStream << reason << " '" << index << "'";
std::string token = reasonStream.str();
outOfRangeError(outOfRangeIndexIsError, location, reason, "[]");
@@ -4387,7 +4387,7 @@
checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
if (intValue < 1)
{
- std::stringstream reasonStream;
+ std::stringstream reasonStream = sh::InitializeStream<std::stringstream>();
reasonStream << "out of range: " << getWorkGroupSizeString(index) << " must be positive";
std::string reason = reasonStream.str();
error(intValueLine, reason.c_str(), intValueString.c_str());
@@ -5672,7 +5672,7 @@
int offsetValue = values[i].getIConst();
if (offsetValue > maxOffsetValue || offsetValue < minOffsetValue)
{
- std::stringstream tokenStream;
+ std::stringstream tokenStream = sh::InitializeStream<std::stringstream>();
tokenStream << offsetValue;
std::string token = tokenStream.str();
error(offset->getLine(), "Texture offset value out of valid range",