Skip to content

Commit 75eacbf

Browse files
committed
Fix issues reported by -Wrange-loop-analysis when building with latest Clang (trunk). NFC.
Fixes warning: loop variable 'E' of type 'const llvm::StringRef' creates a copy from type 'const llvm::StringRef' [-Wrange-loop-analysis]
1 parent c972f6f commit 75eacbf

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

clang-tools-extra/clangd/unittests/ParsedASTTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ MATCHER_P(WithTemplateArgs, ArgName, "") {
5656
LangOptions LO;
5757
PrintingPolicy Policy(LO);
5858
Policy.adjustForCPlusPlus();
59-
for (const auto Arg : Args->asArray()) {
59+
for (const auto &Arg : Args->asArray()) {
6060
if (SpecializationArgs.size() > 0)
6161
SpecializationArgs += ",";
6262
SpecializationArgs += Arg.getAsType().getAsString(Policy);

clang-tools-extra/clangd/unittests/RenameTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ TEST(RenameTest, WithinFileRename) {
404404
template <> struct Bar<[[Foo]]> {};
405405
)cpp",
406406
};
407-
for (const auto T : Tests) {
407+
for (llvm::StringRef T : Tests) {
408408
Annotations Code(T);
409409
auto TU = TestTU::withCode(Code.code());
410410
TU.ExtraArgs.push_back("-fno-delayed-template-parsing");

llvm/lib/Support/Windows/Program.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program,
197197
// An environment block consists of a null-terminated block of
198198
// null-terminated strings. Convert the array of environment variables to
199199
// an environment block by concatenating them.
200-
for (const auto E : *Env) {
200+
for (StringRef E : *Env) {
201201
SmallVector<wchar_t, MAX_PATH> EnvString;
202202
if (std::error_code ec = windows::UTF8ToUTF16(E, EnvString)) {
203203
SetLastError(ec.value());

0 commit comments

Comments
 (0)