[Lldb-commits] [PATCH] D83876: [lldb] Add SBModule::ClearCachedModules and clear modules after each test run

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 16 11:11:43 PDT 2020


JDevlieghere added inline comments.


================
Comment at: lldb/bindings/interface/SBModule.i:365
+    static void
+    ClearCachedModules();
+
----------------
teemperor wrote:
> JDevlieghere wrote:
> > Maybe we should call this `ClearAllocatedModules` for consistency with the other APIs? 
> Not sure what's a good name. I would assume from the name `ClearAllocatedModules` that i would delete all allocated modules, but it actually only clears modules that are only kept around for the sake of caching. So this would not actually always work (but it should in the test suite):
> 
> ```
> assert(GetNumberAllocatedModules != 0);
> ClearAllocatedModules();
> assert(GetNumberAllocatedModules == 0); // boom if any of the allocated modules is still needed.
> ```
> 
> (FWIW, LLDB internally calls this "orphaned" modules but that doesn't seem very intuitive either).
> 
> "MaybeClearAllocatedModules", "TryClearAllocatedModules", "ClearOrphanedModules", etc.
How about `GarbageCollectAllocatedModules`? 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83876/new/

https://reviews.llvm.org/D83876





More information about the lldb-commits mailing list