llvm-project/clang/test
Douglas Gregor 87f95b0a6a Introduce code modification hints into the diagnostics system. When we
know how to recover from an error, we can attach a hint to the
diagnostic that states how to modify the code, which can be one of:

  - Insert some new code (a text string) at a particular source
    location
  - Remove the code within a given range
  - Replace the code within a given range with some new code (a text
    string)

Right now, we use these hints to annotate diagnostic information. For
example, if one uses the '>>' in a template argument in C++98, as in
this code:

  template<int I> class B { };
  B<1000 >> 2> *b1;

we'll warn that the behavior will change in C++0x. The fix is to
insert parenthese, so we use code insertion annotations to illustrate
where the parentheses go:

test.cpp:10:10: warning: use of right-shift operator ('>>') in template
argument will require parentheses in C++0x
  B<1000 >> 2> *b1;
         ^
    (        )


Use of these annotations is partially implemented for HTML
diagnostics, but it's not (yet) producing valid HTML, which may be
related to PR2386, so it has been #if 0'd out.

In this future, we could consider hooking this mechanism up to the
rewriter to actually try to fix these problems during compilation (or,
after a compilation whose only errors have fixes). For now, however, I
suggest that we use these code modification hints whenever we can, so
that we get better diagnostics now and will have better coverage when
we find better ways to use this information.

This also fixes PR3410 by placing the complaint about missing tokens
just after the previous token (rather than at the location of the next
token).

llvm-svn: 65570
2009-02-26 21:00:50 +00:00
..
Analysis Add experimental logic in GRExprEngine::EvalEagerlyAssume() to handle 2009-02-25 22:32:02 +00:00
CodeGen Add end of line at end. 2009-02-26 19:00:14 +00:00
CodeGenCXX Add basic support for C++ name mangling according to the Itanium C++ 2009-02-13 00:10:09 +00:00
CodeGenObjC handle @encode interactions with array initializers. 2009-02-24 23:10:27 +00:00
Coverage Support va_arg on _Complex. 2009-02-10 03:03:30 +00:00
Driver just remove this insane testcase :) 2009-02-08 19:44:51 +00:00
Lexer Fix PR2477 - clang misparses "//*" in C89 mode 2009-01-16 22:39:25 +00:00
Misc Fix PR3635 by handling ## magically 2009-02-24 05:29:33 +00:00
Parser Introduce code modification hints into the diagnostics system. When we 2009-02-26 21:00:50 +00:00
Preprocessor fix PR3579: __LINE__ expands to the presumed location of the 2009-02-15 21:06:15 +00:00
Rewriter Extend builtin "attribute" syntax to include a notation for 2009-02-14 00:32:47 +00:00
Sema Fix for PR3663/3669: use TryToFixInvalidVariablyModifiedType for 2009-02-26 03:58:54 +00:00
SemaCXX Improve merging of function declarations. Specifically: 2009-02-24 01:23:02 +00:00
SemaObjC Fix <rdar://problem/6574319> clang issues error on 'readonly' property with a defaul setter attribute. 2009-02-26 19:11:32 +00:00
SemaObjCXX When inside an Objective-C++ method, name lookup should look into the 2009-02-16 19:28:42 +00:00
SemaTemplate Introduce code modification hints into the diagnostics system. When we 2009-02-26 21:00:50 +00:00
Serialization true is pass, false is success. 2009-02-03 07:28:12 +00:00
Makefile Add test case for __ASSEMBLER__ definition. 2008-12-01 19:23:47 +00:00
TestRunner.sh Test commit. 2008-10-15 00:26:06 +00:00