aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Format/WhitespaceManager.cpp
diff options
context:
space:
mode:
authorOwen Pan <owenpiano@gmail.com>2024-08-27 19:13:27 -0700
committerGitHub <noreply@github.com>2024-08-27 19:13:27 -0700
commit656d5aa95825515a55ded61f19d41053c850c82d (patch)
tree446603cac89a64d6c50a91f9f44bf086f9e50e8b /clang/lib/Format/WhitespaceManager.cpp
parent815bf0f190383e14068f191bb0d16d62fbb6f8b3 (diff)
downloadllvm-656d5aa95825515a55ded61f19d41053c850c82d.zip
llvm-656d5aa95825515a55ded61f19d41053c850c82d.tar.gz
llvm-656d5aa95825515a55ded61f19d41053c850c82d.tar.bz2
[clang-format] Fix misalignments of pointers in angle brackets (#106013)
Fixes #105898.
Diffstat (limited to 'clang/lib/Format/WhitespaceManager.cpp')
-rw-r--r--clang/lib/Format/WhitespaceManager.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp
index a31874a..fd4a40a 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -469,7 +469,9 @@ AlignTokenSequence(const FormatStyle &Style, unsigned Start, unsigned End,
// except if the token is equal, then a space is needed.
if ((Style.PointerAlignment == FormatStyle::PAS_Right ||
Style.ReferenceAlignment == FormatStyle::RAS_Right) &&
- CurrentChange.Spaces != 0 && CurrentChange.Tok->isNot(tok::equal)) {
+ CurrentChange.Spaces != 0 &&
+ !CurrentChange.Tok->isOneOf(tok::equal, tok::r_paren,
+ TT_TemplateCloser)) {
const bool ReferenceNotRightAligned =
Style.ReferenceAlignment != FormatStyle::RAS_Right &&
Style.ReferenceAlignment != FormatStyle::RAS_Pointer;