alexfh requested changes to this revision. This revision now requires changes to proceed.
================ Comment at: clang-tidy/boost/UseToStringCheck.cpp:55 @@ +54,3 @@ +void UseToStringCheck::check(const MatchFinder::MatchResult &Result) { + const auto *MatchedToString = Result.Nodes.getNodeAs<CallExpr>("to_string"); + auto CharType = ---------------- "Matched" isn't useful here and "ToString" is misleading. I'd name this `LexicalCastCall` or just `Call`. ================ Comment at: clang-tidy/boost/UseToStringCheck.cpp:59 @@ +58,3 @@ + + if (CharType.isNull()) + return; ---------------- When can `CharType` be `isNull()`? Do you have a test case for this? ================ Comment at: clang-tidy/boost/UseToStringCheck.cpp:64 @@ +63,3 @@ + CharType->isSpecificBuiltinType(BuiltinType::Char_U)) { + apply(MatchedToString, + "use std::to_string instead of boost::lexical_cast<std::string>", ---------------- I'd rewrite this code as: StringRef StringType; if (CharType->isSpecificBuiltinType(BuiltinType::Char_S) || CharType->isSpecificBuiltinType(BuiltinType::Char_U)) StringType = "string"; else if (CharType->isSpecificBuiltinType(BuiltinType::WChar_S) || CharType->isSpecificBuiltinType(BuiltinType::WChar_U)) StringType = "wstring"; else return; diag(Call->getLocStart(), "use std::to_%0 instead of boost::lexical_cast<std::%0>") << StringType << FixItHint::CreateReplacement( CharSourceRange::getCharRange(Call->getLocStart(), Call->getArg(0)->getExprLoc()), (llvm::Twine("std::to_") + StringType).str()); ================ Comment at: clang-tidy/boost/UseToStringCheck.cpp:68 @@ +67,3 @@ + } + // Is CharType 'wchar_t'. + else if (CharType->isSpecificBuiltinType(BuiltinType::WChar_S) || ---------------- Please move this comment inside the `if` body. As it is now, it breaks the formatting. ================ Comment at: docs/clang-tidy/checks/boost-use-to-string.rst:6 @@ +5,3 @@ + +This check finds conversion from integer type like int to std::string or +std::wstring using boost::lexical_cast, and replace it to calls of ---------------- Please enclose inline code snippets in double backquotes (`int`, `std::string`, etc.). http://reviews.llvm.org/D18136 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits