Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Unified Diff: third_party/protobuf/src/google/protobuf/compiler/code_generator.cc

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Update to new HEAD (b7632464b4) + restore GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/src/google/protobuf/compiler/code_generator.cc
diff --git a/third_party/protobuf/src/google/protobuf/compiler/code_generator.cc b/third_party/protobuf/src/google/protobuf/compiler/code_generator.cc
index 473eb4e6fba5b9b85f33e1887ffae7bd5959be9f..f6ff1e5d91432843d2baf10563cd567c2e03d86c 100644
--- a/third_party/protobuf/src/google/protobuf/compiler/code_generator.cc
+++ b/third_party/protobuf/src/google/protobuf/compiler/code_generator.cc
@@ -36,6 +36,7 @@
#include <google/protobuf/stubs/logging.h>
#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/descriptor.h>
#include <google/protobuf/stubs/strutil.h>
namespace google {
@@ -43,6 +44,33 @@ namespace protobuf {
namespace compiler {
CodeGenerator::~CodeGenerator() {}
+
+bool CodeGenerator::GenerateAll(
+ const vector<const FileDescriptor*>& files,
+ const string& parameter,
+ GeneratorContext* generator_context,
+ string* error) const {
+ // Default implemenation is just to call the per file method, and prefix any
+ // error string with the file to provide context.
+ bool succeeded = true;
+ for (int i = 0; i < files.size(); i++) {
+ const FileDescriptor* file = files[i];
+ succeeded = Generate(file, parameter, generator_context, error);
+ if (!succeeded && error && error->empty()) {
+ *error = "Code generator returned false but provided no error "
+ "description.";
+ }
+ if (error && !error->empty()) {
+ *error = file->name() + ": " + *error;
+ break;
+ }
+ if (!succeeded) {
+ break;
+ }
+ }
+ return succeeded;
+}
+
GeneratorContext::~GeneratorContext() {}
io::ZeroCopyOutputStream*

Powered by Google App Engine
This is Rietveld 408576698