summaryrefslogtreecommitdiffstats
path: root/lib/Sema/SemaFixItUtils.cpp
Commit message (Collapse)AuthorAgeFilesLines
* PR17290: Use 'false' macro in fix-it hint for initializing a variable of typeRichard Smith2013-09-201-10/+18
| | | | | | | | | | _Bool in C, if the macro is defined. Also teach FixItUtils to look at whether the macro was defined at the source location for which it is creating a fixit, rather than looking at whether it's defined *now*. This is especially relevant for analysis-based warnings which are delayed until end of TU. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191057 91177308-0d34-0410-b5e6-96231b3b80d8
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171367 91177308-0d34-0410-b5e6-96231b3b80d8
* Drop the ASTContext.h include from Stmt.h and fix up transitive users.Benjamin Kramer2012-07-041-0/+1
| | | | | | | | | | | | | | This required moving the ctors for IntegerLiteral and FloatingLiteral out of line which shouldn't change anything as they are usually called through Create methods that are already out of line. ASTContext::Deallocate has been a nop for a long time, drop it from ASTVector and make it independent from ASTContext.h Pass the StorageAllocator directly to AccessedEntity so it doesn't need to have a definition of ASTContext around. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159718 91177308-0d34-0410-b5e6-96231b3b80d8
* Add FixItHint for -Wnull-conversion to initialize with an appropriate literal.David Blaikie2012-04-301-29/+41
| | | | | | Reviewed by Doug Gregor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155839 91177308-0d34-0410-b5e6-96231b3b80d8
* Use character literals for vexing initialization fixit hints.David Blaikie2012-03-181-0/+8
| | | | | | | | | | | | | | | Instead of suggesting " = 0" for "char c();", suggest " = '\0'", and similarly for other char types (wide, 16, and 32). Add tests for all these, and since this means testing such hints under C++0x, add tests for some untested C++0x hint cases in the existing code, including suggesting nullptr for pointer initialization. This sets up the initialization helper to provide better type fidelity that will be especially helpful for non-assignment cases (such as fixit-correcting NULL usage in function calls (eg: foo(char) + foo(NULL) => foo('\0') instead of the less informative foo(0))) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153008 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor for clarity.Richard Smith2012-01-131-18/+24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148135 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't crash while trying to diagnose a function declared at block scope with anRichard Smith2012-01-131-2/+4
| | | | | | | incomplete return type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148088 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve 0-argument -Wvexing-parse diagnostic by adding notes with fix-its:Richard Smith2012-01-121-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | - If the declarator is at the start of a line, and the previous line contained another declarator and ended with a comma, then that comma was probably a typo for a semicolon: int n = 0, m = 1, l = 2, // k = 5; myImportantFunctionCall(); // oops! - If removing the parentheses would correctly initialize the object, then produce a note suggesting that fix. - Otherwise, if there is a simple initializer we can suggest which performs value-initialization, then provide a note suggesting a correction to that initializer. Sema::Declarator now tracks the location of the comma prior to the declarator in the declaration, if there is one, to facilitate providing the note. The code to determine an appropriate initializer from the -Wuninitialized warning has been factored out to allow use in both that and -Wvexing-parse. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148072 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor the */& mismatch fixit generation out of SemaOverload and provide a ↵Anna Zaks2011-07-281-0/+160
simple conversion checking function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136376 91177308-0d34-0410-b5e6-96231b3b80d8