[PATCH] D41661: [clangd] Don't navigate to forward class declaration when go to definition.

2018-01-12 Thread Haojian Wu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL322370: [clangd] Dont navigate to forward class declaration when go to definition. (authored by hokein, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM

[PATCH] D41661: [clangd] Don't navigate to forward class declaration when go to definition.

2018-01-03 Thread Haojian Wu via Phabricator via cfe-commits
hokein added inline comments. Comment at: clangd/XRefs.cpp:68 + // declaration, and it could be a forward declaration. + auto Def = std::find_if(D->redecls_begin(), D->redecls_end(), + [](const Decl *D) { return IsDefinition(D); });

[PATCH] D41661: [clangd] Don't navigate to forward class declaration when go to definition.

2018-01-03 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 128516. hokein added a comment. Use getDefinition to simply the code. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D41661 Files: clangd/XRefs.cpp unittests/clangd/XRefsTests.cpp Index: unittests/clangd/XRefsTests.cpp

[PATCH] D41661: [clangd] Don't navigate to forward class declaration when go to definition.

2018-01-03 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/XRefs.cpp:68 + // declaration, and it could be a forward declaration. + auto Def = std::find_if(D->redecls_begin(), D->redecls_end(), + [](const Decl *D) { return IsDefinition(D); });

[PATCH] D41661: [clangd] Don't navigate to forward class declaration when go to definition.

2018-01-03 Thread Haojian Wu via Phabricator via cfe-commits
hokein added a comment. With more test, it turns out that `ASTNode.OrigD` is not always pointed to the definition, so we can't rely on `D` or `ASTNode.OrigD` :(. I revised the way of checking definition, it should works for major cases. Please review it again. Repository: rCTE Clang Tools

[PATCH] D41661: [clangd] Don't navigate to forward class declaration when go to definition.

2018-01-03 Thread Haojian Wu via Phabricator via cfe-commits
hokein updated this revision to Diff 128501. hokein marked an inline comment as done. hokein added a comment. - Revise the way of checking definition. - Add a test for function declaration. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D41661 Files: clangd/XRefs.cpp

[PATCH] D41661: [clangd] Don't navigate to forward class declaration when go to definition.

2018-01-02 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision. sammccall added inline comments. This revision is now accepted and ready to land. Comment at: clangd/XRefs.cpp:54 if (isSearchedLocation(FID, Offset)) - Decls.push_back(D); + Decls.push_back(ASTNode.OrigD); return true;

[PATCH] D41661: [clangd] Don't navigate to forward class declaration when go to definition.

2018-01-02 Thread Haojian Wu via Phabricator via cfe-commits
hokein created this revision. hokein added a reviewer: sammccall. Herald added subscribers: ilya-biryukov, klimek. For some cases, GoToDefinition will navigate to the forward class declaration, we should always navigate to the class definition. Repository: rCTE Clang Tools Extra