Address a memory leak in 254760
[oota-llvm.git] / include / llvm / IR / FunctionInfo.h
index 264954757cfcefe661f356d47f969b2c660dc076..eba088a61bc0ea4acae9d23347c1236c069ad7d4 100644 (file)
@@ -167,7 +167,6 @@ private:
 
 public:
   FunctionInfoIndex() = default;
-  ~FunctionInfoIndex() = default;
 
   // Disable the copy constructor and assignment operators, so
   // no unexpected copying/moving occurs.
@@ -184,6 +183,11 @@ public:
     return FunctionMap[FuncName];
   }
 
+  /// Get the list of function info objects for a given function.
+  const const_funcinfo_iterator findFunctionInfoList(StringRef FuncName) const {
+    return FunctionMap.find(FuncName);
+  }
+
   /// Add a function info for a function of the given name.
   void addFunctionInfo(StringRef FuncName, std::unique_ptr<FunctionInfo> Info) {
     FunctionMap[FuncName].push_back(std::move(Info));
@@ -223,6 +227,13 @@ public:
     return ModulePathStringTable.insert(std::make_pair(ModPath, ModId))
         .first->first();
   }
+
+  /// Check if the given Module has any functions available for exporting
+  /// in the index. We consider any module present in the ModulePathStringTable
+  /// to have exported functions.
+  bool hasExportedFunctions(const Module &M) const {
+    return ModulePathStringTable.count(M.getModuleIdentifier());
+  }
 };
 
 } // End llvm namespace