Classify TSymbols using an enum
Symbols can be either built-ins, user-defined, nameless, or for
ANGLE's internal use. In addition we currently use TFunction symbols
that are not yet resolved - they might later resolve to either a
built-in or a user-defined function. Record this information in each
TSymbol so that TSymbol contains sufficient information for deciding
how to format symbol names in output.
The goal is to eventually replace current uses of TName with pointers
to different TSymbol objects. So far only built-ins and user-defined
symbols have associated TSymbol objects, but that will be expanded to
cover ANGLE's internal symbols as well.
BUG=angleproject:2267
TEST=angle_unittests
Change-Id: I927ce023fe257cc236da82c127700f3bd72bfe96
Reviewed-on: https://chromium-review.googlesource.com/816952
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/UtilsHLSL.cpp b/src/compiler/translator/UtilsHLSL.cpp
index 57c7420..f6c7497 100644
--- a/src/compiler/translator/UtilsHLSL.cpp
+++ b/src/compiler/translator/UtilsHLSL.cpp
@@ -692,7 +692,7 @@
TString DecorateField(const TString &string, const TStructure &structure)
{
- if (structure.name().compare(0, 3, "gl_") != 0)
+ if (structure.symbolType() != SymbolType::BuiltIn)
{
return Decorate(string);
}
@@ -751,8 +751,7 @@
const TStructure *structure = type.getStruct();
if (structure)
{
- const TString &typeName = structure->name();
- if (typeName != "")
+ if (structure->symbolType() != SymbolType::Empty)
{
return StructNameString(*structure);
}
@@ -847,7 +846,7 @@
TString StructNameString(const TStructure &structure)
{
- if (structure.name().empty())
+ if (structure.symbolType() == SymbolType::Empty)
{
return "";
}
@@ -866,7 +865,7 @@
bool useHLSLRowMajorPacking,
bool useStd140Packing)
{
- if (structure.name() == "")
+ if (structure.symbolType() == SymbolType::Empty)
{
return "";
}
@@ -960,7 +959,7 @@
{
// Disambiguation is needed for struct parameters, since HLSL thinks that structs with
// the same fields but a different name are identical.
- ASSERT(paramType.getStruct()->name() != "");
+ ASSERT(paramType.getStruct()->symbolType() != SymbolType::Empty);
disambiguatingString += "_" + TypeString(paramType);
}
}