Skip to content
  • Igor Kushnir's avatar
    Destroy RecursiveImportCacheRepository after PersistentSymbolTableRepo · e1541088
    Igor Kushnir authored
    a8ffba2c cleared the persistent symbol
    table caches in ~PersistentSymbolTable() to work around an
    AddressSanitizer crash when a non-empty imports cache is destroyed after
    the cache repository it references.
    
    The constructor of the PersistentSymbolTable singleton creates a
    PersistentSymbolTableRepo function-local static, then a
    RecursiveImportCacheRepository function-local static. The order of
    destruction of these 3 static objects is the reverse of the order of
    their construction completion:
    ~PersistentSymbolTable()
    recursiveImportCacheRepositoryObject's destruction
    ~PersistentSymbolTableRepo()
    
    Since PersistentSymbolTableRepo::importsCache depends on
    recursiveImportCacheRepositoryObject and not vice versa, a proper fix is
    to create the cache repository before and thus destroy after the
    persistent symbol table repository.
    e1541088