Track whether a name is internal to ANGLE in a separate class
The AST contains identifiers in a few different places: besides symbols,
there are also function names, which show up in function signatures
and function calls. Any of these can be coming either from the original
shader or from inside ANGLE. A class that encapsulates a string and its
internalness will be useful for implementing a unified way of handling
all names in shader translation. Start implementing this by splitting
the functionality out of TSymbol.
TEST=angle_unittests
BUG=angleproject:1116
Change-Id: I0a1b5936dcccd0d5fc1c0c13c712102fbfff2a79
Reviewed-on: https://chromium-review.googlesource.com/291280
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/UtilsHLSL.cpp b/src/compiler/translator/UtilsHLSL.cpp
index 8009c6b..4394c2f 100644
--- a/src/compiler/translator/UtilsHLSL.cpp
+++ b/src/compiler/translator/UtilsHLSL.cpp
@@ -8,6 +8,7 @@
//
#include "compiler/translator/UtilsHLSL.h"
+#include "compiler/translator/IntermNode.h"
#include "compiler/translator/StructureHLSL.h"
#include "compiler/translator/SymbolTable.h"
@@ -87,6 +88,18 @@
return string;
}
+TString DecorateIfNeeded(const TName &name)
+{
+ if (name.isInternal())
+ {
+ return name.getString();
+ }
+ else
+ {
+ return Decorate(name.getString());
+ }
+}
+
TString TypeString(const TType &type)
{
const TStructure* structure = type.getStruct();