This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/62314] New: Fix-it Hints


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62314

            Bug ID: 62314
           Summary: Fix-it Hints
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: manu at gcc dot gnu.org

Created attachment 33421
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33421&action=edit
fixit-hints draft implementation

Quoting from http://clang.llvm.org/diagnostics.html

"Fix-it" hints provide advice for fixing small, localized problems in source
code. When Clang produces a diagnostic about a particular problem that it can
work around (e.g., non-standard or redundant syntax, missing keywords, common
mistakes, etc.), it may also provide specific guidance in the form of a code
transformation to correct the problem.

  $ clang t.cpp
  t.cpp:9:3: error: template specialization requires 'template<>'
    struct iterator_traits<file_iterator> {
    ^
    template<> 


The attached patch implements the same behavior for GCC when given
-fdiagnostic-show-caret. When the caret is disabled, it gives:

  t.cpp:9:3: error: template specialization requires 'template<>'
  t.cpp:9:3: fixit: template<> 

so an IDE might parse the "fixit:" diagnostic and use the message to edit the
text directly.

This is work in progress I have not even tried to build gcc using this patch.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]