[clang-tools-extra] r361457 - Remove unnecessary const&s; NFC
George Burgess IV via cfe-commits
cfe-commits at lists.llvm.org
Wed May 22 19:52:39 PDT 2019
Author: gbiv
Date: Wed May 22 19:52:39 2019
New Revision: 361457
URL: http://llvm.org/viewvc/llvm-project?rev=361457&view=rev
Log:
Remove unnecessary const&s; NFC
It's uncommon to rely on temporary lifetime extension when having a
regular, non-`const&` value behaves identically. Since `Twine::str`
and `buildFixMsgForStringFlag` both return regular `std::string`s,
there's seemingly no point in having `const&` here.
Modified:
clang-tools-extra/trunk/clang-tidy/android/CloexecAcceptCheck.cpp
clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp
clang-tools-extra/trunk/clang-tidy/android/CloexecDupCheck.cpp
Modified: clang-tools-extra/trunk/clang-tidy/android/CloexecAcceptCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecAcceptCheck.cpp?rev=361457&r1=361456&r2=361457&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/android/CloexecAcceptCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/android/CloexecAcceptCheck.cpp Wed May 22 19:52:39 2019
@@ -29,7 +29,7 @@ void CloexecAcceptCheck::registerMatcher
}
void CloexecAcceptCheck::check(const MatchFinder::MatchResult &Result) {
- const std::string &ReplacementText =
+ std::string ReplacementText =
(Twine("accept4(") + getSpellingArg(Result, 0) + ", " +
getSpellingArg(Result, 1) + ", " + getSpellingArg(Result, 2) +
", SOCK_CLOEXEC)")
Modified: clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp?rev=361457&r1=361456&r2=361457&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/android/CloexecCheck.cpp Wed May 22 19:52:39 2019
@@ -90,7 +90,7 @@ void CloexecCheck::insertStringFlag(
if (!ModeStr || (ModeStr->getString().find(Mode) != StringRef::npos))
return;
- const std::string &ReplacementText = buildFixMsgForStringFlag(
+ std::string ReplacementText = buildFixMsgForStringFlag(
ModeArg, *Result.SourceManager, Result.Context->getLangOpts(), Mode);
diag(ModeArg->getBeginLoc(), "use %0 mode '%1' to set O_CLOEXEC")
Modified: clang-tools-extra/trunk/clang-tidy/android/CloexecDupCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/android/CloexecDupCheck.cpp?rev=361457&r1=361456&r2=361457&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/android/CloexecDupCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/android/CloexecDupCheck.cpp Wed May 22 19:52:39 2019
@@ -23,7 +23,7 @@ void CloexecDupCheck::registerMatchers(M
}
void CloexecDupCheck::check(const MatchFinder::MatchResult &Result) {
- const std::string &ReplacementText =
+ std::string ReplacementText =
(Twine("fcntl(") + getSpellingArg(Result, 0) + ", F_DUPFD_CLOEXEC)")
.str();
More information about the cfe-commits
mailing list