[PATCH] D71527: [Driver] Avoid copies in range-based for loops
Mark de Wever via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 15 09:37:25 PST 2019
Mordante created this revision.
Mordante added reviewers: Eugene.Zelenko, sepavloff, aaron.ballman, xbolva00.
Mordante added a project: clang.
This avoids new warnings due to D68912 <https://reviews.llvm.org/D68912> adds -Wrange-loop-analysis to -Wall.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D71527
Files:
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChain.cpp
Index: clang/lib/Driver/ToolChain.cpp
===================================================================
--- clang/lib/Driver/ToolChain.cpp
+++ clang/lib/Driver/ToolChain.cpp
@@ -850,7 +850,7 @@
/*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));
}
Index: clang/lib/Driver/Driver.cpp
===================================================================
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -744,7 +744,7 @@
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();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71527.233974.patch
Type: text/x-patch
Size: 1048 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191215/163ee604/attachment.bin>
More information about the cfe-commits
mailing list