Abpostelnicu added inline comments.

================
Comment at: clang-tidy/readability/UnnecessaryIntermediateVarCheck.cpp:376
+    // expression wouldn't really benefit readability. Therefore we abort.
+    if (NewReturnLength > MaximumLineLength) {
+      return;
----------------
lebedev.ri wrote:
> Is there really no way to format the fixes, and *then* check the line length?
> ```
> $ clang-tidy --help
> ...
>   -format-style=<string>       - 
>                                  Style for formatting code around applied 
> fixes:
>                                    - 'none' (default) turns off formatting
>                                    - 'file' (literally 'file', not a 
> placeholder)
>                                      uses .clang-format file in the closest 
> parent
>                                      directory
>                                    - '{ <json> }' specifies options inline, 
> e.g.
>                                      -format-style='{BasedOnStyle: llvm, 
> IndentWidth: 8}'
>                                    - 'llvm', 'google', 'webkit', 'mozilla'
>                                  See clang-format documentation for the 
> up-to-date
>                                  information about formatting styles and 
> options.
>                                  This option overrides the 'FormatStyle` 
> option in
>                                  .clang-tidy file, if any.
> ...
> ```
> so `clang-tidy` is at least aware of `clang-format`.
I think this is doable since I see this in the code:

https://code.woboq.org/llvm/clang-tools-extra/clang-tidy/ClangTidy.cpp.html#199

That leads me to think that we can have this before applying the fixes and in 
case the fix after re-format has a line that violates our rule it gets dropped. 
I'm gonna update the patch with this new addon.


https://reviews.llvm.org/D37014



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

Reply via email to