Andersbakken / rtags

A client/server indexer for c/c++/objc[++] with integration for Emacs based on clang.
http://www.rtags.net
GNU General Public License v3.0
1.83k stars 252 forks source link

rtags fails to find call to destructor when shared_ptr reference count drops to zero #1426

Open Jacob-Burckhardt opened 3 years ago

Jacob-Burckhardt commented 3 years ago

When I put the cursor on ~Blob, and run M-x rtags-find-references-at-point, it fails to find the reference in the shared_ptr class. When the second variable "p" is destructed the reference count drops to zero and the shared_ptr class calls ~Blob. Please make it find the reference at the point when the shared_ptr is destructed on the line with the comment saying "// missing reference to ~Blob".

#include <memory>
#include <iostream>

using namespace std;

struct Blob {
   ~Blob() {
      cout << "In dtor" << endl;
   }
};

int main() {
   {
      auto p = new Blob;
      delete p;
   }
   {
      auto p = std::make_shared<Blob>();
   } // missing reference to ~Blob
}

Environment (please complete the following information):