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]
This commit is contained in:
Alexandre Ganea 2020-01-07 13:58:17 -05:00
parent c972f6fd79
commit 75eacbf1a9
3 changed files with 3 additions and 3 deletions

View File

@ -56,7 +56,7 @@ MATCHER_P(WithTemplateArgs, ArgName, "") {
LangOptions LO;
PrintingPolicy Policy(LO);
Policy.adjustForCPlusPlus();
for (const auto Arg : Args->asArray()) {
for (const auto &Arg : Args->asArray()) {
if (SpecializationArgs.size() > 0)
SpecializationArgs += ",";
SpecializationArgs += Arg.getAsType().getAsString(Policy);

View File

@ -404,7 +404,7 @@ TEST(RenameTest, WithinFileRename) {
template <> struct Bar<[[Foo]]> {};
)cpp",
};
for (const auto T : Tests) {
for (llvm::StringRef T : Tests) {
Annotations Code(T);
auto TU = TestTU::withCode(Code.code());
TU.ExtraArgs.push_back("-fno-delayed-template-parsing");

View File

@ -197,7 +197,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program,
// An environment block consists of a null-terminated block of
// null-terminated strings. Convert the array of environment variables to
// an environment block by concatenating them.
for (const auto E : *Env) {
for (StringRef E : *Env) {
SmallVector<wchar_t, MAX_PATH> EnvString;
if (std::error_code ec = windows::UTF8ToUTF16(E, EnvString)) {
SetLastError(ec.value());