Wdocumentation no longer provides fix-its which map multiple param comments to the same parameter.
This commit fixes:
Differential D74877
[clang] fix incorrect Wdocumentation fix-its AlexanderLanin on Feb 19 2020, 3:20 PM. Authored by
Details
Wdocumentation no longer provides fix-its which map multiple param comments to the same parameter. This commit fixes:
Diff Detail Event TimelineComment Actions Thanks for your patch. I also would like to get better fixits for the arguments. I would also like to hear @gribozavr2's input.
Comment Actions Slightly more code changed, assuming it's better understandable now. Review findings incorporated. Comment Actions Sorry it took a while. Do you want to continue this patch or switch to the other one as you mentioned before? Some other remarks:
Can you add a few more complex test cases, for example something like: /** * \param aabb X * \param abbb Y */ void foo(int NotMe, int bbbb); Which comment will be attached to bbbb? Comment Actions Thanks for the feedback!!
I had already updated this pull request to incorporate improvements from the github link. Sorry I didn't make that clear.
Both reports are from me and I'm quite certain I have them covered in tests. I will add a reference to the exact test cases.
Currently all unmapped parameters are taken into account.
Shall I remove the 1:1 exception which disregards edit distance?
Sounds reasonable, but it might not be trivial to find an appropriate heuristic weighting this against edit distance.
Sure! I missed that one. I'll add some more. Comment Actions More tests added to prevent further regressions. It's quite difficult to figure out tests which might fail, but now there is a whole bunch of them so it looks good. If there is anything else I should fix, I'd gladly do so! If there is nothing else please commit it as I cannot. Comment Actions
For example what happens in this case: /** * \param aaaa Should match aaa * \param aaab Should match aab * \param aaac Should match aac */ void foo(int aaa, int aab, int aac); And in the almost similar case: /** * \param aaaa Should match aaa * \param aaab Should match aab * \param aaac Should match aac */ void foo(int aac, int aab, int aaa); Does it give the same final result or does the order of the comments and parameters influence the outcome? I would like to have a closer look at the algorithm you're using, I hope to find time for that later this week.
Comment Actions I need to have a look why the mentioned test case is failing. I'll also add the two examples you provided to the next upload.
Comment Actions
Comment Actions *ping* Comment Actions Rebased and stored at https://github.com/AlexanderLanin/llvm-project/tree/Wdocumentation-fix-its so I have a branch next time I need to rebase :-) Still looking for someone to approve and to commit this change. Comment Actions Added one missing expect statement in this revision. Could someone please review and optionally approve and to commit this change? Comment Actions I think the patch looks better, but I still would like to get @gribozavr2 's opinion. I'm not convinced the new approach is better in all cases, so I'm somewhat concerned about regressions from the current behaviour. Did you test this patch on a codebase to see the difference between the previous and new behaviour? For the next time when providing a patch, please do the cleanups in a separate patch, that makes reviewing the real changes a bit easier.
Comment Actions
There are no warnings in llvm or ccache, all I found is a low quality codebase at work which does produce 1007 unique Wdocumentation warnings (see wc command). It *seems* I can run this via: mkdir -p build-clang-D74877 && cd build-clang-D74877 CC=/home/alex/llvm/build-D74877/bin/clang CXX=/home/alex/llvm/build-D74877/bin/clang++ cmake .. -DCMAKE_CXX_FLAGS="-Wdocumentation -Wno-documentation-deprecated-sync" -GNinja CC=/home/alex/llvm/build-D74877/bin/clang CXX=/home/alex/llvm/build-D74877/bin/clang++ cmake .. -DCMAKE_CXX_FLAGS="-Wdocumentation -Wno-documentation-deprecated-sync -fsyntax-only" -GNinja ninja -j1 -k10000 > warnings.txt grep "\[-Wdocumentation\]" warnings.txt | grep -v "empty paragraph passed to" | grep -v "^\[" | sort | uniq | wc -l cd .. mkdir -p build-clang-master && cd build-clang-master CC=/home/alex/llvm/build-master/bin/clang CXX=/home/alex/llvm/build-master/bin/clang++ cmake .. -DCMAKE_CXX_FLAGS="-Wdocumentation -Wno-documentation-deprecated-sync" -GNinja CC=/home/alex/llvm/build-master/bin/clang CXX=/home/alex/llvm/build-master/bin/clang++ cmake .. -DCMAKE_CXX_FLAGS="-Wdocumentation -Wno-documentation-deprecated-sync -fsyntax-only" -GNinja ninja -j1 -k10000 > warnings.txt grep "\[-Wdocumentation\]" warnings.txt | grep -v "empty paragraph passed to" | grep -v "^\[" | sort | uniq | wc -l cd .. # .. in order to leave git grep -v "^\[" build-clang-master/warnings.txt > ../clang-master-warnings.txt grep -v "^\[" build-clang-D74877/warnings.txt > ../clang-D74877-warnings.txt git diff ../clang-master-warnings.txt ../clang-D74877-warnings.txt I do not know how to apply suggested fixes for an easier diff. Anyway based on the approach above I found two additional regressions. Testing with real code seems to be kind of important ;-)
I'll further analyze the diff ASAP (have to fix the second problem first so that the diff gets smaller).
Because at the moment lots of new test cases are added and it's not clear what is even different now with this patch. What do you think of that @Mordante? Comment Actions
Would it be feasible to run it on a part of the clang codebase just to get a feeling, or does that also take too long?
Maybe first look why the columns have changed and whether it's a real issue.
AFAIK other diagnostic tests don't test the in which the diagnostics are emitted. So I wonder whether this is really required.
I think if would be first good to figure out why this changes and then see whether it's a real issue. If it's an issue it needs to be fixed, else the separate patches would be preferred.
Comment Actions
I think those unintentional changes are an issue. See where ^ points and how the readability of the messages decreases due to their order: TimeFormatTypes.h:171:14: warning: parameter 'paramGpsWeek:' not found in the function declaration [-Wdocumentation] /// @param paramGpsWeek: weeks till 6.1.1980 ^ ~~~~~~~~~~~~~ TimeFormatTypes.h:172:14: warning: parameter 'paramGpsTimeOfWeek:' not found in the function declaration [-Wdocumentation] /// @param paramGpsTimeOfWeek: seconds in current week ^ ~~~~~~~~~~~~~~~~~~~ TimeFormatTypes.h:173:14: warning: parameter 'paramLeapSeconds:' not found in the function declaration [-Wdocumentation] /// @param paramLeapSeconds: leap seconds, default 0 ^ ~~~~~~~~~~~~~~~~~ TimeFormatTypes.h:171:14: note: did you mean 'paramGpsWeek'? /// @param paramGpsWeek: weeks till 6.1.1980 ^ ~~~~~~~~~~~~~ paramGpsWeek TimeFormatTypes.h:172:14: note: did you mean 'paramGpsTimeOfWeek'? /// @param paramGpsTimeOfWeek: seconds in current week ^ ~~~~~~~~~~~~~~~~~~~ paramGpsTimeOfWeek TimeFormatTypes.h:173:14: note: did you mean 'paramLeapSeconds'? /// @param paramLeapSeconds: leap seconds, default 0 ^ ~~~~~~~~~~~~~~~~~ paramLeapSeconds I'll fix this shortly.
|
Is the debug output really that interesting after the code has been committed?