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* |