[clang] b750486 - [Driver] Avoid copies in range-based for loops
Mark de Wever via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 17 12:56:52 PST 2019
Author: Mark de Wever
Date: 2019-12-17T21:56:04+01:00
New Revision: b750486c5d96320daf77a9760166f78b4a0c942e
URL: https://github.com/llvm/llvm-project/commit/b750486c5d96320daf77a9760166f78b4a0c942e
DIFF: https://github.com/llvm/llvm-project/commit/b750486c5d96320daf77a9760166f78b4a0c942e.diff
LOG: [Driver] Avoid copies in range-based for loops
This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.
Differential Revision: https://reviews.llvm.org/D71527
Added:
Modified:
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChain.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 9139915761d1..f2b234315512 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -744,7 +744,7 @@ static bool searchForFile(SmallVectorImpl<char> &FilePath,
ArrayRef<std::string> Dirs,
StringRef FileName) {
SmallString<128> WPath;
- for (const StringRef &Dir : Dirs) {
+ for (const std::string &Dir : Dirs) {
if (Dir.empty())
continue;
WPath.clear();
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index ba4128e06226..cab97b1a601a 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -850,7 +850,7 @@ void ToolChain::addExternCSystemIncludeIfExists(const ArgList &DriverArgs,
/*static*/ void ToolChain::addSystemIncludes(const ArgList &DriverArgs,
ArgStringList &CC1Args,
ArrayRef<StringRef> Paths) {
- for (const auto Path : Paths) {
+ for (const auto &Path : Paths) {
CC1Args.push_back("-internal-isystem");
CC1Args.push_back(DriverArgs.MakeArgString(Path));
}
More information about the cfe-commits
mailing list