]> granicus.if.org Git - clang/commitdiff
Clean up a string comparison with StringRef. Suggestion by David Majnemer.
authorRichard Trieu <rtrieu@google.com>
Sat, 17 Jan 2015 00:56:10 +0000 (00:56 +0000)
committerRichard Trieu <rtrieu@google.com>
Sat, 17 Jan 2015 00:56:10 +0000 (00:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@226359 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Diagnostic.cpp

index 83228ad3c55d90e8c2026402fa347c347e6572db..67504388b2807e551d5ffda9e421fea76648ffbc 100644 (file)
@@ -633,7 +633,8 @@ FormatDiagnostic(const char *DiagStr, const char *DiagEnd,
   // When the diagnostic string is only "%0", the entire string is being given
   // by an outside source.  Remove unprintable characters from this string
   // and skip all the other string processing.
-  if (DiagEnd - DiagStr == 2 && DiagStr[0] == '%' && DiagStr[1] == '0' &&
+  if (DiagEnd - DiagStr == 2 &&
+      StringRef(DiagStr, DiagEnd - DiagStr).equals("%0") &&
       getArgKind(0) == DiagnosticsEngine::ak_std_string) {
     const std::string &S = getArgStdStr(0);
     for (char c : S) {