================
@@ -43,6 +44,40 @@ struct tzdb {
   vector<time_zone_link> links;
 
   vector<leap_second> leap_seconds;
+
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI const time_zone* 
__locate_zone(string_view __name) const {
+    if (const time_zone* __result = __find_in_zone(__name); __result)
+      return __result;
+
+    if (auto __it = ranges::lower_bound(links, __name, {}, 
&time_zone_link::name);
+        __it != links.end() && __it->name() == __name)
+      if (const time_zone* __result = __find_in_zone(__it->target()); __result)
----------------
ldionne wrote:

It would be interesting to have a test that we don't follow links transitively. 
This can be done by creating a tzdb that contains a link to a link, and testing 
that `locate_zone` doesn't find it. And if you changed the code to actually try 
to be "clever" and follow links transitively, the test would suddenly pass 
(well, fail but you get the point).

https://github.com/llvm/llvm-project/pull/82157
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to