[PATCH] D35937: [clang-tidy] Add new readability non-idiomatic static access

Barancsuk Lilla via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 27 04:44:29 PDT 2017


barancsuk created this revision.
barancsuk added a project: clang-tools-extra.
Herald added subscribers: baloghadamsoftware, xazax.hun, whisperity, JDevlieghere, mgorny.

Checks for member expressions that access static members through instances, and
replaces them with the corresponding expressions that use a more readable `::` operator.

Example:

The following code:

  struct C {
    static void foo();
    static int x;
  };
  
  C *c1=new C();
  c1->foo();
  c1->x;

is changed to:

  C::foo();
  C::x;


Repository:
  rL LLVM

https://reviews.llvm.org/D35937

Files:
  clang-tidy/readability/CMakeLists.txt
  clang-tidy/readability/ReadabilityTidyModule.cpp
  clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
  clang-tidy/readability/StaticAccessedThroughInstanceCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/readability-static-accessed-through-instance.rst
  test/clang-tidy/readability-static-accessed-through-instance.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35937.108448.patch
Type: text/x-patch
Size: 11681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170727/28146c9d/attachment.bin>


More information about the cfe-commits mailing list