aaron.ballman added a subscriber: aaron.ballman.
aaron.ballman added a comment.

I think this check is a bit too aggressive about suggesting removal of parens. 
For instance:

  return (foo && (bar || baz));

It seems reasonable that with more complex subexpressions involving operators 
of differing precedence that a user may want to keep the outer parens for 
clarity and that removing them actually reduces readability. Perhaps an option 
is in order (uncertain what to default its value to) to support that?

Also, how well does this interact with macro expansions, where parens are like 
candy?

  #define FOO(x) (x)
  
  void f() {
    return FOO(12)
  }


================
Comment at: clang-tidy/readability/ReturnWithRedundantParensCheck.cpp:26
@@ +25,3 @@
+void ReturnWithRedundantParensCheck::check(
+    const ast_matchers::MatchFinder::MatchResult &Result) {
+
----------------
No need for `ast_matchers`.

================
Comment at: test/clang-tidy/readability-return-with-redundant-parens.cpp:24
@@ +23,2 @@
+  // CHECK-FIXES: {{^  }}return 1;{{$}}
+}
----------------
> IMO, clang-tidy should be agnostic as to input formatting for what it can 
> handle.

Strongly agreed.


http://reviews.llvm.org/D16286



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to