diff --git a/llvm/lib/ObjCopy/CommonConfig.cpp b/llvm/lib/ObjCopy/CommonConfig.cpp index f44e70d996b2e..ff3cb4d44c126 100644 --- a/llvm/lib/ObjCopy/CommonConfig.cpp +++ b/llvm/lib/ObjCopy/CommonConfig.cpp @@ -20,11 +20,7 @@ NameOrPattern::create(StringRef Pattern, MatchStyle MS, return NameOrPattern(Pattern); case MatchStyle::Wildcard: { SmallVector Data; - bool IsPositiveMatch = true; - if (Pattern[0] == '!') { - IsPositiveMatch = false; - Pattern = Pattern.drop_front(); - } + bool IsPositiveMatch = !Pattern.consume_front("!"); Expected GlobOrErr = GlobPattern::create(Pattern); // If we couldn't create it as a glob, report the error, but try again