From 55696adb8b74425ebfb20d4d88df808ae316819c Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 16 Apr 2024 14:44:23 +0000 Subject: [PATCH] Auto-generate files after cl/625324587 --- php/ext/google/protobuf/php-upb.c | 11 +++++++++++ php/ext/google/protobuf/php-upb.h | 3 +++ ruby/ext/google/protobuf_c/ruby-upb.c | 11 +++++++++++ ruby/ext/google/protobuf_c/ruby-upb.h | 3 +++ 4 files changed, 28 insertions(+) diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c index e9fb62300d..89625d7645 100644 --- a/php/ext/google/protobuf/php-upb.c +++ b/php/ext/google/protobuf/php-upb.c @@ -14651,6 +14651,17 @@ const upb_MiniTableExtension* _upb_FileDef_ExtensionMiniTable( return f->ext_layouts[i]; } +// Note: Import cycles are not allowed so this will terminate. +bool upb_FileDef_Resolves(const upb_FileDef* f, const char* path) { + if (!strcmp(f->name, path)) return true; + + for (int i = 0; i < upb_FileDef_PublicDependencyCount(f); i++) { + const upb_FileDef* dep = upb_FileDef_PublicDependency(f, i); + if (upb_FileDef_Resolves(dep, path)) return true; + } + return false; +} + static char* strviewdup(upb_DefBuilder* ctx, upb_StringView view) { char* ret = upb_strdup2(view.data, view.size, _upb_DefBuilder_Arena(ctx)); if (!ret) _upb_DefBuilder_OomErr(ctx); diff --git a/php/ext/google/protobuf/php-upb.h b/php/ext/google/protobuf/php-upb.h index ec2ce7c6c0..2db5ba890a 100644 --- a/php/ext/google/protobuf/php-upb.h +++ b/php/ext/google/protobuf/php-upb.h @@ -11566,6 +11566,9 @@ int upb_FileDef_TopLevelMessageCount(const upb_FileDef* f); const upb_FileDef* upb_FileDef_WeakDependency(const upb_FileDef* f, int i); int upb_FileDef_WeakDependencyCount(const upb_FileDef* f); +// Returns whether |symbol| is transitively included by |f| +bool upb_FileDef_Resolves(const upb_FileDef* f, const char* symbol); + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c index 626d988fdb..b0e40d8b78 100644 --- a/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/ruby/ext/google/protobuf_c/ruby-upb.c @@ -14142,6 +14142,17 @@ const upb_MiniTableExtension* _upb_FileDef_ExtensionMiniTable( return f->ext_layouts[i]; } +// Note: Import cycles are not allowed so this will terminate. +bool upb_FileDef_Resolves(const upb_FileDef* f, const char* path) { + if (!strcmp(f->name, path)) return true; + + for (int i = 0; i < upb_FileDef_PublicDependencyCount(f); i++) { + const upb_FileDef* dep = upb_FileDef_PublicDependency(f, i); + if (upb_FileDef_Resolves(dep, path)) return true; + } + return false; +} + static char* strviewdup(upb_DefBuilder* ctx, upb_StringView view) { char* ret = upb_strdup2(view.data, view.size, _upb_DefBuilder_Arena(ctx)); if (!ret) _upb_DefBuilder_OomErr(ctx); diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h index b97fee37c9..71130fac5d 100755 --- a/ruby/ext/google/protobuf_c/ruby-upb.h +++ b/ruby/ext/google/protobuf_c/ruby-upb.h @@ -11968,6 +11968,9 @@ int upb_FileDef_TopLevelMessageCount(const upb_FileDef* f); const upb_FileDef* upb_FileDef_WeakDependency(const upb_FileDef* f, int i); int upb_FileDef_WeakDependencyCount(const upb_FileDef* f); +// Returns whether |symbol| is transitively included by |f| +bool upb_FileDef_Resolves(const upb_FileDef* f, const char* symbol); + #ifdef __cplusplus } /* extern "C" */ #endif