Internal change

PiperOrigin-RevId: 484326539
pull/10846/head
Matt Kulukundis 2 years ago committed by Joshua Haberman
parent afaf93b85d
commit 4f3ecbda86
  1. 13
      src/google/protobuf/text_format.cc

@ -1770,13 +1770,7 @@ class StringBaseTextGenerator : public TextFormat::BaseTextGenerator {
output_.append(text, size); output_.append(text, size);
} }
// Some compilers do not support ref-qualifiers even in C++11 mode.
// Disable the optimization for now and revisit it later.
#if 0 // LANG_CXX11
std::string Consume() && { return std::move(output_); } std::string Consume() && { return std::move(output_); }
#else // !LANG_CXX11
const std::string& Get() { return output_; }
#endif // LANG_CXX11
private: private:
std::string output_; std::string output_;
@ -1790,17 +1784,10 @@ class StringBaseTextGenerator : public TextFormat::BaseTextGenerator {
TextFormat::FieldValuePrinter::FieldValuePrinter() {} TextFormat::FieldValuePrinter::FieldValuePrinter() {}
TextFormat::FieldValuePrinter::~FieldValuePrinter() {} TextFormat::FieldValuePrinter::~FieldValuePrinter() {}
#if 0 // LANG_CXX11
#define FORWARD_IMPL(fn, ...) \ #define FORWARD_IMPL(fn, ...) \
StringBaseTextGenerator generator; \ StringBaseTextGenerator generator; \
delegate_.fn(__VA_ARGS__, &generator); \ delegate_.fn(__VA_ARGS__, &generator); \
return std::move(generator).Consume() return std::move(generator).Consume()
#else // !LANG_CXX11
#define FORWARD_IMPL(fn, ...) \
StringBaseTextGenerator generator; \
delegate_.fn(__VA_ARGS__, &generator); \
return generator.Get()
#endif // LANG_CXX11
std::string TextFormat::FieldValuePrinter::PrintBool(bool val) const { std::string TextFormat::FieldValuePrinter::PrintBool(bool val) const {
FORWARD_IMPL(PrintBool, val); FORWARD_IMPL(PrintBool, val);

Loading…
Cancel
Save