• Gabriel Charette's avatar
    [base] Broaden Singleton's friend declarations · 0fc5f9d3
    Gabriel Charette authored
    Friend'ing specific methods is incorrect since the addition of
    GetIfExits() because, although clang compiles this without warnings,
    the spec clearly says that friend'ing an undeclared method is not
    allowed (even if no such method ever exists and hence never uses that
    friend declaration). Not nearly all singletons need to support
    GetInstanceIfExists() and hence adding everywhere is undesired.
    
    This CL makes Singleton<T> friend all of T. This is fine because
    that doesn't give much more power to T (beyond the option of naming
    its GetInstance() method differently...).
    
    Bug: 905990
    Change-Id: I2d2c721b27f8f3fa3367dff996f37293c98674c3
    Reviewed-on: https://chromium-review.googlesource.com/c/1343660Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
    Commit-Queue: Gabriel Charette <gab@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#609809}
    0fc5f9d3
singleton.h 10.3 KB