[llvm-bugs] [Bug 43816] New: fix-it in clang

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Oct 26 03:57:21 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=43816

            Bug ID: 43816
           Summary: fix-it in clang
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: llvm at alex.lanin.de
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Hello,

clang-tidy can not only be used to improve code, but also to make it work in
the first place.

Taking an example from
https://github.com/llvm-mirror/clang/blob/master/test/SemaTemplate/dependent-template-recover.cpp

    template<typename T, typename U, int N>
    struct X {
      void f(T* t) {
        t->f0<U>(); // expected-error{{use 'template' keyword to treat 'f0' as
a dependent template name}}
      }
    };

Clang-tidy is capable of fixing that error.
However it’s not possible to fix it without running any other checks?!
e.g. this works fine: clang-tidy --checks="*" test.cpp -fix-errors but it
performs all sorts of other changes.

The best approach seems to be to pick some checker that doesn’t find anything
in order to fix only errors ?!


Clang itself emits the same warning and suggestion, but there is no way to
fix-it from there. See https://godbolt.org/z/iXXy4o

According to http://lists.llvm.org/pipermail/cfe-dev/2019-October/063703.html
I'm hereby trying to file the idea here to have either some clang -fix option
or clang-tidy running without mandatory checkers.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191026/76bb89e6/attachment-0001.html>


More information about the llvm-bugs mailing list