[PATCH] D105380: [clang] fixes named return of variables with dependent alignment
Matheus Izvekov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 4 15:14:56 PDT 2021
mizvekov marked 2 inline comments as done.
mizvekov added inline comments.
================
Comment at: clang/lib/Sema/SemaDecl.cpp:13317
+ std::any_of(range.begin(), range.end(), [](const AlignedAttr *I) {
+ return I->isAlignmentDependent();
+ });
----------------
Quuxplusone wrote:
> Tangent: It would be nice to rename `isAlignmentDependent` into `hasDependentAlignment` or simply `isDependent`. IIUC, the intended meaning is "Is this alignment attribute 'dependent'?" and not (as the name would naturally parse) "is this alignment attribute 'alignment-dependent'?"
>
> Arguably, it could also work to say `I->isDependentAlignment()` in the same way that we say `getType()->isDependentType()`.
>
> Speaking of which, maybe `I` should be renamed to `AA` or something? Is `I` really the right abbreviation for an `AlignedAttr`?
I agree, but it is not so simple. This attribute class is autogenerated from `clang/include/clang/Basic/Attr.td` and it's not obvious to me where that method name comes from. Probably the tablegen backend. But that is another area that I am not familiar with yet.
And there are a few users, and also a method named `isAlignmentErrorDependent` which would benefit from the same kind of rename.
This DR is supposed to be a quick fix for a regression, I better leave that tangent for another time :)
The second rename, well it is very common to name a predicate variable as `I`, but I renamed to `AA` as that is also good.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105380/new/
https://reviews.llvm.org/D105380
More information about the cfe-commits
mailing list