blob: 8c27515ae74a99678e89807bb504be254f0a56d8 [file] [log] [blame]
Reid Spencer5f016e22007-07-11 17:01:13 +00001//===---------------------------------------------------------------------===//
2// Minor random things that can be improved
3//===---------------------------------------------------------------------===//
Steve Naroff3981bf72008-03-18 20:05:01 +00004
Chris Lattnercd098472007-10-10 18:08:07 +00005Warn about "X && 0x1000" saying that the user may mean "X & 0x1000".
Chris Lattner507cc6c2007-10-11 16:06:02 +00006We should do this for any immediate except zero, so long as it doesn't come
7from a macro expansion. Likewise for ||.
Reid Spencer5f016e22007-07-11 17:01:13 +00008
9//===---------------------------------------------------------------------===//
10
11Lexer-related diagnostics should point to the problematic character, not the
12start of the token. For example:
13
14int y = 0000\
1500080;
16
17diag.c:4:9: error: invalid digit '8' in octal constant
18int y = 0000\
19 ^
20
21should be:
22
23diag.c:4:9: error: invalid digit '8' in octal constant
2400080;
25 ^
26
Chris Lattner136f93a2007-07-16 06:55:01 +000027This specific diagnostic is implemented, but others should be updated.
28
Reid Spencer5f016e22007-07-11 17:01:13 +000029//===---------------------------------------------------------------------===//
30
Ted Kremenekdbff47f2007-10-10 18:52:22 +000031C++ (checker): For iterators, warn of the use of "iterator++" instead
32 of "++iterator" when when the value returned by operator++(int) is
33 ignored.
Douglas Gregora26877f2008-11-17 17:14:10 +000034
35//===---------------------------------------------------------------------===//
36
37We want to keep more source range information in Declarator to help
38produce better diagnostics. Declarator::getSourceRange() should be
39implemented to give a range for the whole declarator with all of its
40specifiers, and DeclaratorChunk::ParamInfo should also have a source
41range covering the whole parameter, so that an error message like this:
42
43overloaded-operator-decl.cpp:37:23: error: parameter of overloaded post-increment operator must have type 'int' (not 'float')
44X operator++(X&, const float& f);
45 ^
46can be turned into something like this:
47
48overloaded-operator-decl.cpp:37:23: error: parameter of overloaded post-increment operator must have type 'int' (not 'float')
49X operator++(X&, const float& f);
50 ^ ~~~~~~~~~~~~~~
51
Douglas Gregor20bcd552009-02-04 13:07:56 +000052//===---------------------------------------------------------------------===//
53
54For terminal output, we should consider limiting the amount of
55diagnostic text we print once the first error has been
56encountered. For example, once we have produced an error diagnostic,
57we should only continue producing diagnostics until we have produced a
58page full of results (say, 50 lines of text). Beyond that, (1) the
59remaining errors are likely to be less interesting, and (2) the poor
60user has to scroll his terminal to find out where things went wrong.
Douglas Gregora26877f2008-11-17 17:14:10 +000061
Douglas Gregora3a83512009-04-01 23:51:29 +000062//===---------------------------------------------------------------------===//
63More ideas for code modification hints:
64 - If no member of a given name is found in a class/struct, search through the names of entities that do exist in the class and suggest the closest candidate. e.g., if I write "DS.setTypeSpecType", it would suggest "DS.SetTypeSpecType" (edit distance = 1).
65 - If a class member is defined out-of-line but isn't in the class declaration (and there are no close matches!), provide the option to add an in-class declaration.
66 - Fix-it hints for the inclusion of headers when needed for particular features (e.g., <typeinfo> for typeid)
Daniel Dunbar9af86952009-11-10 16:23:44 +000067
68//===---------------------------------------------------------------------===//
69
70Options to support:
Daniel Dunbar9af86952009-11-10 16:23:44 +000071 -ftabstop=width
72 -fpreprocessed mode.
73 -nostdinc++
74 -imultilib
Marshall Clow72a2eb62011-01-04 19:19:20 +000075