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/OutputTree.cpp b/src/compiler/translator/OutputTree.cpp
index 4afff03..750f1d6 100644
--- a/src/compiler/translator/OutputTree.cpp
+++ b/src/compiler/translator/OutputTree.cpp
@@ -17,7 +17,7 @@
{
const char *internal =
(func->symbolType() == SymbolType::AngleInternal) ? " (internal function)" : "";
- out << str << internal << ": " << *func->name() << " (symbol id " << func->uniqueId().get()
+ out << str << internal << ": " << func->name() << " (symbol id " << func->uniqueId().get()
<< ")";
}