Currently the heuristic used in ClangASTContext::CreateRecordType to identify an anonymous class is that there is that name is a nullptr or simply a null terminator. This heuristic is not accurate since it will also sweep up unnamed classes and lambdas. The improved heuristic relies on the requirement that an anonymous class must be contained within a class.
The motivator for this fix is that we currently see crashes during code completion inside lambdas and member functions of unnamed classes not within a class. This heuristic fix removes these cases but leaves unnamed classes within a class incorrectly labeled anonymous.
We will fix this problem long-term by implementing DW_AT_export_symbols which will allow us to accurately identify anonymous classes without a heuristic.