[PATCH] D34667: [Demangler] [DO NOT SUBMIT] Initial patch for Microsoft demangler.
Zachary Turner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 30 16:57:00 PDT 2017
zturner added inline comments.
================
Comment at: llvm/lib/Demangle/MicrosoftDemangle.cpp:663-666
+ if (consume("P6A")) {
+ read_func_ptr(ty);
+ return;
+ }
----------------
Ok, I think I get it. Here's some pointers to member functions:
Ok I think I get it. Here's some pointers to member functions:
```
PtrMemberFunction@@3P8TheClass@@EAAXXZEQ1
PtrPtrMemberFunction@@3PEAP8TheClass@@EAAXXZEA
PtrPtrPtrMemberFunction@@3PEAPEAP8TheClass@@EAAXXZEA
```
The key observation here is that the `8` (`8` here means member function pointer, as opposed to `6` in the case you've handled) doesn't necessarily come after the `P`. So this logic will not work here. I think you need to sink this conditional into the `read_pointee` function below. First you read the `P`, then you call `read_pointee`, which sees `E` (64-bit, and indicates that the storage class needs to be read), then storage class `A` (no storage class), then indirect recursion back into `read_var_type()`. It sees `P` again (pointer), then calls `read_pointee` again, this time there is no `E` (64-bit) or `A` (32-bit), but instead there is the number `8` (member function).
The same would apply to non-member functions, and the algorithm handles constness, reference, etc as well. So this should handle the general case.
https://reviews.llvm.org/D34667
More information about the llvm-commits
mailing list