[PATCH] D33823: [clang-format] Support sorting using declarations

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 19 02:00:19 PDT 2017

klimek added inline comments.

Comment at: lib/Format/UsingDeclarationsSorter.cpp:41-42
+bool computeUsingDeclarationLabel(const FormatToken *UsingTok,
+                                  std::string *Label) {
+  assert(UsingTok && UsingTok->is(tok::kw_using) && "Expecting a using token");
Use either:
- an empty label to indicate that there is no more label, and thus we couldn't compute one
- use an llvm::ErrorOr as return value

Comment at: lib/Format/UsingDeclarationsSorter.cpp:59
+    Tok = Tok->Next;
+    if (Tok && Tok->is(tok::coloncolon)) {
+      Label->append("::");
I'd invert this if - the happy case is in the if here. That way, you also don't need a continue.


More information about the cfe-commits mailing list