Starting with version 24.08, the symbol browsing (clicking on a symbol to go to its implementation or declaration) is broken when using macros. The example code is found in github.com/smuellerDD/leancrypto. The code uses return code checkers defined like: #define CKINT(x) \ { \ ret = x; \ if (ret < 0) \ goto out; \ } A function invocation is like: CKINT(asn1_ber_decoder(&x509_decoder, &pctx, data, datalen)); Now, when hovering over "asn1_ber_encoder", the browsing mode tries to lead me to the "out" goto symbol that is defined by the "CKINT" macro instead of the actual function declaration / implementation. STEPS TO REPRODUCE 1. load and open https://gitnub.com/smuellerDD/leancrypto with kdevelop 2. take any file in there, e.g. asn1/src/x509_cert_generator.c and search for "CKINT" - e.g. line 1324. 3. Click on the symbol there, e.g. "asn1_ber_decoder" OBSERVED RESULT After clicking on the symbol, you see kdevelop will lead you to the out goto target instead of the symbol. EXPECTED RESULT After clicking on the symbol, the browser should jump to the symbol implementation or declaration. SOFTWARE/OS VERSIONS Linux/KDE Plasma: OpenSUSE tumbleweed current version KDE Plasma Version: 6.2.4 KDE Frameworks Version: 6.8.0 Kdevelop version: 24.08.3 Qt Version: 6.8.0
Cannot reproduce with the following snippet and C++17: ``` int asn1_ber_decoder(int i) { return i; } #define CKINT(x) \ { \ ret = x; \ if (ret < 0) \ goto out; \ } int ff() { int ret; CKINT(asn1_ber_decoder(5)); return ret; out: return -1; } ``` Does navigation work as you expect in the above snippet? If yes, can you create a small example where navigation fails?
Am Mittwoch, 4. Dezember 2024, 16:31:30 Mitteleuropäische Normalzeit schrieb Igor Kushnir: Hi Igor, > https://bugs.kde.org/show_bug.cgi?id=496985 > > Igor Kushnir <igorkuo@gmail.com> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Status|REPORTED |NEEDSINFO > Resolution|--- |WAITINGFORINFO > CC| |igorkuo@gmail.com > > --- Comment #1 from Igor Kushnir <igorkuo@gmail.com> --- > Cannot reproduce with the following snippet and C++17: > ``` > int asn1_ber_decoder(int i) > { > return i; > } > #define CKINT(x) \ > { \ > ret = x; \ > if (ret < 0) \ > goto out; \ > } > int ff() > { > int ret; > CKINT(asn1_ber_decoder(5)); > return ret; > out: > return -1; > } > ``` > > Does navigation work as you expect in the above snippet? If yes, can you > create a small example where navigation fails? No, it does not work in Kdevelop: when I hover over the line "CKINT(asn1_ber_decoder(5));" it shows "Label out" in the first line of the pop-up. When I Ctrl-Click on the asn1_ber_decoder function in the mentioned line, it jumps to the "out" label. Ciao Stephan
Created attachment 176352 [details] Macro tooltip in KDevelop 6.1.241170, clang version 18.1.8
Created attachment 176353 [details] Function tooltip in KDevelop 6.1.241170, clang version 18.1.8
(In reply to Stephan Mueller from comment #2) > No, it does not work in Kdevelop: when I hover over the line > "CKINT(asn1_ber_decoder(5));" it shows "Label out" in the first line of the > pop-up. > > When I Ctrl-Click on the asn1_ber_decoder function in the mentioned line, it > jumps to the "out" label. > > Ciao > Stephan Everything works as expected on my system and I am not aware of any related changes since KDevelop 6.0.240800. See the screenshots, and Ctrl+Click on asn1_ber_decoder moves the cursor to the function's declaration. I suspect something is broken on your system or in your distro. Can you check in a new KDevelop session and a new project - perhaps KDevelop's cache is broken?
Am Mittwoch, 4. Dezember 2024, 18:35:22 Mitteleuropäische Normalzeit schrieb Igor Kushnir: Hi Igor, > Everything works as expected on my system and I am not aware of any related > changes since KDevelop 6.0.240800. See the screenshots, and Ctrl+Click on > asn1_ber_decoder moves the cursor to the function's declaration. I suspect > something is broken on your system or in your distro. Can you check in a new > KDevelop session and a new project - perhaps KDevelop's cache is broken? When I use a different session with a different kdev4 definition file, but similar constructs, I see the same issue. I use OpenSUSE Tumbleweed, with the latest code revision. I am not sure how I can create a screenshot to show that because the tool tip is not on the screenshot. Ciao Stephan
(In reply to Stephan Mueller from comment #6) > I use OpenSUSE Tumbleweed, with the latest code revision. I am not sure how > I > can create a screenshot to show that because the tool tip is not on the > screenshot. What is your Clang (libclang) version? Have you customized your installed clang package in any way? I don't know what can be done about this bug other than testing on another OpenSUSE system or another GNU/Linux system with the same Clang version. Perhaps debug KDevelop on a system affected by the bug and try to figure out what is going on. I run the command `xfce4-screenshooter -d 5 -w`, which makes a screenshot of the active window after a 5-second delay, then trigger the desired tooltip within those 5 seconds. Your screenshot app probably has similar command line options.
Created attachment 176366 [details] Bildschirmfoto_20241205_083753.png Am Mittwoch, 4. Dezember 2024, 21:17:53 Mitteleuropäische Normalzeit schrieb Igor Kushnir: Hi Igor, > https://bugs.kde.org/show_bug.cgi?id=496985 > > --- Comment #7 from Igor Kushnir <igorkuo@gmail.com> --- > (In reply to Stephan Mueller from comment #6) > > > I use OpenSUSE Tumbleweed, with the latest code revision. I am not sure > > how > > I > > can create a screenshot to show that because the tool tip is not on the > > screenshot. > > What is your Clang (libclang) version? $ clang -v clang version 19.1.4 Target: x86_64-suse-linux Thread model: posix InstalledDir: /usr/bin System configuration file directory: /etc/clang User configuration file directory: /home/sm/.config/clang Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/13 Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/14 Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-suse-linux/14 Candidate multilib: .;@m64 Selected multilib: .;@m64 > Have you customized your installed > clang package in any way? Not at all. > I don't know what can be done about this bug > other than testing on another OpenSUSE system or another GNU/Linux system > with the same Clang version. Perhaps debug KDevelop on a system affected by > the bug and try to figure out what is going on. I just changed Clang to version 18 by changing the symlink from /usr/bin/clang to /usr/bin/clang-18 and I see the same issue. > > I run the command `xfce4-screenshooter -d 5 -w`, which makes a screenshot of > the active window after a 5-second delay, then trigger the desired tooltip > within those 5 seconds. Your screenshot app probably has similar command > line options. I have managed to create a picture, see attached - the mouse overs over teh function asn1_ber_decoder in line 1154. You also see that when hovering over that function, all other lines with the CKINT/CKNULL macro (CKNULL has the same kind of implementation, but it checks for NULL) are highlighted. Ciao Stephan
(In reply to Stephan Mueller from comment #8) > I just changed Clang to version 18 by changing the symlink from > /usr/bin/clang > to /usr/bin/clang-18 and I see the same issue. That's not what needs to be done to test Clang 18. KDevelop uses libclang rather than the clang executable. Rebuilding KDevelop against a different libclang version may be needed. But perhaps simply hiding ALL Clang 19 files and making sure Clang 18's files are found by KDevelop would be enough. There are some macro-related test failures since Clang 19 on the KDevelop's CI: https://invent.kde.org/kdevelop/kdevelop/-/pipelines/833155/test_report?job_name=suse_tumbleweed_qt68 . Perhaps the root cause is the same.
Am Freitag, 6. Dezember 2024, 16:11:03 Mitteleuropäische Normalzeit schrieb Igor Kushnir: Hi Igor, > https://bugs.kde.org/show_bug.cgi?id=496985 > > --- Comment #9 from Igor Kushnir <igorkuo@gmail.com> --- > (In reply to Stephan Mueller from comment #8) > > > I just changed Clang to version 18 by changing the symlink from > > /usr/bin/clang > > to /usr/bin/clang-18 and I see the same issue. > > That's not what needs to be done to test Clang 18. KDevelop uses libclang > rather than the clang executable. Rebuilding KDevelop against a different > libclang version may be needed. But perhaps simply hiding ALL Clang 19 files > and making sure Clang 18's files are found by KDevelop would be enough. That does not cut it: removing the libclang-19 libs and symlinking the libclang-18* libs to the libclang-19* file names does not work: the symbol browsing is disabled entirely. But thanks nonetheless. Ciao Stephan
🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME. For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging. Thank you for helping us make KDE software even better for everyone!
It seems to be an issue with Clang19 interoperability.
*** Bug 498819 has been marked as a duplicate of this bug. ***
*** Bug 498983 has been marked as a duplicate of this bug. ***
https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/713 fixes the bug.
Git commit 458ab3e61975c0ca49fbbab23b3178a439ce8414 by Igor Kushnir, on behalf of Kai Stierand. Committed on 27/01/2025 at 10:01. Pushed by igorkushnir into branch 'master'. Fix locations on Declarations in macro expansions The issue occurs when using Google-Test. Whenever you hovered over Assertion-Macro parameters the whole macro up-to the closing parenthesis was highlighted and referenced class testing::Message. Adapts to clang-19 SpellingLocation change llvm commit: https://github.com/llvm/llvm-project/commit/2e770edd8ce13f48402f1d93e5fb982d8a2ebe64 [libclang] Compute the right spelling location (#72400) FIXED-IN: 6.1.241202 M +14 -14 plugins/clang/duchain/builder.cpp M +55 -0 plugins/clang/tests/test_duchain.cpp M +1 -0 plugins/clang/tests/test_duchain.h https://invent.kde.org/kdevelop/kdevelop/-/commit/458ab3e61975c0ca49fbbab23b3178a439ce8414
Git commit ee828bc1149d2d48f966f8d21ab44f121168cb62 by Igor Kushnir, on behalf of Kai Stierand. Committed on 27/01/2025 at 16:41. Pushed by igorkushnir into branch 'release/24.12'. Fix locations on Declarations in macro expansions The issue occurs when using Google-Test. Whenever you hovered over Assertion-Macro parameters the whole macro up-to the closing parenthesis was highlighted and referenced class testing::Message. Adapts to clang-19 SpellingLocation change llvm commit: https://github.com/llvm/llvm-project/commit/2e770edd8ce13f48402f1d93e5fb982d8a2ebe64 [libclang] Compute the right spelling location (#72400) FIXED-IN: 6.1.241202 (cherry picked from commit 458ab3e61975c0ca49fbbab23b3178a439ce8414) M +14 -14 plugins/clang/duchain/builder.cpp M +55 -0 plugins/clang/tests/test_duchain.cpp M +1 -0 plugins/clang/tests/test_duchain.h https://invent.kde.org/kdevelop/kdevelop/-/commit/ee828bc1149d2d48f966f8d21ab44f121168cb62