Separate function info from TIntermAggregate
This change will make it easier to split types of TIntermAggregate
nodes representing functions and function calls into different node
classes.
BUG=angleproject:1490
TEST=angle_unittests
Change-Id: I730aa7858fe31fda86218fc685980c6ad486f5e0
Reviewed-on: https://chromium-review.googlesource.com/394706
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/DeferGlobalInitializers.cpp b/src/compiler/translator/DeferGlobalInitializers.cpp
index 598eac0..39577c2 100644
--- a/src/compiler/translator/DeferGlobalInitializers.cpp
+++ b/src/compiler/translator/DeferGlobalInitializers.cpp
@@ -18,23 +18,23 @@
namespace
{
-void SetInternalFunctionName(TIntermAggregate *functionNode, const char *name)
+void SetInternalFunctionName(TFunctionSymbolInfo *functionInfo, const char *name)
{
TString nameStr(name);
nameStr = TFunction::mangleName(nameStr);
TName nameObj(nameStr);
nameObj.setInternal(true);
- functionNode->setNameObj(nameObj);
+ functionInfo->setNameObj(nameObj);
}
TIntermAggregate *CreateFunctionPrototypeNode(const char *name, const int functionId)
{
TIntermAggregate *functionNode = new TIntermAggregate(EOpPrototype);
- SetInternalFunctionName(functionNode, name);
+ SetInternalFunctionName(functionNode->getFunctionSymbolInfo(), name);
TType returnType(EbtVoid);
functionNode->setType(returnType);
- functionNode->setFunctionId(functionId);
+ functionNode->getFunctionSymbolInfo()->setId(functionId);
return functionNode;
}
@@ -47,10 +47,10 @@
functionNode->getSequence()->push_back(paramsNode);
functionNode->getSequence()->push_back(functionBody);
- SetInternalFunctionName(functionNode, name);
+ SetInternalFunctionName(functionNode->getFunctionSymbolInfo(), name);
TType returnType(EbtVoid);
functionNode->setType(returnType);
- functionNode->setFunctionId(functionId);
+ functionNode->getFunctionSymbolInfo()->setId(functionId);
return functionNode;
}
@@ -59,10 +59,10 @@
TIntermAggregate *functionNode = new TIntermAggregate(EOpFunctionCall);
functionNode->setUserDefined();
- SetInternalFunctionName(functionNode, name);
+ SetInternalFunctionName(functionNode->getFunctionSymbolInfo(), name);
TType returnType(EbtVoid);
functionNode->setType(returnType);
- functionNode->setFunctionId(functionId);
+ functionNode->getFunctionSymbolInfo()->setId(functionId);
return functionNode;
}
@@ -165,7 +165,7 @@
{
TIntermAggregate *nodeAgg = node->getAsAggregate();
if (nodeAgg != nullptr && nodeAgg->getOp() == EOpFunction &&
- TFunction::unmangleName(nodeAgg->getName()) == "main")
+ nodeAgg->getFunctionSymbolInfo()->isMain())
{
TIntermAggregate *functionCallNode =
CreateFunctionCallNode(functionName, initFunctionId);