[PATCH] D44831: [clang-format] Refine ObjC guesser to handle child lines of child lines

Ben Hamilton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 27 07:48:09 PDT 2018


benhamilton added inline comments.


================
Comment at: lib/Format/Format.cpp:1449
                           const AdditionalKeywords &Keywords) {
+    for (auto Line : AnnotatedLines)
+      if (LineContainsObjCCode(*Line, Keywords))
----------------
djasper wrote:
> I would not create a second function here. Just iterate over the tokens here and call guessIsObjC recursively with Line->Children. That means we need one less for loop overall, I think (I might be missing something).
Good call, done.

I don't know why I didn't do that first! For some reason, my brain thought `Line.Children` was an incompatible type..


================
Comment at: lib/Format/Format.cpp:1455
+
+  static bool LineContainsObjCCode(const AnnotatedLine &Line,
+                                   const AdditionalKeywords &Keywords) {
----------------
djasper wrote:
> Convention would be lineContainsObjCCode.
Removed.


Repository:
  rC Clang

https://reviews.llvm.org/D44831





More information about the cfe-commits mailing list