Simplify users of StringRef::{l,r}trim (clang) (NFC)
authorVedant Kumar <vsk@apple.com>
Tue, 16 Feb 2016 02:14:44 +0000 (02:14 +0000)
committerVedant Kumar <vsk@apple.com>
Tue, 16 Feb 2016 02:14:44 +0000 (02:14 +0000)
r260925 introduced a version of the *trim methods which is preferable
when trimming a single kind of character. Update all users in clang.

llvm-svn: 260927

clang/lib/Lex/PPDirectives.cpp
clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp
clang/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp

index cbb079c..645d090 100644 (file)
@@ -1226,7 +1226,7 @@ void Preprocessor::HandleUserDiagnosticDirective(Token &Tok,
 
   // Find the first non-whitespace character, so that we can make the
   // diagnostic more succinct.
-  StringRef Msg = StringRef(Message).ltrim(" ");
+  StringRef Msg = StringRef(Message).ltrim(' ');
 
   if (isWarning)
     Diag(Tok, diag::pp_hash_warning) << Msg;
index 504b8b3..a25f3e0 100644 (file)
@@ -1000,7 +1000,7 @@ void EmptyLocalizationContextChecker::MethodCrawler::VisitObjCMessageExpr(
     return;
 
   StringRef Comment =
-      StringRef(Result.getLiteralData(), Result.getLength()).trim("\"");
+      StringRef(Result.getLiteralData(), Result.getLength()).trim('"');
 
   if ((Comment.trim().size() == 0 && Comment.size() > 0) || // Is Whitespace
       Comment.empty()) {
index 4cbe97b..c038a26 100644 (file)
@@ -75,7 +75,7 @@ void MacOSXAPIChecker::CheckDispatchOnce(CheckerContext &C, const CallExpr *CE,
   // _dispatch_once is then a function which then calls the real dispatch_once.
   // Users do not care; they just want the warning at the top-level call.
   if (CE->getLocStart().isMacroID()) {
-    StringRef TrimmedFName = FName.ltrim("_");
+    StringRef TrimmedFName = FName.ltrim('_');
     if (TrimmedFName != FName)
       FName = TrimmedFName;
   }