PATCH: don't mark pure derived method odr because of a qualified call to base method

Nick Lewycky nlewycky at google.com
Tue Feb 12 19:30:11 PST 2013


I failed to produce a concise explanation of the patch, so I'll lead off
with the testcase:

  struct Base { virtual void fn() { } };
  struct Derived : public Base { virtual void fn() = 0;
    void test() { Base::fn(); /* triggers an ODR-use of Derived::fn() */ }
  };

This is because we repurpose the odr bit on virtual functions to mean "it
would be convenient for codegen to emit this", to help devirtualization for
instance. This is implemented in Sema with a scan through all known derived
classes when building a member expression, in this case "this->Base::fn".
This patch makes that scan skip pure methods.

Patch attached, please review.

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130212/f33ccd87/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: odr-pure-7.patch
Type: application/octet-stream
Size: 965 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130212/f33ccd87/attachment.obj>


More information about the cfe-commits mailing list