[PATCH] D121907: [clang-format] Use an enum for context types. NFC

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 18 05:03:18 PDT 2022


owenpan accepted this revision.
owenpan added a comment.

LGTM. Any comments, @curdeius?



================
Comment at: clang/lib/Format/TokenAnnotator.cpp:116
     // template parameter, not an argument.
-    Contexts.back().InTemplateArgument =
-        Left->Previous && Left->Previous->isNot(tok::kw_template);
+    if (Left->Previous && Left->Previous->isNot(tok::kw_template))
+      Contexts.back().ContextType = Context::TemplateArgument;
----------------
sstwcw wrote:
> owenpan wrote:
> > If this was bug, it should be in a separate patch with test cases added.
> Sorry that the previous patch did not include more context.  Pun intended.  Now you can scroll up and see that the context was just initialized, so `InTemplateArgument` starts being false, so it didn't matter whether the original code was `InTemplateArgument = ...;` or `if (...) InTemplateArgument = true;`.
Got it. Thanks.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121907/new/

https://reviews.llvm.org/D121907



More information about the cfe-commits mailing list