[libcxx] r285011 - Fix shadow warnings in string_view tests. Patch from STL at microsoft.com
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 24 13:10:00 PDT 2016
Author: ericwf
Date: Mon Oct 24 15:10:00 2016
New Revision: 285011
URL: http://llvm.org/viewvc/llvm-project?rev=285011&view=rev
Log:
Fix shadow warnings in string_view tests. Patch from STL at microsoft.com
Modified:
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp
libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp
Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp?rev=285011&r1=285010&r2=285011&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_append/T_size_size.pass.cpp Mon Oct 24 15:10:00 2016
@@ -120,11 +120,10 @@ int main()
test_npos(S(), SV("12345"), 5, S(""));
test_npos(S(), SV("12345"), 6, S("not happening"));
}
+
{
- typedef std::string S;
- typedef std::string_view SV;
- S s;
- SV sv = "EFGH";
+ std::string s;
+ std::string_view sv = "EFGH";
char arr[] = "IJKL";
s.append("CDEF", 0); // calls append(const char *, len)
@@ -138,7 +137,7 @@ int main()
s.append(sv, 0); // calls append(T, pos, npos)
assert(s == sv);
s.clear();
-
+
s.append(sv, 0, std::string::npos); // calls append(T, pos, npos)
assert(s == sv);
s.clear();
@@ -154,10 +153,11 @@ int main()
s.append(arr, 0); // calls append(const char *, len)
assert(s == "");
s.clear();
+ }
{
- S s = "ABCD";
- SV sv = s;
+ std::string s = "ABCD";
+ std::string_view sv = s;
s.append(sv);
assert(s == "ABCDABCD");
@@ -169,10 +169,10 @@ int main()
s.append(sv, sv.size());
assert(s == "ABCDABCDABCDABCD");
}
-
+
{
- S s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- SV sv = s;
+ std::string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ std::string_view sv = s;
s.append(sv);
assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ");
@@ -180,5 +180,4 @@ int main()
s.append(sv, 0, std::string::npos);
assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
- }
}
Modified: libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp?rev=285011&r1=285010&r2=285011&view=diff
==============================================================================
--- libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp (original)
+++ libcxx/trunk/test/std/strings/basic.string/string.modifiers/string_assign/T_size_size.pass.cpp Mon Oct 24 15:10:00 2016
@@ -119,11 +119,10 @@ int main()
test_npos(S(), SV("12345"), 5, S(""));
test_npos(S(), SV("12345"), 6, S("not happening"));
}
+
{
- typedef std::string S;
- typedef std::string_view SV;
- S s = "ABCD";
- SV sv = "EFGH";
+ std::string s = "ABCD";
+ std::string_view sv = "EFGH";
char arr[] = "IJKL";
s.assign("CDEF", 0); // calls assign(const char *, len)
@@ -137,7 +136,7 @@ int main()
s.assign(sv, 0); // calls assign(T, pos, npos)
assert(s == sv);
s.clear();
-
+
s.assign(sv, 0, std::string::npos); // calls assign(T, pos, npos)
assert(s == sv);
s.clear();
@@ -153,10 +152,11 @@ int main()
s.assign(arr, 0); // calls assign(const char *, len)
assert(s == "");
s.clear();
+ }
{
- S s = "ABCD";
- SV sv = s;
+ std::string s = "ABCD";
+ std::string_view sv = s;
s.assign(sv);
assert(s == "ABCD");
@@ -164,10 +164,10 @@ int main()
s.assign(sv, 0, std::string::npos);
assert(s == "ABCD");
}
-
+
{
- S s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- SV sv = s;
+ std::string s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ std::string_view sv = s;
s.assign(sv);
assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
@@ -175,5 +175,4 @@ int main()
s.assign(sv, 0, std::string::npos);
assert(s == "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
- }
}
More information about the cfe-commits
mailing list