Commit cad3f30b by Abseil Team Committed by vslashg

Export of internal Abseil changes

--
1d4582ea8b9f38bef580d1998ebeb56adca7d3fb by Abseil Team <absl-team@google.com>:

Used StorageT alias to unify getters of CompressedTuple

PiperOrigin-RevId: 333572002

--
a630f1ef375a621dd89e6908cc6980ba81448331 by Derek Mauro <dmauro@google.com>:

Silence -Wrange-loop-analysis warnings

These warnings are likely incorrect for small POD objects, and clang
fixed this with https://reviews.llvm.org/D72212, but Xcode 12 enabled
this buggy warning by default. This fixes this problem for these users.

As a reminder, [we still recommend passing string_view by value for
function parameters](https://abseil.io/tips/1) as it generates less
code.

Fixes #787

PiperOrigin-RevId: 333536667
GitOrigin-RevId: 1d4582ea8b9f38bef580d1998ebeb56adca7d3fb
Change-Id: Ib17aa296f48f3f0fda566460a302979f5adf4195
parent 9927a098
...@@ -257,7 +257,7 @@ class ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTuple ...@@ -257,7 +257,7 @@ class ABSL_INTERNAL_COMPRESSED_TUPLE_DECLSPEC CompressedTuple
template <int I> template <int I>
ElemT<I>& get() & { ElemT<I>& get() & {
return internal_compressed_tuple::Storage<ElemT<I>, I>::get(); return StorageT<I>::get();
} }
template <int I> template <int I>
......
...@@ -336,7 +336,7 @@ class Splitter { ...@@ -336,7 +336,7 @@ class Splitter {
Container operator()(const Splitter& splitter) const { Container operator()(const Splitter& splitter) const {
Container c; Container c;
auto it = std::inserter(c, c.end()); auto it = std::inserter(c, c.end());
for (const auto sp : splitter) { for (const auto& sp : splitter) {
*it++ = ValueType(sp); *it++ = ValueType(sp);
} }
return c; return c;
...@@ -401,7 +401,7 @@ class Splitter { ...@@ -401,7 +401,7 @@ class Splitter {
Container m; Container m;
typename Container::iterator it; typename Container::iterator it;
bool insert = true; bool insert = true;
for (const auto sp : splitter) { for (const auto& sp : splitter) {
if (insert) { if (insert) {
it = Inserter<Container>::Insert(&m, First(sp), Second()); it = Inserter<Container>::Insert(&m, First(sp), Second());
} else { } else {
......
...@@ -367,7 +367,7 @@ TEST(SplitIterator, EqualityAsEndCondition) { ...@@ -367,7 +367,7 @@ TEST(SplitIterator, EqualityAsEndCondition) {
TEST(Splitter, RangeIterators) { TEST(Splitter, RangeIterators) {
auto splitter = absl::StrSplit("a,b,c", ','); auto splitter = absl::StrSplit("a,b,c", ',');
std::vector<absl::string_view> output; std::vector<absl::string_view> output;
for (const absl::string_view p : splitter) { for (const absl::string_view& p : splitter) {
output.push_back(p); output.push_back(p);
} }
EXPECT_THAT(output, ElementsAre("a", "b", "c")); EXPECT_THAT(output, ElementsAre("a", "b", "c"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment