[llvm] [lld] [ThinLTO] Add module names to ThinLTO final objects (PR #74160)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 09:53:53 PST 2023


================
@@ -299,7 +299,18 @@ class LTO {
 
   /// Static method that returns a list of libcall symbols that can be generated
   /// by LTO but might not be visible from bitcode symbol table.
-  static ArrayRef<const char*> getRuntimeLibcallSymbols();
+  static ArrayRef<const char *> getRuntimeLibcallSymbols();
+
+  /// Return the name of n-th module. This only applies to ThinLTO.
+  StringRef getModuleName(size_t N) const {
+    size_t I = N;
+    if (I >= ThinLTO.ModuleMap.size())
+      return "";
+    auto it = ThinLTO.ModuleMap.begin();
+    while (I--)
----------------
teresajohnson wrote:

It looks like there is a way to index into the MapVector's vector, using the begin() iterator. See example at https://github.com/llvm/llvm-project/blob/030b8cb1561db4161b108b59044717d89026cf70/llvm/lib/LTO/LTO.cpp#L1811


https://github.com/llvm/llvm-project/pull/74160


More information about the llvm-commits mailing list