alexfh added inline comments.

================
Comment at: clang-tidy/misc/StringIntegerAssignmentCheck.cpp:45
@@ +44,3 @@
+
+  auto Diag = diag(Loc, "probably missing to_string operation");
+  if (!Loc.isMacroID() && getLangOpts().CPlusPlus11) {
----------------
I'd expand the message with an explanation of what actually happens here. Also 
it's not clear what the "to_string operation" refers to. And one more thing I 
missed, is other character types.

So I'd go with something similar to: "an integer is interpreted as a character 
code when assigning it to a string; if this is intended, cast the integer to 
'%0'; if you want a string representation, use 
%select{std::to_string()|std::to_wstring()|appropriate conversion facility}1", 
where %0 should be substituted with `char`/`wchar_t`/whatever the specific 
character type is.

(and please add tests for other character types)


http://reviews.llvm.org/D15411



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to