blob: c63b1b33d6d6d3da2139d01ffcd142b8695954db [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
Reid Spencer5f016e22007-07-11 17:01:13 +00005
Chris Lattnercd098472007-10-10 18:08:07 +00006Warn about "X && 0x1000" saying that the user may mean "X & 0x1000".
Chris Lattner507cc6c2007-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 ||.
Reid Spencer5f016e22007-07-11 17:01:13 +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
Chris Lattner136f93a2007-07-16 06:55:01 +000028This specific diagnostic is implemented, but others should be updated.
29
Reid Spencer5f016e22007-07-11 17:01:13 +000030//===---------------------------------------------------------------------===//
31
Ted Kremenekdbff47f2007-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 Gregora26877f2008-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 Gregor20bcd552009-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 Gregora26877f2008-11-17 17:14:10 +000062
Douglas Gregora3a83512009-04-01 23:51:29 +000063//===---------------------------------------------------------------------===//
64More ideas for code modification hints:
65 - 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).
66 - 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.
67 - 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 +000068
69//===---------------------------------------------------------------------===//
70
71Options to support:
Daniel Dunbar9af86952009-11-10 16:23:44 +000072 -ftabstop=width
73 -fpreprocessed mode.
74 -nostdinc++
75 -imultilib