Use StringRef, rather than C string APIs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137958 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 295ab32..ca8b7d4 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -2448,18 +2448,19 @@
void darwin::CC1::RemoveCC1UnsupportedArgs(ArgStringList &CmdArgs) const {
for (ArgStringList::iterator it = CmdArgs.begin(), ie = CmdArgs.end();
it != ie;) {
- const char *Option = *it;
+
+ StringRef Option = *it;
// We only remove warning options.
- if (strncmp(Option, "-W", 2)) {
+ if (!Option.startswith("-W")) {
++it;
continue;
}
- if (strncmp(Option, "-Wno-", 5))
- Option = &Option[2];
+ if (Option.startswith("-Wno-"))
+ Option = Option.substr(5);
else
- Option = &Option[5];
+ Option = Option.substr(2);
bool RemoveOption = llvm::StringSwitch<bool>(Option)
.Case("address-of-temporary", true)