Skip to content
Snippets Groups Projects
  • Nico Weber's avatar
    d8758315
    Let ASTReader optionally delete its ASTDeserializationListener. · d8758315
    Nico Weber authored
    Use this to fix the leak of DeserializedDeclsDumper and DeserializedDeclsChecker
    in FrontendAction (found by LSan), PR19560.
    
    The "delete this" bool is necessary because both PCHGenerator and ASTUnit
    return the same object from both getDeserializationListener() and
    getASTMutationListener(), so ASTReader can't just have a unique_ptr.
    
    It's also not possible to just let FrontendAction (or CompilerInstance) own
    these listeners due to lifetime issues (see comments on PR19560).
    
    Finally, ASTDeserializationListener can't easily be refcounted, since several of
    the current listeners are allocated on the stack.
    
    Having this bool isn't ideal, but it's a pattern that's used in other places in
    the codebase too, and it seems better than leaking.
    
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208277 91177308-0d34-0410-b5e6-96231b3b80d8
    d8758315
    History
    Let ASTReader optionally delete its ASTDeserializationListener.
    Nico Weber authored
    Use this to fix the leak of DeserializedDeclsDumper and DeserializedDeclsChecker
    in FrontendAction (found by LSan), PR19560.
    
    The "delete this" bool is necessary because both PCHGenerator and ASTUnit
    return the same object from both getDeserializationListener() and
    getASTMutationListener(), so ASTReader can't just have a unique_ptr.
    
    It's also not possible to just let FrontendAction (or CompilerInstance) own
    these listeners due to lifetime issues (see comments on PR19560).
    
    Finally, ASTDeserializationListener can't easily be refcounted, since several of
    the current listeners are allocated on the stack.
    
    Having this bool isn't ideal, but it's a pattern that's used in other places in
    the codebase too, and it seems better than leaking.
    
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208277 91177308-0d34-0410-b5e6-96231b3b80d8
Code owners
Assign users and groups as approvers for specific file changes. Learn more.