aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.ru>2022-02-10 16:45:08 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:08 +0300
commit4e839db24a3bbc9f1c610c43d6faaaa99824dcca (patch)
tree506dac10f5df94fab310584ee51b24fc5a081c22 /contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc
parent2d37894b1b037cf24231090eda8589bbb44fb6fc (diff)
downloadydb-4e839db24a3bbc9f1c610c43d6faaaa99824dcca.tar.gz
Restoring authorship annotation for <thegeorg@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc')
-rw-r--r--contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc88
1 files changed, 44 insertions, 44 deletions
diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc
index d05aef210a..516117a6d2 100644
--- a/contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc
+++ b/contrib/libs/protoc/src/google/protobuf/compiler/plugin.cc
@@ -30,7 +30,7 @@
// Author: kenton@google.com (Kenton Varda)
-#include <google/protobuf/compiler/plugin.h>
+#include <google/protobuf/compiler/plugin.h>
#include <iostream>
#include <set>
@@ -41,29 +41,29 @@
#include <unistd.h>
#endif
-#include <google/protobuf/stubs/logging.h>
-#include <google/protobuf/stubs/common.h>
-#include <google/protobuf/compiler/plugin.pb.h>
-#include <google/protobuf/compiler/code_generator.h>
-#include <google/protobuf/io/zero_copy_stream_impl.h>
-#include <google/protobuf/descriptor.h>
-#include <google/protobuf/io/io_win32.h>
+#include <google/protobuf/stubs/logging.h>
+#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/compiler/plugin.pb.h>
+#include <google/protobuf/compiler/code_generator.h>
+#include <google/protobuf/io/zero_copy_stream_impl.h>
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/io/io_win32.h>
namespace google {
namespace protobuf {
namespace compiler {
-#if defined(_WIN32)
-// DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import
-// them like we do below.
-using google::protobuf::io::win32::setmode;
-#endif
-
+#if defined(_WIN32)
+// DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import
+// them like we do below.
+using google::protobuf::io::win32::setmode;
+#endif
+
class GeneratorResponseContext : public GeneratorContext {
public:
GeneratorResponseContext(
- const Version& compiler_version, CodeGeneratorResponse* response,
+ const Version& compiler_version, CodeGeneratorResponse* response,
const std::vector<const FileDescriptor*>& parsed_files)
: compiler_version_(compiler_version),
response_(response),
@@ -72,30 +72,30 @@ class GeneratorResponseContext : public GeneratorContext {
// implements GeneratorContext --------------------------------------
- virtual io::ZeroCopyOutputStream* Open(const TProtoStringType& filename) {
+ virtual io::ZeroCopyOutputStream* Open(const TProtoStringType& filename) {
CodeGeneratorResponse::File* file = response_->add_file();
file->set_name(filename);
return new io::StringOutputStream(file->mutable_content());
}
virtual io::ZeroCopyOutputStream* OpenForInsert(
- const TProtoStringType& filename, const TProtoStringType& insertion_point) {
+ const TProtoStringType& filename, const TProtoStringType& insertion_point) {
CodeGeneratorResponse::File* file = response_->add_file();
file->set_name(filename);
file->set_insertion_point(insertion_point);
return new io::StringOutputStream(file->mutable_content());
}
- virtual io::ZeroCopyOutputStream* OpenForInsertWithGeneratedCodeInfo(
- const TProtoStringType& filename, const TProtoStringType& insertion_point,
- const google::protobuf::GeneratedCodeInfo& info) {
- CodeGeneratorResponse::File* file = response_->add_file();
- file->set_name(filename);
- file->set_insertion_point(insertion_point);
- *file->mutable_generated_code_info() = info;
- return new io::StringOutputStream(file->mutable_content());
- }
-
+ virtual io::ZeroCopyOutputStream* OpenForInsertWithGeneratedCodeInfo(
+ const TProtoStringType& filename, const TProtoStringType& insertion_point,
+ const google::protobuf::GeneratedCodeInfo& info) {
+ CodeGeneratorResponse::File* file = response_->add_file();
+ file->set_name(filename);
+ file->set_insertion_point(insertion_point);
+ *file->mutable_generated_code_info() = info;
+ return new io::StringOutputStream(file->mutable_content());
+ }
+
void ListParsedFiles(std::vector<const FileDescriptor*>* output) {
*output = parsed_files_;
}
@@ -111,8 +111,8 @@ class GeneratorResponseContext : public GeneratorContext {
};
bool GenerateCode(const CodeGeneratorRequest& request,
- const CodeGenerator& generator,
- CodeGeneratorResponse* response, TProtoStringType* error_msg) {
+ const CodeGenerator& generator,
+ CodeGeneratorResponse* response, TProtoStringType* error_msg) {
DescriptorPool pool;
for (int i = 0; i < request.proto_file_size(); i++) {
const FileDescriptor* file = pool.BuildFile(request.proto_file(i));
@@ -126,28 +126,28 @@ bool GenerateCode(const CodeGeneratorRequest& request,
for (int i = 0; i < request.file_to_generate_size(); i++) {
parsed_files.push_back(pool.FindFileByName(request.file_to_generate(i)));
if (parsed_files.back() == NULL) {
- *error_msg =
- "protoc asked plugin to generate a file but "
- "did not provide a descriptor for the file: " +
- request.file_to_generate(i);
+ *error_msg =
+ "protoc asked plugin to generate a file but "
+ "did not provide a descriptor for the file: " +
+ request.file_to_generate(i);
return false;
}
}
- GeneratorResponseContext context(request.compiler_version(), response,
- parsed_files);
-
+ GeneratorResponseContext context(request.compiler_version(), response,
+ parsed_files);
- TProtoStringType error;
- bool succeeded = generator.GenerateAll(parsed_files, request.parameter(),
- &context, &error);
- response->set_supported_features(generator.GetSupportedFeatures());
+ TProtoStringType error;
+ bool succeeded = generator.GenerateAll(parsed_files, request.parameter(),
+ &context, &error);
+ response->set_supported_features(generator.GetSupportedFeatures());
+
if (!succeeded && error.empty()) {
- error =
- "Code generator returned false but provided no error "
- "description.";
+ error =
+ "Code generator returned false but provided no error "
+ "description.";
}
if (!error.empty()) {
response->set_error(error);
@@ -175,7 +175,7 @@ int PluginMain(int argc, char* argv[], const CodeGenerator* generator) {
return 1;
}
- TProtoStringType error_msg;
+ TProtoStringType error_msg;
CodeGeneratorResponse response;
if (GenerateCode(request, *generator, &response, &error_msg)) {