[PATCH] D35759: [Bash-autocompletion] Show HelpText with possible flags

Rui Ueyama via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 21 20:52:44 PDT 2017


ruiu added inline comments.


================
Comment at: clang/lib/Driver/Driver.cpp:1302
 
-    llvm::outs() << llvm::join(SuggestedCompletions, " ") << '\n';
+    llvm::outs() << llvm::join(SuggestedCompletions, "\n") << '\n';
     return false;
----------------
Now that the separator and the terminator are the same, there's no reason to use llvm::join. Since llvm::join creates a large temporary string, you want to avoid that if it is easily avoidable.

  for (StringRef S : SuggestedCompletions)
    llvm::outs << S << "\n";

If you do this, you might be able to remove StringExtras.h from this file?


================
Comment at: llvm/lib/Option/OptTable.cpp:240
       if (StringRef(S).startswith(Cur))
-        Ret.push_back(S);
+        Ret.push_back(S + "\t" + std::string(StringRef(In.HelpText)));
     }
----------------
I believe

  Ret.push_back(S + "\t" + In.HelpText);

should just work.


https://reviews.llvm.org/D35759





More information about the cfe-commits mailing list