-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cppexp: map member function pointers #4
Conversation
Thanks Kelly. The UO_Deref mapping looks correct, I'll check the other two this evening. DelegateFuncptrExp sounds strange tbh, but I don't know much about member function pointers. I'll wrap my head around them by checking occurrences of BO_PtrMemD and BO_PtrMemI in Clang's Parse and Sema, see when they are generated and follow what Clang does with them. |
Hey Kelly I had a tiring week and still haven't looked properly at member function pointers. Do the latest commits break anything in your tests? |
Hello Elie, No, none of the tests break…things seem to get a little further along with a couple of them that use ‘-std=c++11’ (so algorithm and array, etc.), but they don’t even compile completely even with that fix. So I can just keep working on getting things further along here with c++11 specific stuff, when needed. It really isn’t a big deal, I can just keep it in my local repo. I understand those tiring weeks…had a few of them doing my degrees :). Just get to it whenever you can as it isn’t a core C++ item anyways. I will pull your TypeQualifiedBuilder changes sometime today and test them here. Need to do some other work first though, :) Thanks, Kelly From: Elie Morisse [mailto:[email protected]] Hey Kelly I had a tiring week and still haven't looked properly at member function pointers. Do the latest commits break anything in your tests? — |
Hey Kelly, I learned today that BO_PtrMemD and BO_PtrMemI aren't for member function pointers, they're for any "member pointer type", and a value with a "member pointer type" is just an offset. What the spec says: And Clang has some examples: |
Hello Elie, I didn’t see the specifics below when I was looking at this. I just saw the clang error and a post on a newsgroup that seemed to indicate these were for pointers to member functions. I guess I should have looked into this further, sorry. So now the question is…is there a D equivalent to these? Point 6 in the spec seems to indicate that a pointer to a function could be the result of this pointer-to-member operator, does it not? With an opCall being used on the result? I guess that is what the newsgroup post was referring to. In this single case can we just translate to an opCall with the result as the operand? Thanks, Kelly From: Elie Morisse [mailto:[email protected]] Hey Kelly, I learned today that BO_PtrMemD and BO_PtrMemI aren't for member function pointers, they're for any "member pointer type", and a value with a "member pointer type" is just an offset. What the spec says: And Clang has some examples: — |
BO_PtrMemD is for « LHS.*RHS » and BO_PtrMemI is for « LHS->*RHS », where LHS is an object/pointer and RHS is a "member pointer" value, which is basically an offset. AFAIK there is no equivalent in D to "member pointer types": http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html so in cpptypes.cpp they are mapped to ptrdiff_t. Since you still have access to the MemberPointerType when mapping expression the type of the result of the BO_PtrMemD/I expression is known (it's RHS.getPointeeType()). Other than that I'm not sure what would be the appropriate mapping for these expressions but you don't need opCall, it's not related. |
Hello Elie, I added a pull request for that extra build script I talked about a couple weeks back. Let me know if you want me to add some notes to the readme on how it works, if anything is unclear. I named it BUILD so that it wouldn’t be confused with the build.sh file in the root testing dir. Maybe BUILD_STL would be better? Or something else? Anyways, change as you see fit…I am just used to BUILD for my testing scripts :) Sorry, I haven’t had much time lately to look into anything else. Hopefully I can find some more time soon. Thanks, Kelly From: Elie Morisse [mailto:[email protected]] BO_PtrMemD is for « LHS.RHS » and BO_PtrMemI is for « LHS->RHS », where LHS is an object/pointer and RHS is a "member pointer" value, which is basically an offset. AFAIK there is no equivalent in D to "member pointer types": http://clang.llvm.org/doxygen/classclang_1_1MemberPointerType.html so in cpptypes.cpp they are mapped to ptrdiff_t. Since you still have access to the MemberPointerType when mapping expression the type of the result of the BO_PtrMemD/I expression is known (it's RHS.getPointeeType()). Other than that I'm not sure what would be the appropriate mapping for these expressions but you don't need opCall, it's not related. — |
Mapping and sending back member function pointers are fully implemented for the Itanium ABI. They join C++ vtable generation as features that need to be ported to the MSVC ABI. |
This is c++11 specific, but including files like require c++11 support. This moves things along a little further.