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 finds wrong declaration #855

Open floli opened 8 years ago

floli commented 8 years ago

Hello,

this snippet of code:

    utils::DynVector offset(meshContext.geometry->getOffset());
    offset += meshContext.localOffset;

point is on the offset in the second line, I call rtags-find-symbol-at-point and it jumps to something completely unrelated.

I was unable to reproduce it in a more isolated example. How can I produce more helpful info?

florian@asaru ~ % rdm -v
listening /home/florian/.rdm
Socket error 2 111 (111)
listening /home/florian/.rdm
Running with 4 jobs, using args: -ferror-limit=50 -Wall -fspell-checking -Wno-unknown-warning-option
Includepaths: -isystem /usr/lib/clang/3.9.0/include/
Restoring /home/florian/precice/ ......................................
/usr/sbin/rc --current-file=/home/florian/precice/src/precice/impl/SolverInterfaceImpl.cpp --no-color -f /home/florian/precice/src/precice/impl/SolverInterfaceImpl.cpp:1982:7:
Query opened 1 files for project /home/florian/precice/
/usr/sbin/rc --current-file=/home/florian/precice/src/precice/impl/SolverInterfaceImpl.cpp --no-color -F offset --definition-only -M 1 --dependency-filter /home/florian/precice/src/precice/impl/SolverInterfaceImpl.cpp --wildcard-symbol-names
Query opened 3924 files for project /home/florian/precice/
/usr/sbin/rc -T /usr/include/eigen3/Eigen/src/Geometry/Hyperplane.h --diagnose /usr/include/eigen3/Eigen/src/Geometry/Hyperplane.h --silent-query
Query opened 4 files for project /home/florian/precice/
/usr/sbin/rc -T /usr/include/eigen3/Eigen/src/Geometry/Hyperplane.h --diagnose /usr/include/eigen3/Eigen/src/Geometry/Hyperplane.h --silent-query
Andersbakken commented 8 years ago

Sorry about the delay.

Are templates involved here?

There are some known issues around templates. E.g. is utils::DynVector a typedef for a templatized class?

Otherwise, can you check the value of rtags-follow-symbol-try-harder?

If it's t I would consider setting it to nil.

Does this reliably reproduce? E.g. if you modify the file and let rtags reindex, does it still happen?

regards

Anders

On Wed, Nov 16, 2016 at 12:22 AM, Florian Lindner notifications@github.com wrote:

Hello,

this snippet of code:

utils::DynVector offset(meshContext.geometry->getOffset());
offset += meshContext.localOffset;

point is on the offset in the second line, I call rtags-find-symbol-at-point and it jumps to something completely unrelated.

I was unable to reproduce it in a more isolated example. How can I produce more helpful info?

florian@asaru ~ % rdm -v listening /home/florian/.rdm Socket error 2 111 (111) listening /home/florian/.rdm Running with 4 jobs, using args: -ferror-limit=50 -Wall -fspell-checking -Wno-unknown-warning-option Includepaths: -isystem /usr/lib/clang/3.9.0/include/ Restoring /home/florian/precice/ ...................................... /usr/sbin/rc --current-file=/home/florian/precice/src/precice/impl/SolverInterfaceImpl.cpp --no-color -f /home/florian/precice/src/precice/impl/SolverInterfaceImpl.cpp:1982:7: Query opened 1 files for project /home/florian/precice/ /usr/sbin/rc --current-file=/home/florian/precice/src/precice/impl/SolverInterfaceImpl.cpp --no-color -F offset --definition-only -M 1 --dependency-filter /home/florian/precice/src/precice/impl/SolverInterfaceImpl.cpp --wildcard-symbol-names Query opened 3924 files for project /home/florian/precice/ /usr/sbin/rc -T /usr/include/eigen3/Eigen/src/Geometry/Hyperplane.h --diagnose /usr/include/eigen3/Eigen/src/Geometry/Hyperplane.h --silent-query Query opened 4 files for project /home/florian/precice/ /usr/sbin/rc -T /usr/include/eigen3/Eigen/src/Geometry/Hyperplane.h --diagnose /usr/include/eigen3/Eigen/src/Geometry/Hyperplane.h --silent-query

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Andersbakken/rtags/issues/855, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEdSoCy4PnmM0kHrVs24HcJeKMrhJ1iks5q-r1XgaJpZM4Kzh-M .

floli commented 7 years ago

Yes, there are templates and typedefs involved: typedef tarch::la::DynamicVector<double> DynVector

Would this improve using a using declaration instead?

Issue is not exactly reproducible. I just tried to, but now it correctly jumps to the declaration of offset (with rtags-follow-symbol-try-harder set to either t or nil.

Best, Florian

Andersbakken commented 7 years ago

It's not really the typedef that's the problem. It's the fact that it's a template. We have some known issues with it that we think we can fix.

The fact that it fixes itself by dirtying the file is actually quite interesting.

I'll try to look into generating a test case that could reproduce something like it.

Anders

On Mon, Nov 21, 2016 at 1:07 AM, Florian Lindner notifications@github.com wrote:

Yes, there are templates and typedefs involved: typedef tarch::la::DynamicVector DynVector

Would this improve using a using declaration instead?

Issue is not exactly reproducible. I just tried to, but now it correctly jumps to the declaration of offset (with rtags-follow-symbol-try-harder set to either t or nil.

Best, Florian

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Andersbakken/rtags/issues/855#issuecomment-261882363, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEdSte5eJ8Gizl5d_htsDzqWrZJ3Zwtks5rAV9MgaJpZM4Kzh-M .