Add LifetimeSymbolTable::LookupLifetimeAndMaybeDeclare().

PiperOrigin-RevId: 413108197
diff --git a/lifetime_annotations/lifetime_symbol_table.h b/lifetime_annotations/lifetime_symbol_table.h
index c9599f7..d53ca4d 100644
--- a/lifetime_annotations/lifetime_symbol_table.h
+++ b/lifetime_annotations/lifetime_symbol_table.h
@@ -35,9 +35,18 @@
   // If `lifetime` is `Lifetime::Static()`, returns "static".
   std::optional<llvm::StringRef> LookupLifetime(Lifetime lifetime) const;
 
+  // Looks up a lifetime in the symbol table and inserts a new autogenerated
+  // name for it if the lifetime was not found.
+  // If `lifetime` is `Lifetime::Static()`, returns "static".
+  // The autogenerated name will be the first name from the sequence
+  // "a", ..., "z", "aa", "ab", "ac", ... that is not yet contained in the
+  // symbol table.
+  llvm::StringRef LookupLifetimeAndMaybeDeclare(Lifetime lifetime);
+
  private:
   llvm::StringMap<Lifetime> name_to_lifetime_;
   llvm::DenseMap<Lifetime, std::string> lifetime_to_name_;
+  int next_name_index_ = 0;
 };
 
 }  // namespace devtools_rust