[PATCH] D20798: clang-format: [JS] Sort imported symbols.

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Tue May 31 22:26:46 PDT 2016


djasper accepted this revision.
This revision is now accepted and ready to land.

================
Comment at: lib/Format/SortJavaScriptImports.cpp:248
@@ +247,3 @@
+    // ... then the references in order ...
+    for (JsImportedSymbol *I = Symbols.begin(), *E = Symbols.end(); I != E;) {
+      Buffer += getSourceText(I->Range);
----------------
It's an implementation detail that the iterator of a SmallVector is a JsImportedSymbol*. Use auto. Also, I find this more readable:

  for (auto I = Symbols.begin(), E = Symbols.end(); I != E; ++I) {
    if (I != Symbols.begin())
      Buffer += ",";
    Buffer += getSourceText(I->Range);
  }


http://reviews.llvm.org/D20798





More information about the cfe-commits mailing list