summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Diagnostic.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2015-01-17 00:56:10 +0000
committerRichard Trieu <rtrieu@google.com>2015-01-17 00:56:10 +0000
commitdcd7bb022a304de69161fe990b12e6341313a69e (patch)
treed3c9d162576f8bf46121981b7953eeec9dd3909d /clang/lib/Basic/Diagnostic.cpp
parent2996895f28518c08e1498959360752fa8ce41368 (diff)
downloadbcm5719-llvm-dcd7bb022a304de69161fe990b12e6341313a69e.tar.gz
bcm5719-llvm-dcd7bb022a304de69161fe990b12e6341313a69e.zip
Clean up a string comparison with StringRef. Suggestion by David Majnemer.
llvm-svn: 226359
Diffstat (limited to 'clang/lib/Basic/Diagnostic.cpp')
-rw-r--r--clang/lib/Basic/Diagnostic.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp
index 83228ad3c55..67504388b28 100644
--- a/clang/lib/Basic/Diagnostic.cpp
+++ b/clang/lib/Basic/Diagnostic.cpp
@@ -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) {
OpenPOWER on IntegriCloud