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.82k stars 253 forks source link

rtags not indexing the functions fully even for rtags source code. #1432

Closed akh2008 closed 3 months ago

akh2008 commented 2 years ago

Describe the bug rtags not indexing the complete function and i can not see the symbol info for a part of function. This leads to various commands not working i.e jump to definition, references, symbol info etc.

To Reproduce Steps to reproduce the behavior:

  1. Index the rtags repo with rc -J
  2. Some part do not work for rc commands given below.

Expected behavior functions should be indexed and all expected symbols should be available.

Screenshots/Backtrace The following piece of code does not index in given function. This is one example from rtags repo itself.

File: src/ClangIndexer.cpp Function: bool ClangIndexer::superclassTemplateMemberFunctionUgleHack(const CXCursor &cursor, CXCursorKind kind, Location location, const CXCursor &/ref/, Symbol **cursorPtr)

        case 1:
            // ### not sure this is correct with line/col
            return handleReference(cursor, kind,
                                   Location(location.fileId(), location.line(), location.column() + 1),
                                   alternatives.front(), cursorPtr);
            break;
        case 0:
            break;
        default:
            warning() << "Can't decide which of these symbols are right for me"
                      << cursor << alternatives
                      << "Need to parse types";
            break;
        }
    }

----> Here cursor on handleReference() do not jump to definition(no commands works like references, symbol info etc) and also no output for rc command (rc --absolute-path -f src/ClangIndexer.cpp:991:24 and similar)

--> dump of file map shows no content for above mentioned code lines. From 987 to 1004, there is no database for any symbols.

| src/ClangIndexer.cpp:987:30:   | Symbol(src/ClangIndexer.cpp:987:30: SymbolName: const List<CXCursor>   |
*                                * alternatives Kind: VarDecl Type: const List<CXCursor> SymbolLength:    *
*                                * 12 Range: 987:9-987:42 Linkage: No Linkage Definition Usr:             *
*                                * c:ClangIndexer.cpp@34343@S@ClangIndexer@F@superclassTemplateMemberFunc *
*                                * tionUgleHack#&1$@SA@CXCursor#$@E@CXCursorKind#$@S@Location#S0_#**$@S@S *
*                                * ymbol#@alternatives                                                    *
*                                * )                                                                      *
| src/ClangIndexer.cpp:1004:5:   | Symbol(src/ClangIndexer.cpp:1004:5: SymbolName: return Kind:           |
*                                * ReturnStmt SymbolLength: 6 Range: 1004:5-1004:17 )                     *

Environment (please complete the following information):

Andersbakken commented 1 year ago

Sorry about the super long turnaround time. I can't reproduce this. Both on mac and linux both follow location, find references and all other commands I checked works against that location (src/ClangIndexer.cpp:998:20: in current master).

It's possible it has been fixed since the bug was reported. Which libclang version are you using? Can you still reproduce this problem?