[LLVMbugs] [Bug 19485] New: fix-it display in text diagnostics is difficult to read and understand

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 18 18:27:25 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19485

            Bug ID: 19485
           Summary: fix-it display in text diagnostics is difficult to
                    read and understand
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12410
  --> http://llvm.org/bugs/attachment.cgi?id=12410&action=edit
possible alternative output style

Users frequently have issues understanding what fix-it hints mean, or even
noticing they're present. In particular:
 * when the caret points somewhere other than where text should be inserted,
users often have a hard time understanding where the insert should be made
 * there is no visible difference between a fix-it saying to insert "const"
after a semicolon and one saying to insert " const" before a semicolon

A file demonstrating one possible diagnostic output style (modeled after
unified diffs) is attached (with ANSI color codes). The same output without
colors is:

<stdin>:2:3: warning: 'constexpr' specifier is incompatible with C++98
[-Wc++98-compat]
   constexpr int getSize();
   ^~~~~~~~~
<stdin>:2:17: warning: 'constexpr' non-static member function will not be
implicitly 'const' in C++1y; add 'const' to avoid a change in behavior
[-Wconstexpr-not-const]
-  constexpr int getSize();
+  constexpr int getSize() const;
                 ^
<stdin>:3:3: warning: 'constexpr' specifier is incompatible with C++98
[-Wc++98-compat]
   constexpr int n;
   ^~~~~~~~~
<stdin>:3:3: error: non-static data member cannot be constexpr; did you intend
to make it const?
-  constexpr int n;
+  const int n;
             ^
<stdin>:4:3: warning: 'const' type qualifier on return type has no effect
[-Wignored-qualifiers]
-  const int f();
+  int f();
   ^   ~~~
4 warnings and 1 error generated.




Input file and current Clang output:

struct S {
  constexpr int getSize();
  constexpr int n;
  const int f();
};



<stdin>:2:3: warning: 'constexpr' specifier is incompatible with C++98
[-Wc++98-compat]
  constexpr int getSize();
  ^
<stdin>:2:17: warning: 'constexpr' non-static member function will not be
implicitly 'const' in C++1y; add 'const' to avoid a change in behavior
      [-Wconstexpr-not-const]
  constexpr int getSize();
                ^
                          const
<stdin>:3:3: warning: 'constexpr' specifier is incompatible with C++98
[-Wc++98-compat]
  constexpr int n;
  ^
<stdin>:3:3: error: non-static data member cannot be constexpr; did you intend
to make it const?
  constexpr int n;
  ^~~~~~~~~
  const
<stdin>:4:3: warning: 'const' type qualifier on return type has no effect
[-Wignored-qualifiers]
  const int f();
  ^~~~~~
4 warnings and 1 error generated.

-- 
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/20140419/9433a8aa/attachment.html>


More information about the llvm-bugs mailing list