Don't allocate name strings for empty symbols
This removes unnecessary memory allocations.
BUG=angleproject:2267
TEST=angle_unittests
Change-Id: Ide575ea19ab2f8e9fc93092490f1352efa6024a3
Reviewed-on: https://chromium-review.googlesource.com/817415
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index 70bd12f..748c788 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -341,7 +341,7 @@
{
TInterfaceBlock *interfaceBlock =
mappedStruct.blockDeclarator->getType().getInterfaceBlock();
- const TString &interfaceBlockName = interfaceBlock->name();
+ const TString &interfaceBlockName = *interfaceBlock->name();
const TName &instanceName = mappedStruct.blockDeclarator->getName();
if (mReferencedUniformBlocks.count(interfaceBlockName) == 0)
{
@@ -380,7 +380,7 @@
TType *structType = mappedStruct.field->type();
mappedStructs +=
- "static " + Decorate(structType->getStruct()->name()) + " " + mappedName;
+ "static " + Decorate(*structType->getStruct()->name()) + " " + mappedName;
if (structType->isArray())
{
@@ -890,7 +890,7 @@
if (interfaceBlock)
{
- mReferencedUniformBlocks[interfaceBlock->name()] = node;
+ mReferencedUniformBlocks[*interfaceBlock->name()] = node;
}
else
{
@@ -1238,7 +1238,7 @@
{
TInterfaceBlock *interfaceBlock = leftType.getInterfaceBlock();
TIntermSymbol *instanceArraySymbol = node->getLeft()->getAsSymbolNode();
- mReferencedUniformBlocks[interfaceBlock->name()] = instanceArraySymbol;
+ mReferencedUniformBlocks[*interfaceBlock->name()] = instanceArraySymbol;
const int arrayIndex = node->getRight()->getAsConstantUnion()->getIConst(0);
out << mUniformHLSL->UniformBlockInstanceString(
instanceArraySymbol->getSymbol(), arrayIndex);