[PATCH] D39538: [llvm-ar] Support an options string that start with a dash

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 3 12:41:36 PDT 2017


ruiu added inline comments.


================
Comment at: tools/llvm-ar/llvm-ar.cpp:892-893
+    // that start with a dash.
+    if (argv[i][0] == '-' &&
+        strspn(&argv[i][1], OptionChars) + 1 == strlen(argv[i])) {
+      argv[i]++;
----------------
If you are going to use StringRef, then something like this is probably better than using stdlib's string functions.

  StringRef S = argv[i];
  if (S.startswith("-") && S.find_first_of("dmpqrtxabiosSTucv") == StringRef::npos)


https://reviews.llvm.org/D39538





More information about the llvm-commits mailing list