It seems that if we have no context, then it can't possibly be a method. Check that first.
FYI, moving this code changes how two symbols (out of 2M+) are handled on a test program I have. I noticed this because when I changed the loop to set it up for parallelization, I effectively deferred all handling of C++ names to later. It simplifies the code to handle !const_context situations first, and then handle the rest. At a high level I assume that should be equivalent, but it actually changed two symbols.
I send this review out so you can either:
- Tell me it's wrong to move the if statement, because of some situation I don't understand, or
- Tell me this is correct, and the two symbols that are handled differently actually should be handled differently, or
- Tell me this is correct, and the two symbols that are handled differently are due to a bug somewhere else.
FWIW the two symbols demangle to roughly "thing<lots_of_stuff>". lots_of_stuff includes lambdas, vectors, and some other things. It wouldn't surprise me if I stumbled across a bug in the mangler or demangler (there are lots of repeated sections, so it could be a bug in back references).