Bug 430138 - qt6-qlatin1stringchar-to-u creates duplicates in replacements yaml file
Summary: qt6-qlatin1stringchar-to-u creates duplicates in replacements yaml file
Status: RESOLVED FIXED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Jörg Bornemann
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-08 07:12 UTC by Jörg Bornemann
Modified: 2021-01-12 12:52 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jörg Bornemann 2020-12-08 07:12:25 UTC
SUMMARY

Consider code like this:

---snip---
#define MY_CONSTANT(type, name, value)                \
static const type &name() {                           \
    static const type var{QLatin1String(value)};      \
return var;                                           \
}
#define MY_STRING_CONSTANT(name, value) MY_CONSTANT(QString, name, value)

MY_STRING_CONSTANT(fooProperty, "foo")
MY_STRING_CONSTANT(barProperty, "bar")
---snap---

Applying the qt6-qlatin1stringchar-to-u fixit will create duplicates in the replacements yaml file at the position of QLatin1String within the macro.
This leads to errors like this:

The new replacement overlaps with an existing replacement.
New replacement: ../../../../master/src/lib/corelib/tools/stringconstants.h: 2133:+20:"u"~/""
Existing replacement: ../../../../master/src/lib/corelib/tools/stringconstants.h: 2133:+20:"u"*""


ADDITIONAL INFORMATION

Playground project for this was https://code.qt.io/cgit/qbs/qbs.git/
and the file I ran the fixit on was src/lib/corelib/language/language.cpp
Comment 1 Sergio Martins 2021-01-10 13:46:21 UTC
can you reassign to Lucie ? I'm not finding then name in the assign list
Comment 2 Jörg Bornemann 2021-01-12 12:52:18 UTC
This was fixed with https://invent.kde.org/sdk/clazy/-/merge_requests/29