[PATCH] D18396: Clang-tidy:modernize-use-override. Fix for __declspec attributes and const=0 without spacse

Robert Bolter via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 23 08:02:49 PDT 2016


Rob created this revision.
Rob added reviewers: alexfh, aaron.ballman.
Rob added a subscriber: cfe-commits.

This patch is to address 2 problems I found with Clang-tidy:modernize-use-override.

1: missing spaces on pure function decls.

Orig:
void pure() const=0
Problem:
void pure() constoverride =0
Fixed:
void pure() const override =0

2: This is ms-extension specific, but possibly applies to other attribute types.  The override is placed before the attribute which doesn’t work well with declspec as this attribute can be inherited or placed before the method identifier.

Orig:
class __declspec(dllexport) X : public Y
  {
  void p();
  };
Problem:
class override __declspec(dllexport) class X : public Y
  {
  void p();
  };
Fixed:
class __declspec(dllexport) class X : public Y
  {
  void p() override;
  };


http://reviews.llvm.org/D18396

Files:
  clang-tidy/modernize/UseOverrideCheck.cpp
  test/clang-tidy/modernize-use-override-ms.cpp
  test/clang-tidy/modernize-use-override.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18396.51417.patch
Type: text/x-patch
Size: 4220 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160323/55f0b24d/attachment.bin>


More information about the cfe-commits mailing list