protobuf/src/google/protobuf/compiler/importer.cc
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 // Author: kenton@google.com (Kenton Varda)
32 // Based on original Protocol Buffers design by
33 // Sanjay Ghemawat, Jeff Dean, and others.
34 
35 #ifdef _MSC_VER
36 #include <direct.h>
37 #else
38 #include <unistd.h>
39 #endif
40 #include <errno.h>
41 #include <fcntl.h>
42 #include <sys/stat.h>
43 #include <sys/types.h>
44 
45 #include <algorithm>
46 #include <memory>
47 
48 #include <google/protobuf/compiler/importer.h>
49 #include <google/protobuf/compiler/parser.h>
50 #include <google/protobuf/io/tokenizer.h>
51 #include <google/protobuf/io/zero_copy_stream_impl.h>
52 #include <google/protobuf/stubs/strutil.h>
53 #include <google/protobuf/io/io_win32.h>
54 
55 #ifdef _WIN32
56 #include <ctype.h>
57 #endif
58 
59 namespace google {
60 namespace protobuf {
61 namespace compiler {
62 
63 #ifdef _WIN32
64 // DO NOT include <io.h>, instead create functions in io_win32.{h,cc} and import
65 // them like we do below.
66 using google::protobuf::io::win32::access;
68 #endif
69 
70 // Returns true if the text looks like a Windows-style absolute path, starting
71 // with a drive letter. Example: "C:\foo". TODO(kenton): Share this with
72 // copy in command_line_interface.cc?
73 static bool IsWindowsAbsolutePath(const std::string& text) {
74 #if defined(_WIN32) || defined(__CYGWIN__)
75  return text.size() >= 3 && text[1] == ':' && isalpha(text[0]) &&
76  (text[2] == '/' || text[2] == '\\') && text.find_last_of(':') == 1;
77 #else
78  return false;
79 #endif
80 }
81 
83 
84 // This class serves two purposes:
85 // - It implements the ErrorCollector interface (used by Tokenizer and Parser)
86 // in terms of MultiFileErrorCollector, using a particular filename.
87 // - It lets us check if any errors have occurred.
88 class SourceTreeDescriptorDatabase::SingleFileErrorCollector
89  : public io::ErrorCollector {
90  public:
92  MultiFileErrorCollector* multi_file_error_collector)
94  multi_file_error_collector_(multi_file_error_collector),
95  had_errors_(false) {}
97 
98  bool had_errors() { return had_errors_; }
99 
100  // implements ErrorCollector ---------------------------------------
101  void AddError(int line, int column, const std::string& message) override {
102  if (multi_file_error_collector_ != NULL) {
104  }
105  had_errors_ = true;
106  }
107 
108  private:
111  bool had_errors_;
112 };
113 
114 // ===================================================================
115 
117  SourceTree* source_tree)
118  : source_tree_(source_tree),
119  fallback_database_(nullptr),
120  error_collector_(nullptr),
121  using_validation_error_collector_(false),
122  validation_error_collector_(this) {}
123 
125  SourceTree* source_tree, DescriptorDatabase* fallback_database)
126  : source_tree_(source_tree),
127  fallback_database_(fallback_database),
128  error_collector_(nullptr),
131 
133 
136  std::unique_ptr<io::ZeroCopyInputStream> input(source_tree_->Open(filename));
137  if (input == NULL) {
138  if (fallback_database_ != nullptr &&
140  return true;
141  }
142  if (error_collector_ != NULL) {
145  }
146  return false;
147  }
148 
149  // Set up the tokenizer and parser.
150  SingleFileErrorCollector file_error_collector(filename, error_collector_);
151  io::Tokenizer tokenizer(input.get(), &file_error_collector);
152 
153  Parser parser;
154  if (error_collector_ != NULL) {
155  parser.RecordErrorsTo(&file_error_collector);
156  }
158  parser.RecordSourceLocationsTo(&source_locations_);
159  }
160 
161  // Parse it.
162  output->set_name(filename);
163  return parser.Parse(&tokenizer, output) && !file_error_collector.had_errors();
164 }
165 
167  const std::string& symbol_name, FileDescriptorProto* output) {
168  return false;
169 }
170 
172  const std::string& containing_type, int field_number,
174  return false;
175 }
176 
177 // -------------------------------------------------------------------
178 
181  : owner_(owner) {}
182 
185 
188  const Message* descriptor, ErrorLocation location,
189  const std::string& message) {
190  if (owner_->error_collector_ == NULL) return;
191 
192  int line, column;
193  if (location == DescriptorPool::ErrorCollector::IMPORT) {
194  owner_->source_locations_.FindImport(descriptor, element_name, &line,
195  &column);
196  } else {
197  owner_->source_locations_.Find(descriptor, location, &line, &column);
198  }
199  owner_->error_collector_->AddError(filename, line, column, message);
200 }
201 
204  const Message* descriptor, ErrorLocation location,
205  const std::string& message) {
206  if (owner_->error_collector_ == NULL) return;
207 
208  int line, column;
209  if (location == DescriptorPool::ErrorCollector::IMPORT) {
210  owner_->source_locations_.FindImport(descriptor, element_name, &line,
211  &column);
212  } else {
213  owner_->source_locations_.Find(descriptor, location, &line, &column);
214  }
215  owner_->error_collector_->AddWarning(filename, line, column, message);
216 }
217 
218 // ===================================================================
219 
220 Importer::Importer(SourceTree* source_tree,
221  MultiFileErrorCollector* error_collector)
222  : database_(source_tree),
223  pool_(&database_, database_.GetValidationErrorCollector()) {
224  pool_.EnforceWeakDependencies(true);
225  database_.RecordErrorsTo(error_collector);
226 }
227 
229 
231  return pool_.FindFileByName(filename);
232 }
233 
235  bool is_error) {
236  pool_.AddUnusedImportTrackFile(file_name, is_error);
237 }
238 
240  pool_.ClearUnusedImportTrackFiles();
241 }
242 
243 
244 // ===================================================================
245 
247 
248 std::string SourceTree::GetLastErrorMessage() { return "File not found."; }
249 
251 
253 
254 static inline char LastChar(const std::string& str) {
255  return str[str.size() - 1];
256 }
257 
258 // Given a path, returns an equivalent path with these changes:
259 // - On Windows, any backslashes are replaced with forward slashes.
260 // - Any instances of the directory "." are removed.
261 // - Any consecutive '/'s are collapsed into a single slash.
262 // Note that the resulting string may be empty.
263 //
264 // TODO(kenton): It would be nice to handle "..", e.g. so that we can figure
265 // out that "foo/bar.proto" is inside "baz/../foo". However, if baz is a
266 // symlink or doesn't exist, then things get complicated, and we can't
267 // actually determine this without investigating the filesystem, probably
268 // in non-portable ways. So, we punt.
269 //
270 // TODO(kenton): It would be nice to use realpath() here except that it
271 // resolves symbolic links. This could cause problems if people place
272 // symbolic links in their source tree. For example, if you executed:
273 // protoc --proto_path=foo foo/bar/baz.proto
274 // then if foo/bar is a symbolic link, foo/bar/baz.proto will canonicalize
275 // to a path which does not appear to be under foo, and thus the compiler
276 // will complain that baz.proto is not inside the --proto_path.
278 #ifdef _WIN32
279  // The Win32 API accepts forward slashes as a path delimiter even though
280  // backslashes are standard. Let's avoid confusion and use only forward
281  // slashes.
282  if (HasPrefixString(path, "\\\\")) {
283  // Avoid converting two leading backslashes.
284  path = "\\\\" + StringReplace(path.substr(2), "\\", "/", true);
285  } else {
286  path = StringReplace(path, "\\", "/", true);
287  }
288 #endif
289 
290  std::vector<std::string> canonical_parts;
291  std::vector<std::string> parts = Split(
292  path, "/", true); // Note: Removes empty parts.
293  for (const std::string& part : parts) {
294  if (part == ".") {
295  // Ignore.
296  } else {
297  canonical_parts.push_back(part);
298  }
299  }
300  std::string result = Join(canonical_parts, "/");
301  if (!path.empty() && path[0] == '/') {
302  // Restore leading slash.
303  result = '/' + result;
304  }
305  if (!path.empty() && LastChar(path) == '/' && !result.empty() &&
306  LastChar(result) != '/') {
307  // Restore trailing slash.
308  result += '/';
309  }
310  return result;
311 }
312 
313 static inline bool ContainsParentReference(const std::string& path) {
314  return path == ".." || HasPrefixString(path, "../") ||
315  HasSuffixString(path, "/..") || path.find("/../") != std::string::npos;
316 }
317 
318 // Maps a file from an old location to a new one. Typically, old_prefix is
319 // a virtual path and new_prefix is its corresponding disk path. Returns
320 // false if the filename did not start with old_prefix, otherwise replaces
321 // old_prefix with new_prefix and stores the result in *result. Examples:
322 // string result;
323 // assert(ApplyMapping("foo/bar", "", "baz", &result));
324 // assert(result == "baz/foo/bar");
325 //
326 // assert(ApplyMapping("foo/bar", "foo", "baz", &result));
327 // assert(result == "baz/bar");
328 //
329 // assert(ApplyMapping("foo", "foo", "bar", &result));
330 // assert(result == "bar");
331 //
332 // assert(!ApplyMapping("foo/bar", "baz", "qux", &result));
333 // assert(!ApplyMapping("foo/bar", "baz", "qux", &result));
334 // assert(!ApplyMapping("foobar", "foo", "baz", &result));
335 static bool ApplyMapping(const std::string& filename,
336  const std::string& old_prefix,
337  const std::string& new_prefix, std::string* result) {
338  if (old_prefix.empty()) {
339  // old_prefix matches any relative path.
341  // We do not allow the file name to use "..".
342  return false;
343  }
345  // This is an absolute path, so it isn't matched by the empty string.
346  return false;
347  }
348  result->assign(new_prefix);
349  if (!result->empty()) result->push_back('/');
350  result->append(filename);
351  return true;
352  } else if (HasPrefixString(filename, old_prefix)) {
353  // old_prefix is a prefix of the filename. Is it the whole filename?
354  if (filename.size() == old_prefix.size()) {
355  // Yep, it's an exact match.
356  *result = new_prefix;
357  return true;
358  } else {
359  // Not an exact match. Is the next character a '/'? Otherwise,
360  // this isn't actually a match at all. E.g. the prefix "foo/bar"
361  // does not match the filename "foo/barbaz".
362  int after_prefix_start = -1;
363  if (filename[old_prefix.size()] == '/') {
364  after_prefix_start = old_prefix.size() + 1;
365  } else if (filename[old_prefix.size() - 1] == '/') {
366  // old_prefix is never empty, and canonicalized paths never have
367  // consecutive '/' characters.
368  after_prefix_start = old_prefix.size();
369  }
370  if (after_prefix_start != -1) {
371  // Yep. So the prefixes are directories and the filename is a file
372  // inside them.
373  std::string after_prefix = filename.substr(after_prefix_start);
374  if (ContainsParentReference(after_prefix)) {
375  // We do not allow the file name to use "..".
376  return false;
377  }
378  result->assign(new_prefix);
379  if (!result->empty()) result->push_back('/');
380  result->append(after_prefix);
381  return true;
382  }
383  }
384  }
385 
386  return false;
387 }
388 
389 void DiskSourceTree::MapPath(const std::string& virtual_path,
390  const std::string& disk_path) {
391  mappings_.push_back(Mapping(virtual_path, CanonicalizePath(disk_path)));
392 }
393 
396  std::string* virtual_file,
397  std::string* shadowing_disk_file) {
398  int mapping_index = -1;
399  std::string canonical_disk_file = CanonicalizePath(disk_file);
400 
401  for (int i = 0; i < mappings_.size(); i++) {
402  // Apply the mapping in reverse.
403  if (ApplyMapping(canonical_disk_file, mappings_[i].disk_path,
404  mappings_[i].virtual_path, virtual_file)) {
405  // Success.
406  mapping_index = i;
407  break;
408  }
409  }
410 
411  if (mapping_index == -1) {
412  return NO_MAPPING;
413  }
414 
415  // Iterate through all mappings with higher precedence and verify that none
416  // of them map this file to some other existing file.
417  for (int i = 0; i < mapping_index; i++) {
418  if (ApplyMapping(*virtual_file, mappings_[i].virtual_path,
419  mappings_[i].disk_path, shadowing_disk_file)) {
420  if (access(shadowing_disk_file->c_str(), F_OK) >= 0) {
421  // File exists.
422  return SHADOWED;
423  }
424  }
425  }
426  shadowing_disk_file->clear();
427 
428  // Verify that we can open the file. Note that this also has the side-effect
429  // of verifying that we are not canonicalizing away any non-existent
430  // directories.
431  std::unique_ptr<io::ZeroCopyInputStream> stream(OpenDiskFile(disk_file));
432  if (stream == NULL) {
433  return CANNOT_OPEN;
434  }
435 
436  return SUCCESS;
437 }
438 
439 bool DiskSourceTree::VirtualFileToDiskFile(const std::string& virtual_file,
440  std::string* disk_file) {
441  std::unique_ptr<io::ZeroCopyInputStream> stream(
442  OpenVirtualFile(virtual_file, disk_file));
443  return stream != NULL;
444 }
445 
447  return OpenVirtualFile(filename, NULL);
448 }
449 
451  return last_error_message_;
452 }
453 
455  const std::string& virtual_file, std::string* disk_file) {
456  if (virtual_file != CanonicalizePath(virtual_file) ||
457  ContainsParentReference(virtual_file)) {
458  // We do not allow importing of paths containing things like ".." or
459  // consecutive slashes since the compiler expects files to be uniquely
460  // identified by file name.
461  last_error_message_ =
462  "Backslashes, consecutive slashes, \".\", or \"..\" "
463  "are not allowed in the virtual path";
464  return NULL;
465  }
466 
467  for (const auto& mapping : mappings_) {
468  std::string temp_disk_file;
469  if (ApplyMapping(virtual_file, mapping.virtual_path, mapping.disk_path,
470  &temp_disk_file)) {
471  io::ZeroCopyInputStream* stream = OpenDiskFile(temp_disk_file);
472  if (stream != NULL) {
473  if (disk_file != NULL) {
474  *disk_file = temp_disk_file;
475  }
476  return stream;
477  }
478 
479  if (errno == EACCES) {
480  // The file exists but is not readable.
481  last_error_message_ =
482  "Read access is denied for file: " + temp_disk_file;
483  return NULL;
484  }
485  }
486  }
487  last_error_message_ = "File not found.";
488  return NULL;
489 }
490 
492  const std::string& filename) {
493  struct stat sb;
494  int ret = 0;
495  do {
496  ret = stat(filename.c_str(), &sb);
497  } while (ret != 0 && errno == EINTR);
498 #if defined(_WIN32)
499  if (ret == 0 && sb.st_mode & S_IFDIR) {
500  last_error_message_ = "Input file is a directory.";
501  return NULL;
502  }
503 #else
504  if (ret == 0 && S_ISDIR(sb.st_mode)) {
505  last_error_message_ = "Input file is a directory.";
506  return NULL;
507  }
508 #endif
509  int file_descriptor;
510  do {
511  file_descriptor = open(filename.c_str(), O_RDONLY);
512  } while (file_descriptor < 0 && errno == EINTR);
513  if (file_descriptor >= 0) {
514  io::FileInputStream* result = new io::FileInputStream(file_descriptor);
515  result->SetCloseOnDelete(true);
516  return result;
517  } else {
518  return NULL;
519  }
520 }
521 
522 } // namespace compiler
523 } // namespace protobuf
524 } // namespace google
xds_interop_client.str
str
Definition: xds_interop_client.py:487
google::protobuf::compiler::Importer::~Importer
~Importer()
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:228
google::protobuf::compiler::SourceTreeDescriptorDatabase::source_locations_
SourceLocationTable source_locations_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.h:145
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
filename
const char * filename
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:135
google::protobuf::compiler::SourceTreeDescriptorDatabase::fallback_database_
DescriptorDatabase * fallback_database_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.h:120
google::protobuf::compiler::ContainsParentReference
static bool ContainsParentReference(const std::string &path)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:312
element_name
std::string element_name
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.cc:3096
source_tree_
MockSourceTree source_tree_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer_unittest.cc:130
google::protobuf::compiler::IsWindowsAbsolutePath
static bool IsWindowsAbsolutePath(const std::string &text)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:73
grpc::protobuf::io::ZeroCopyInputStream
GRPC_CUSTOM_ZEROCOPYINPUTSTREAM ZeroCopyInputStream
Definition: include/grpcpp/impl/codegen/config_protobuf.h:101
false
#define false
Definition: setup_once.h:323
google::protobuf::DescriptorPool::ErrorCollector::IMPORT
@ IMPORT
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.h:1648
google::protobuf::compiler::SourceTree::Open
virtual io::ZeroCopyInputStream * Open(const std::string &filename)=0
google::protobuf::compiler::DiskSourceTree::~DiskSourceTree
~DiskSourceTree()
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:251
google::protobuf::compiler::DiskSourceTree::DiskSourceTree
DiskSourceTree()
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:249
google::protobuf::compiler::SourceTreeDescriptorDatabase::source_tree_
SourceTree * source_tree_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.h:117
google::protobuf::compiler::CanonicalizePath
static std::string CanonicalizePath(std::string path)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:276
FileDescriptor
Definition: bloaty/third_party/protobuf/ruby/ext/google/protobuf_c/protobuf.h:128
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
google::protobuf::compiler::SourceTreeDescriptorDatabase::SingleFileErrorCollector::filename_
std::string filename_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:109
google::protobuf::compiler::DiskSourceTree::GetLastErrorMessage
std::string GetLastErrorMessage() override
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:449
google::protobuf::compiler::SourceTreeDescriptorDatabase::SingleFileErrorCollector::had_errors
bool had_errors()
Definition: protobuf/src/google/protobuf/compiler/importer.cc:98
google::protobuf
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:12
pool_
DescriptorPool pool_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/parser_unittest.cc:181
google::protobuf::compiler::SourceTreeDescriptorDatabase::FindFileByName
bool FindFileByName(const std::string &filename, FileDescriptorProto *output) override
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:134
check_documentation.path
path
Definition: check_documentation.py:57
google::protobuf::compiler::SourceTreeDescriptorDatabase::SingleFileErrorCollector::~SingleFileErrorCollector
~SingleFileErrorCollector()
Definition: protobuf/src/google/protobuf/compiler/importer.cc:96
message
char * message
Definition: libuv/docs/code/tty-gravity/main.c:12
google::protobuf::compiler::SourceTree::GetLastErrorMessage
virtual std::string GetLastErrorMessage()
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:247
google::protobuf::compiler::SourceTreeDescriptorDatabase::SourceTreeDescriptorDatabase
SourceTreeDescriptorDatabase(SourceTree *source_tree)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:116
google::protobuf::compiler::DiskSourceTree::OpenVirtualFile
io::ZeroCopyInputStream * OpenVirtualFile(const std::string &virtual_file, std::string *disk_file)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:453
google::protobuf::compiler::DiskSourceTree::DiskFileToVirtualFileResult
DiskFileToVirtualFileResult
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.h:264
asyncio_get_stats.parser
parser
Definition: asyncio_get_stats.py:34
gen_server_registered_method_bad_client_test_body.text
def text
Definition: gen_server_registered_method_bad_client_test_body.py:50
google::protobuf::compiler::SourceTreeDescriptorDatabase::ValidationErrorCollector::ValidationErrorCollector
ValidationErrorCollector(SourceTreeDescriptorDatabase *owner)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:180
google::protobuf::compiler::SourceTreeDescriptorDatabase::ValidationErrorCollector::AddWarning
void AddWarning(const std::string &filename, const std::string &element_name, const Message *descriptor, ErrorLocation location, const std::string &message) override
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:202
google::protobuf::compiler::Importer::Importer
Importer(SourceTree *source_tree, MultiFileErrorCollector *error_collector)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:220
gmock_output_test.output
output
Definition: bloaty/third_party/googletest/googlemock/test/gmock_output_test.py:175
google::protobuf::compiler::SourceTreeDescriptorDatabase::validation_error_collector_
ValidationErrorCollector validation_error_collector_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.h:146
google::protobuf::compiler::SourceTreeDescriptorDatabase::SingleFileErrorCollector::AddError
void AddError(int line, int column, const std::string &message) override
Definition: protobuf/src/google/protobuf/compiler/importer.cc:101
google::protobuf::compiler::DiskSourceTree::DiskFileToVirtualFile
DiskFileToVirtualFileResult DiskFileToVirtualFile(const std::string &disk_file, std::string *virtual_file, std::string *shadowing_disk_file)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:394
google::protobuf::compiler::SourceTreeDescriptorDatabase::~SourceTreeDescriptorDatabase
~SourceTreeDescriptorDatabase()
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:132
google::protobuf::compiler::SourceTreeDescriptorDatabase::GetValidationErrorCollector
DescriptorPool::ErrorCollector * GetValidationErrorCollector()
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.h:102
google::protobuf::compiler::DiskSourceTree::MapPath
void MapPath(const std::string &virtual_path, const std::string &disk_path)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:388
google::protobuf::compiler::SourceTreeDescriptorDatabase::FindFileContainingSymbol
bool FindFileContainingSymbol(const std::string &symbol_name, FileDescriptorProto *output) override
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:166
phone_pb2.containing_type
containing_type
Definition: phone_pb2.py:199
grpc::protobuf::compiler::MultiFileErrorCollector
GRPC_CUSTOM_MULTIFILEERRORCOLLECTOR MultiFileErrorCollector
Definition: config_grpc_cli.h:64
FileDescriptorProto
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor.pb.h:501
google::protobuf::compiler::MultiFileErrorCollector::AddError
virtual void AddError(const std::string &filename, int line, int column, const std::string &message)=0
google::protobuf::HasPrefixString
bool HasPrefixString(const string &str, const string &prefix)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:115
google::protobuf::DescriptorDatabase
Definition: bloaty/third_party/protobuf/src/google/protobuf/descriptor_database.h:71
grpc::testing::SUCCESS
@ SUCCESS
Definition: h2_ssl_cert_test.cc:201
google::protobuf::compiler::Importer::Import
const FileDescriptor * Import(const std::string &filename)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:230
google::protobuf::compiler::SourceTreeDescriptorDatabase::ValidationErrorCollector::AddError
void AddError(const std::string &filename, const std::string &element_name, const Message *descriptor, ErrorLocation location, const std::string &message) override
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:186
google::protobuf::StringReplace
void StringReplace(const string &s, const string &oldsub, const string &newsub, bool replace_all, string *res)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.cc:148
google::protobuf::compiler::SourceTreeDescriptorDatabase::using_validation_error_collector_
bool using_validation_error_collector_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.h:144
google::protobuf::compiler::SourceTree::~SourceTree
virtual ~SourceTree()
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:245
ret
UniquePtr< SSL_SESSION > ret
Definition: ssl_x509.cc:1029
F_OK
#define F_OK
Definition: win.h:655
regen-readme.line
line
Definition: regen-readme.py:30
google::protobuf::Split
std::vector< string > Split(const string &full, const char *delim, bool skip_empty=true)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:235
google::protobuf::compiler::LastChar
static char LastChar(const std::string &str)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:253
google::protobuf::compiler::SourceTreeDescriptorDatabase::ValidationErrorCollector::~ValidationErrorCollector
~ValidationErrorCollector()
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:184
google::protobuf::compiler::SourceTreeDescriptorDatabase::SingleFileErrorCollector::multi_file_error_collector_
MultiFileErrorCollector * multi_file_error_collector_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:110
google::protobuf::compiler::ApplyMapping
static bool ApplyMapping(const std::string &filename, const std::string &old_prefix, const std::string &new_prefix, std::string *result)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:334
google::protobuf::compiler::DiskSourceTree::OpenDiskFile
io::ZeroCopyInputStream * OpenDiskFile(const std::string &filename)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:490
input
std::string input
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer_unittest.cc:197
google::protobuf::compiler::MultiFileErrorCollector
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.h:194
open
#define open
Definition: test-fs.c:46
stat
#define stat
Definition: test-fs.c:50
google::protobuf::compiler::Importer::AddUnusedImportTrackFile
void AddUnusedImportTrackFile(const std::string &file_name)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:234
google::protobuf::compiler::SourceTreeDescriptorDatabase::SingleFileErrorCollector::had_errors_
bool had_errors_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:111
google::protobuf::HasSuffixString
bool HasSuffixString(const string &str, const string &suffix)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:137
google::protobuf::DescriptorDatabase::FindFileByName
virtual bool FindFileByName(const std::string &filename, FileDescriptorProto *output)=0
google::protobuf::compiler::MultiFileErrorCollector::~MultiFileErrorCollector
virtual ~MultiFileErrorCollector()
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:82
google::protobuf::Join
void Join(Iterator start, Iterator end, const char *delim, string *result)
Definition: bloaty/third_party/protobuf/src/google/protobuf/stubs/strutil.h:769
google::protobuf::compiler::SourceTree
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.h:215
google::protobuf::compiler::DiskSourceTree::Open
io::ZeroCopyInputStream * Open(const std::string &filename) override
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:445
google::protobuf::compiler::Importer::ClearUnusedImportTrackFiles
void ClearUnusedImportTrackFiles()
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:238
google::protobuf::compiler::SourceTreeDescriptorDatabase::SingleFileErrorCollector::SingleFileErrorCollector
SingleFileErrorCollector(const std::string &filename, MultiFileErrorCollector *multi_file_error_collector)
Definition: protobuf/src/google/protobuf/compiler/importer.cc:91
google::protobuf::compiler::SourceTreeDescriptorDatabase::error_collector_
MultiFileErrorCollector * error_collector_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.h:121
access
Definition: bloaty/third_party/zlib/examples/zran.c:75
descriptor
static const char descriptor[1336]
Definition: certs.upbdefs.c:16
error_collector_
MockErrorCollector error_collector_
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer_unittest.cc:129
compiler
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/plugin.pb.cc:21
google
Definition: bloaty/third_party/protobuf/benchmarks/util/data_proto2_to_proto3_util.h:11
google::protobuf::compiler::DiskSourceTree::VirtualFileToDiskFile
bool VirtualFileToDiskFile(const std::string &virtual_file, std::string *disk_file)
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:438
errno.h
Message
Definition: protobuf/php/ext/google/protobuf/message.c:53
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
google::protobuf::compiler::SourceTreeDescriptorDatabase::FindFileContainingExtension
bool FindFileContainingExtension(const std::string &containing_type, int field_number, FileDescriptorProto *output) override
Definition: bloaty/third_party/protobuf/src/google/protobuf/compiler/importer.cc:171
stream
voidpf stream
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136


grpc
Author(s):
autogenerated on Fri May 16 2025 02:59:02