Don't query names of empty symbols
This makes it possible to return a reference from TSymbol::name()
instead of a pointer. This is safer since it completely avoids the
possibility of a nullptr dereference. An assert is making sure that
the function is not being called for empty symbols.
BUG=angleproject:2267
TEST=angle_unittests
Change-Id: I44279f65989dbb828322843fc0216ba84d91dedf
Reviewed-on: https://chromium-review.googlesource.com/836894
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/ASTMetadataHLSL.cpp b/src/compiler/translator/ASTMetadataHLSL.cpp
index d1ae057..a15fc36 100644
--- a/src/compiler/translator/ASTMetadataHLSL.cpp
+++ b/src/compiler/translator/ASTMetadataHLSL.cpp
@@ -129,7 +129,7 @@
}
else if (node->getOp() == EOpCallBuiltInFunction)
{
- if (mGradientBuiltinFunctions.find(*node->getFunction()->name()) !=
+ if (mGradientBuiltinFunctions.find(node->getFunction()->name()) !=
mGradientBuiltinFunctions.end())
{
onGradient();