Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-32164

find references fails for ctor when ctor via shared_ptr (make_shared)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • Qt Creator 15.0.0
    • C/C++/Obj-C++ Support
    • None
    • All

    Description

      When trying to find all instances of a ctor (constructor),

      the
      Find References to Symbol under Cursor button
             fails to find constructors that are part of 
      std::shared_ptr   or   std::make_shared

      To reproduce:

      CMakeLists.txt

      cmake_minimum_required(VERSION 3.18)
      
      project(demo LANGUAGES CXX)
      add_executable(demo main.cpp)
      

       

      main.cpp

      #include <memory>
      #include <cstdint>
      
      class MySuperWonderfulClass
      {
      public:
          MySuperWonderfulClass
           (uint64_t i) : m_i{i}
          {}
      private:
          uint64_t m_i;
      };
      
      
      
      int main()
      {
          std::shared_ptr<MySuperWonderfulClass> obj;
          obj = std::make_shared<MySuperWonderfulClass>(uint64_t(55)); // ctor!!!!!!!!!!!
      }
      

       

      So now right-click in line 7  (on     MySuperWonderfulClass  ctor definition)  and do
      Find References to Symbol under Cursor

       

      Unfortunately the only instance found is line 7 itself, but not line 19 where the constructor is actually happening as part of std::make_shared

       

      Actually line 19 with the    std::make_shared    should also be shown!

      Maybe this is a clangd issue??

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kandeler Christian Kandeler
            coderabc a n
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes