blob: df65be409daff2f05e00c4079f802167d15b28d4 [file] [log] [blame]
Chris Lattner4b009652007-07-25 00:24:17 +00001//===---------------------------------------------------------------------===//
2// Minor random things that can be improved
3//===---------------------------------------------------------------------===//
Steve Naroff7cabb922008-03-18 20:05:01 +00004
Chris Lattner4b009652007-07-25 00:24:17 +00005
Chris Lattnerd8c4f142007-10-10 18:08:07 +00006Warn about "X && 0x1000" saying that the user may mean "X & 0x1000".
Chris Lattner1b188fd2007-10-11 16:06:02 +00007We should do this for any immediate except zero, so long as it doesn't come
8from a macro expansion. Likewise for ||.
Chris Lattner4b009652007-07-25 00:24:17 +00009
10//===---------------------------------------------------------------------===//
11
12Lexer-related diagnostics should point to the problematic character, not the
13start of the token. For example:
14
15int y = 0000\
1600080;
17
18diag.c:4:9: error: invalid digit '8' in octal constant
19int y = 0000\
20 ^
21
22should be:
23
24diag.c:4:9: error: invalid digit '8' in octal constant
2500080;
26 ^
27
28This specific diagnostic is implemented, but others should be updated.
29
30//===---------------------------------------------------------------------===//
31
Ted Kremenek18b4ced2007-10-10 18:52:22 +000032C++ (checker): For iterators, warn of the use of "iterator++" instead
33 of "++iterator" when when the value returned by operator++(int) is
34 ignored.
Douglas Gregor5d0cc082008-11-17 17:14:10 +000035
36//===---------------------------------------------------------------------===//
37
38We want to keep more source range information in Declarator to help
39produce better diagnostics. Declarator::getSourceRange() should be
40implemented to give a range for the whole declarator with all of its
41specifiers, and DeclaratorChunk::ParamInfo should also have a source
42range covering the whole parameter, so that an error message like this:
43
44overloaded-operator-decl.cpp:37:23: error: parameter of overloaded post-increment operator must have type 'int' (not 'float')
45X operator++(X&, const float& f);
46 ^
47can be turned into something like this:
48
49overloaded-operator-decl.cpp:37:23: error: parameter of overloaded post-increment operator must have type 'int' (not 'float')
50X operator++(X&, const float& f);
51 ^ ~~~~~~~~~~~~~~
52
Douglas Gregor4e228cb2009-02-04 13:07:56 +000053//===---------------------------------------------------------------------===//
54
55For terminal output, we should consider limiting the amount of
56diagnostic text we print once the first error has been
57encountered. For example, once we have produced an error diagnostic,
58we should only continue producing diagnostics until we have produced a
59page full of results (say, 50 lines of text). Beyond that, (1) the
60remaining errors are likely to be less interesting, and (2) the poor
61user has to scroll his terminal to find out where things went wrong.
Douglas Gregor5d0cc082008-11-17 17:14:10 +000062
63
64