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

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 28 01:29:57 PDT 2017


baloghadamsoftware added inline comments.


================
Comment at: test/clang-tidy/readability-static-accessed-through-instance.cpp:34
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: static member accessed through instance  [readability-static-accessed-through-instance]
+  // CHECK-FIXES: {{^}}  C::x;{{$}}
+}
----------------
xazax.hun wrote:
> baloghadamsoftware wrote:
> > aaron.ballman wrote:
> > > This fix-it worries me because it changes the semantics of the code. The function `f()` is no longer called, and so this isn't a valid source transformation.
> > Maybe the correct fix would be here f(1, 2, 3, 4); C::x;
> Maybe for now we should just skip this cases. Expr::HasSideEffects might be a  good candidate to filter these cases. 
I think including the expression with side effect before the member access (as I suggested) is not more complicated than skipping these cases.


Repository:
  rL LLVM

https://reviews.llvm.org/D35937





More information about the cfe-commits mailing list