|
|
|
@ -107,8 +107,26 @@ void UnmuteWuninitialized(io::Printer* p) { |
|
|
|
|
#endif // __llvm__
|
|
|
|
|
)"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
|
|
bool FileGenerator::ShouldSkipDependencyImports( |
|
|
|
|
const FileDescriptor* dep) const { |
|
|
|
|
// Do not import weak deps.
|
|
|
|
|
if (!options_.opensource_runtime && IsDepWeak(dep)) { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Skip feature imports, which are a visible (but non-functional) deviation
|
|
|
|
|
// between editions and legacy syntax.
|
|
|
|
|
if (options_.strip_nonfunctional_codegen && |
|
|
|
|
dep->name() == "third_party/protobuf/cpp_features.proto") { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
FileGenerator::FileGenerator(const FileDescriptor* file, const Options& options) |
|
|
|
|
: file_(file), options_(options), scc_analyzer_(options) { |
|
|
|
|
std::vector<const Descriptor*> msgs = FlattenMessagesInFile(file); |
|
|
|
@ -481,10 +499,7 @@ void FileGenerator::GenerateSourceIncludes(io::Printer* p) { |
|
|
|
|
for (int i = 0; i < file_->dependency_count(); ++i) { |
|
|
|
|
const FileDescriptor* dep = file_->dependency(i); |
|
|
|
|
|
|
|
|
|
if (!options_.opensource_runtime && |
|
|
|
|
IsDepWeak(dep)) { // Do not import weak deps.
|
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if (ShouldSkipDependencyImports(dep)) continue; |
|
|
|
|
|
|
|
|
|
std::string basename = StripProto(dep->name()); |
|
|
|
|
if (IsBootstrapProto(options_, file_)) { |
|
|
|
@ -698,10 +713,10 @@ void FileGenerator::GetCrossFileReferencesForFile(const FileDescriptor* file, |
|
|
|
|
for (int i = 0; i < file->dependency_count(); ++i) { |
|
|
|
|
const FileDescriptor* dep = file->dependency(i); |
|
|
|
|
|
|
|
|
|
if (IsDepWeak(dep)) { |
|
|
|
|
refs->weak_reflection_files.insert(dep); |
|
|
|
|
} else { |
|
|
|
|
if (!ShouldSkipDependencyImports(file->dependency(i))) { |
|
|
|
|
refs->strong_reflection_files.insert(dep); |
|
|
|
|
} else if (IsDepWeak(dep)) { |
|
|
|
|
refs->weak_reflection_files.insert(dep); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1456,8 +1471,7 @@ void FileGenerator::GenerateDependencyIncludes(io::Printer* p) { |
|
|
|
|
for (int i = 0; i < file_->dependency_count(); ++i) { |
|
|
|
|
const FileDescriptor* dep = file_->dependency(i); |
|
|
|
|
|
|
|
|
|
// Do not import weak deps.
|
|
|
|
|
if (IsDepWeak(dep)) { |
|
|
|
|
if (ShouldSkipDependencyImports(dep)) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|