C++: clean up name generation for symbol searching.

This does less calls, and less string concatenations for anonymous
scopes.

Change-Id: Ief07cdcd7daa5710628990abe1486b52a2896d05
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>