================
@@ -148,6 +160,24 @@ class AnnotatingParser {
     }
   }
 
+  const FormatStyle::FunctionDeclarationWithKeywords *
+  isInsideFunctionWithKeywordedParameters(const FormatToken &Token) const {
+    const FormatToken *Previous = &Token;
+    while (auto Prev = Previous->getPreviousNonComment())
+      Previous = Prev;
----------------
HazardyKnusperkeks wrote:

You are searching for the first token in the line, with a loop. But you already 
have an `AnnotatedLine` (called `Line`) at your disposal, which lets you access 
the 
[`First`](https://github.com/llvm/llvm-project/blob/bc646f4b302339717e363efa3e57ec3468d190aa/clang/lib/Format/TokenAnnotator.h#L172)
 token directly. That `Line` does not correspond to actual lines, but what 
clang-format thinks of as `UnwrappedLine`. This is independent of indentation 
and column limit.

For your use case this `Line` should be the whole `Q_PROPERTY` macro.

https://github.com/llvm/llvm-project/pull/131605
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to