Commit Graph

2 Commits

Author SHA1 Message Date
Daniel Marjamaki 368590094a Sema: Cleanup and improve string-plus-char checking.
Patch by Anders Rönnholm

llvm-svn: 224268
2014-12-15 20:22:33 +00:00
Jordan Rose 5565941eff Add -Wstring-plus-char, which warns when adding char literals to C strings.
Specifically, this warns when a character literal is added (using '+') to a
variable with type 'char *' (or any other pointer to character type). Like
-Wstring-plus-int, there is a fix-it to change "foo + 'a'" to "&foo['a']"
iff the character literal is on the right side of the string.

Patch by Anders Rönnholm!

llvm-svn: 193418
2013-10-25 16:52:00 +00:00