[cfe-dev] [clang-tidy] readability-else-after-return

Piotr Padlewski via cfe-dev cfe-dev at lists.llvm.org
Tue Dec 8 10:55:52 PST 2015


Hi folks,
so recently I was testing clang-tidy, and I had a problem with the check
readability-else-after-return:

1. running git-clang-format after applying transformation doesn't format
everything, because this check only removes one line (+ braces), which
doesn't affect other lines, which leeds to wrong identation.
2. It only transform one else at one time so for example for code like this:

     if (multilevel && isMultilevelPolicyDescendable(policy, getDepth()))
     {
         return ..
     }
     else if (size() > 1) // it was only able to remove this one
     {
        return ...
     }
     else
    {
         if (policy.type == ClassificationType::EXTRA_PARAMS)
             return
         else
             return
    }


Did you know about those problems? I was talking with Nick (cc) and he was
surprised that not all formatting can be done by just applying
clang-format-diff.

Piotr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151208/98f1abd2/attachment.html>


More information about the cfe-dev mailing list