[PATCH] Abstract out virtual calls and virtual function prologue code generation

Reid Kleckner rnk at google.com
Thu Aug 1 10:46:13 PDT 2013


  Looks fine to me.  I think going forward we wrap long assignment the way clang-format does it.


================
Comment at: lib/CodeGen/CGCXXABI.h:208
@@ +207,3 @@
+  virtual llvm::Value*
+  adjustThisArgumentInPrologue(CodeGenFunction &CGF, GlobalDecl GD,
+                               llvm::Value *This) {
----------------
Can you work "virtual" into the method name somehow?  Only the comment says anything about virtual methods.  Also, once we're in the method, 'this' is a parameter, not an argument.

================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:114
@@ -113,1 +113,3 @@
 
+  const CXXRecordDecl* getThisArgumentTypeForMethod(const CXXMethodDecl *MD) {
+    MD = MD->getCanonicalDecl();
----------------
nit: star on the right

================
Comment at: lib/CodeGen/MicrosoftCXXABI.cpp:124
@@ +123,3 @@
+
+  virtual llvm::Value*
+  adjustThisArgumentForVirtualCall(CodeGenFunction &CGF, GlobalDecl GD,
----------------
Doesn't really matter, but clang-format will spell this "Value *" here and elsewhere.

================
Comment at: lib/CodeGen/CGExprCXX.cpp:316
@@ +315,3 @@
+  if (MD->isVirtual())
+    This = CGM.getCXXABI().adjustThisArgumentForVirtualCall(*this, MD, This);
+
----------------
It looks like this is the only caller of this ABI hook.  I guess it's better to expose two entry points than it is to take a boolean into BuildVirtualCall.


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



More information about the cfe-commits mailing list