[PATCH] D106361: [clang-tidy] Fix crash and handle AttributedTypes in 'bugprone-easily-swappable-parameters'
Whisperity via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 20 14:18:43 PDT 2021
whisperity added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp:476-477
+
+ QualType NewCoreType = CoreType;
+ NewCoreType.addFastQualifiers(Quals.getFastQualifiers());
+ NewCoreType.getQualifiers().addQualifiers(Quals);
----------------
whisperity wrote:
> aaron.ballman wrote:
> >
> Actually, the suggestion is also bad. `getQualifiers()` returns a **copy** on which adding is a moot operation... Turns out you can use `ASTContext` to //create// a specifically qualified type for you.
>
> Now if there was a way to express this in the type of `getQualifiers()`, to warn you //"Don't make the mistake of thinking this would CHANGE anything!"//...
Sorry, I mean, not the suggestion per se, but these 4 new lines of code contained multiple issues.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106361/new/
https://reviews.llvm.org/D106361
More information about the cfe-commits
mailing list