[PATCH] [-cxx-abi microsoft] Emit thunks for pointers to virtual member functions

Timur Iskhodzhanov timurrrr at google.com
Wed Nov 13 08:06:34 PST 2013



================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:355
@@ +354,3 @@
+  /// \brief Generate a thunk for calling a virtual member function MD.
+  llvm::Function *EmitVirtualMemPtrThunk(const CXXMethodDecl *MD,
+                                         StringRef ThunkName);
----------------
Does this need to be public?

================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:1972
@@ +1971,3 @@
+  CGF.FinishFunction();
+  CGM.setFunctionLinkage(MD, ThunkFn); // XXX: Do we need this?
+
----------------
Isn't this copying the function's linkage over to the thunk?
Don't you get "symbol already defined" if you link two TUs generating the same thunk together?

================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:1932
@@ +1931,3 @@
+       I != E; ++I)
+    FunctionArgs.push_back(*I);
+
----------------
Can this be shared with the general thunk emission code?
I'm worried by the duplication of non-trivial code.

I think pretty much everything except this/return adjustment, call target and the particular linkage type can be shared.


http://llvm-reviews.chandlerc.com/D2104



More information about the cfe-commits mailing list