diff options
| author | Zachary Turner <zturner@google.com> | 2018-07-30 03:12:34 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2018-07-30 03:12:34 +0000 |
| commit | 71c91f948a81bffadd4697e2ab3508d6344d0411 (patch) | |
| tree | 161c5572042f4ef1e2c3554d0ca5ca10e8ab2917 /llvm/lib/Demangle/ItaniumDemangle.cpp | |
| parent | 8c40e40a85868166cbd801ae69cf675e471b5dd2 (diff) | |
| download | bcm5719-llvm-71c91f948a81bffadd4697e2ab3508d6344d0411.tar.gz bcm5719-llvm-71c91f948a81bffadd4697e2ab3508d6344d0411.zip | |
[MS Demangler] Demangle symbols in function scopes.
There are a couple of issues you run into when you start getting into
more complex names, especially with regards to function local statics.
When you've got something like:
int x() {
static int n = 0;
return n;
}
Then this needs to demangle to something like
int `int __cdecl x()'::`1'::n
The nested mangled symbols (e.g. `int __cdecl x()` in the above
example) also share state with regards to back-referencing, so
we need to be able to re-use the demangler in the middle of
demangling a symbol while sharing back-ref state.
To make matters more complicated, there are a lot of ambiguities
when demangling a symbol's qualified name, because a function local
scope pattern (usually something like `?1??name?`) looks suspiciously
like many other possible things that can occur, such as `?1` meaning
the second back-ref and disambiguating these cases is rather
interesting. The `?1?` in a local scope pattern is actually a special
case of the more general pattern of `? + <encoded number> + ?`, where
"encoded number" can itself have embedded `@` symbols, which is a
common delimeter in mangled names. So we have to take care during the
disambiguation, which is the reason for the overly complicated
`isLocalScopePattern` function in this patch.
I've added some pretty obnoxious tests to exercise all of this, which
exposed several other problems related to back-referencing, so those
are fixed here as well. Finally, I've uncommented some tests that were
previously marked as `FIXME`, since now these work.
Differential Revision: https://reviews.llvm.org/D49965
llvm-svn: 338226
Diffstat (limited to 'llvm/lib/Demangle/ItaniumDemangle.cpp')
0 files changed, 0 insertions, 0 deletions

