[PATCH] D41590: Improve performance TokenizeWindowsCommandLine

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 26 23:28:26 PST 2017


ruiu added inline comments.


================
Comment at: llvm/lib/Support/CommandLine.cpp:692
+static bool isWhitespace(char C) {
+  switch(C) {
+    case ' ':
----------------
I'd ignore formfeed and vertical tab, and write like this

  return C == ' ' || C = '\t' || C = '\r' || C = '\n';


================
Comment at: llvm/lib/Support/CommandLine.cpp:711
   for (size_t I = 0, E = Src.size(); I != E; ++I) {
     // Consume runs of whitespace.
     if (Token.empty()) {
----------------
Please also make the same change for this function.


================
Comment at: llvm/lib/Support/CommandLine.cpp:812
   for (size_t I = 0, E = Src.size(); I != E; ++I) {
+    // Avoid multiple assert in operator[].
+    char C = Src[I];
----------------
I don't think you need this comment.


https://reviews.llvm.org/D41590





More information about the llvm-commits mailing list