[clang] [clang-format] Hanlde qualified type name for `QualifierAlignment` (PR #125327)
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 2 15:58:18 PST 2025
================
@@ -412,6 +414,15 @@ const FormatToken *LeftRightQualifierAlignmentFixer::analyzeLeft(
// The case `const long long volatile int` -> `const volatile long long int`
// The case `long volatile long int const` -> `const volatile long long int`
if (TypeToken->isTypeName(LangOpts)) {
+ for (const auto *Prev = TypeToken->getPreviousNonComment();
+ Prev && Prev->is(tok::coloncolon);
+ Prev = Prev->getPreviousNonComment()) {
+ TypeToken = Prev;
+ Prev = Prev->getPreviousNonComment();
----------------
owenca wrote:
I will replace `getPreviousNonComment()` with `Previous` for simplicity and better performance as we really don't need to be concerned about code like `::/**/std/**/::/**/int64_t`.
https://github.com/llvm/llvm-project/pull/125327
More information about the cfe-commits
mailing list