[PATCH] D18914: [clang-tidy] new readability-redundant-inline

Matthias Gehre via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 9 05:38:51 PDT 2016


mgehre added a comment.

I'm thinking about extending the check to the following issue and would like to hear your opinion.
In C++, the following three code snippets all have identical meaning
1:

  struct S {
    int f();
  };
  
  inline int S::f() {
   return 0;
  }

2:

  struct S {
    inline int f();
  };
  int S::f() {
   return 0;
  }

3:

  struct S {
    inline int f();
  };
  
  inline int S::f() {
   return 0;
  }

I personally think that 1) should be used, because late one could move the function definition to a source file (removing the inline) without having to touch
the class declaration. I can extend this patch to transform 2) and 3) into 1).

Alternatively, I could add an option to choose between 1), 2) or 3).
What do you think?


http://reviews.llvm.org/D18914





More information about the cfe-commits mailing list