[PATCH] D71240: [clangd] Heuristically resolve dependent method calls

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 12 13:45:47 PST 2019


nridge added a comment.

`unique_ptr` is harder to get to work than it might appear at first blush :)

Looking at the gcc 6 libstdc++ implementation as an example: the declared return type is not `T*`, but `unique_ptr<T>::pointer`. The declaration of that is in turn:

  typedef typename _Pointer::type pointer;

The definition of `_Pointer` is in turn:

  // use SFINAE to determine whether _Del::pointer exists
  class _Pointer
  {
    template<typename _Up>
    static typename _Up::pointer __test(typename _Up::pointer*);
  
    template<typename _Up>
    static _Tp* __test(...);
  
    typedef typename remove_reference<_Dp>::type _Del;
  
  public:
    typedef decltype(__test<_Del>(0)) type;
  };

Writing heuristics that see through all that might be possible, and I'm happy to explore it, but definitely in a follow-up.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71240





More information about the cfe-commits mailing list