Commit cde2e241 by Abseil Team Committed by Derek Mauro

Export of internal Abseil changes

--
2aa4544070113a4943f93464df74759f043bab92 by CJ Johnson <johnsoncj@google.com>:

Spelling fix in InlinedVector

PiperOrigin-RevId: 308241764

--
0d8a8ff71023df845c490c73811da598a42f12d9 by Todd Jackson <tjackson@google.com>:

Fix CMake warnings on absl/types/CMakeLists.txt.

PiperOrigin-RevId: 308123331

--
f35fbd79437ba999097b1499770103b7865078e5 by Samuel Benzaquen <sbenza@google.com>:

Speed up the integral printer.

PiperOrigin-RevId: 308081531

--
b1676b869ed0547e1cca23c83bb370f459bdf2cb by Samuel Benzaquen <sbenza@google.com>:

Collapse the template arguments to enums earlier to reduce the number of
instantiations of FormatSpecTemplate.
This doesn't affect opt builds much, but reduces the bloat in non-opt builds.

PiperOrigin-RevId: 308066155

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

Minor documentation fix for `absl::Status` CTOR.

PiperOrigin-RevId: 308037725

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

Internal change

PiperOrigin-RevId: 307914168
GitOrigin-RevId: 2aa4544070113a4943f93464df74759f043bab92
Change-Id: I553ce3838c5e35d04954f560dc75ec24033919af
parent 68494aae
......@@ -535,7 +535,7 @@ class InlinedVector {
//
// Resizes the inlined vector to contain `n` elements.
//
// NOTE: if `n` is smaller than `size()`, extra elements are destroyed. If `n`
// NOTE: If `n` is smaller than `size()`, extra elements are destroyed. If `n`
// is larger than `size()`, new elements are value-initialized.
void resize(size_type n) {
ABSL_HARDENING_ASSERT(n <= max_size());
......
......@@ -78,7 +78,7 @@ class ABSL_MUST_USE_RESULT Status final {
Status();
// Create a status in the canonical error space with the specified code and
// error message. If `code == util::error::OK`, `msg` is ignored and an
// error message. If `code == absl::StatusCode::kOk`, `msg` is ignored and an
// object identical to an OK status is constructed.
//
// `msg` must be in UTF-8. The implementation may complain (e.g.,
......
......@@ -60,7 +60,7 @@ class UntypedFormatSpecImpl {
size_t size_;
};
template <typename T, typename...>
template <typename T, FormatConversionCharSet...>
struct MakeDependent {
using type = T;
};
......@@ -68,7 +68,7 @@ struct MakeDependent {
// Implicitly convertible from `const char*`, `string_view`, and the
// `ExtendedParsedFormat` type. This abstraction allows all format functions to
// operate on any without providing too many overloads.
template <typename... Args>
template <FormatConversionCharSet... Args>
class FormatSpecTemplate
: public MakeDependent<UntypedFormatSpec, Args...>::type {
using Base = typename MakeDependent<UntypedFormatSpec, Args...>::type;
......@@ -105,13 +105,11 @@ class FormatSpecTemplate
// Good format overload.
FormatSpecTemplate(const char* s) // NOLINT
__attribute__((enable_if(ValidFormatImpl<ArgumentToConv<Args>()...>(s),
"bad format trap")))
__attribute__((enable_if(ValidFormatImpl<Args...>(s), "bad format trap")))
: Base(s) {}
FormatSpecTemplate(string_view s) // NOLINT
__attribute__((enable_if(ValidFormatImpl<ArgumentToConv<Args>()...>(s),
"bad format trap")))
__attribute__((enable_if(ValidFormatImpl<Args...>(s), "bad format trap")))
: Base(s) {}
#else // ABSL_INTERNAL_ENABLE_FORMAT_CHECKER
......@@ -121,19 +119,14 @@ class FormatSpecTemplate
#endif // ABSL_INTERNAL_ENABLE_FORMAT_CHECKER
template <Conv... C, typename = typename std::enable_if<
AllOf(sizeof...(C) == sizeof...(Args),
Contains(ArgumentToConv<Args>(),
template <Conv... C,
typename = typename std::enable_if<
AllOf(sizeof...(C) == sizeof...(Args), Contains(Args,
C)...)>::type>
FormatSpecTemplate(const ExtendedParsedFormat<C...>& pc) // NOLINT
: Base(&pc) {}
};
template <typename... Args>
struct FormatSpecDeductionBarrier {
using type = FormatSpecTemplate<Args...>;
};
class Streamable {
public:
Streamable(const UntypedFormatSpecImpl& format,
......
......@@ -170,21 +170,6 @@ inline FormatConversionChar FormatConversionCharFromChar(char c) {
return FormatConversionChar::kNone;
}
inline int FormatConversionCharRadix(FormatConversionChar c) {
switch (c) {
case FormatConversionChar::x:
case FormatConversionChar::X:
case FormatConversionChar::a:
case FormatConversionChar::A:
case FormatConversionChar::p:
return 16;
case FormatConversionChar::o:
return 8;
default:
return 10;
}
}
inline bool FormatConversionCharIsUpper(FormatConversionChar c) {
switch (c) {
case FormatConversionChar::X:
......@@ -198,30 +183,6 @@ inline bool FormatConversionCharIsUpper(FormatConversionChar c) {
}
}
inline bool FormatConversionCharIsSigned(FormatConversionChar c) {
switch (c) {
case FormatConversionChar::d:
case FormatConversionChar::i:
return true;
default:
return false;
}
}
inline bool FormatConversionCharIsIntegral(FormatConversionChar c) {
switch (c) {
case FormatConversionChar::d:
case FormatConversionChar::i:
case FormatConversionChar::u:
case FormatConversionChar::o:
case FormatConversionChar::x:
case FormatConversionChar::X:
return true;
default:
return false;
}
}
inline bool FormatConversionCharIsFloat(FormatConversionChar c) {
switch (c) {
case FormatConversionChar::a:
......
......@@ -254,8 +254,8 @@ class FormatCountCapture {
// argument, etc.
template <typename... Args>
using FormatSpec =
typename str_format_internal::FormatSpecDeductionBarrier<Args...>::type;
using FormatSpec = str_format_internal::FormatSpecTemplate<
str_format_internal::ArgumentToConv<Args>()...>;
// ParsedFormat
//
......
......@@ -246,10 +246,10 @@ absl_cc_library(
"internal/conformance_aliases.h"
"internal/conformance_archetype.h"
"internal/conformance_profile.h"
"internal/conformance_testing.h",
"internal/conformance_testing_helpers.h",
"internal/parentheses.h",
"internal/transform_args.h",
"internal/conformance_testing.h"
"internal/conformance_testing_helpers.h"
"internal/parentheses.h"
"internal/transform_args.h"
COPTS
${ABSL_DEFAULT_COPTS}
DEPS
......
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