[PATCH] D120931: [clang-format] fix namepsace format when the name is macro expansion

Zequan Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 3 12:10:26 PST 2022


zequanwu created this revision.
zequanwu added reviewers: klimek, sammccall.
Herald added a project: All.
zequanwu requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Originally filed at crbug.com/1184570.
When the name of a namespace is a macro that takes arguments,

- It fixed the indentation.
- It tried to fix namespace end comment by making the name empty, because we

don't know the macro expansion. It seems like `FormatToken::MacroCtx` is always
None. Its assignment only happens in `MacroExpander` which is never used.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120931

Files:
  clang/lib/Format/NamespaceEndCommentsFixer.cpp
  clang/lib/Format/UnwrappedLineParser.cpp
  clang/unittests/Format/FormatTest.cpp
  clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120931.412805.patch
Type: text/x-patch
Size: 4142 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220303/9868ab9d/attachment.bin>


More information about the cfe-commits mailing list