[PATCH] D145262: [clang-format] Treat AttributeMacros more like attribute macros
Owen Pan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 2 21:01:24 PDT 2023
owenpan added inline comments.
================
Comment at: clang/lib/Format/ContinuationIndenter.cpp:1338-1341
PreviousNonComment->isOneOf(
- TT_AttributeRParen, TT_AttributeSquare, TT_FunctionAnnotationRParen,
- TT_JavaAnnotation, TT_LeadingJavaAnnotation))) ||
+ TT_AttributeRParen, TT_AttributeMacro, TT_AttributeSquare,
+ TT_FunctionAnnotationRParen, TT_JavaAnnotation,
+ TT_LeadingJavaAnnotation))) ||
----------------
Basically, insert the first two lines and undo the changes to the last three lines.
================
Comment at: clang/lib/Format/TokenAnnotator.cpp:4390-4391
// Space in __attribute__((attr)) ::type.
if (Left.is(TT_AttributeRParen) && Right.is(tok::coloncolon))
return true;
----------------
Please also add a test case for this.
================
Comment at: clang/lib/Format/TokenAnnotator.cpp:4706
return true;
- if (Left.is(tok::r_paren) && canBeObjCSelectorComponent(Right)) {
+ // Apply this logic for parens that are not function attribute macros.
+ if (Left.is(tok::r_paren) && Left.isNot(TT_AttributeRParen) &&
----------------
Please delete this comment, which IMO doesn't quite match the code below.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145262/new/
https://reviews.llvm.org/D145262
More information about the cfe-commits
mailing list