r226359 - Clean up a string comparison with StringRef. Suggestion by David Majnemer.
Richard Trieu
rtrieu at google.com
Fri Jan 16 16:56:10 PST 2015
Author: rtrieu
Date: Fri Jan 16 18:56:10 2015
New Revision: 226359
URL: http://llvm.org/viewvc/llvm-project?rev=226359&view=rev
Log:
Clean up a string comparison with StringRef. Suggestion by David Majnemer.
Modified:
cfe/trunk/lib/Basic/Diagnostic.cpp
Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=226359&r1=226358&r2=226359&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Fri Jan 16 18:56:10 2015
@@ -633,7 +633,8 @@ FormatDiagnostic(const char *DiagStr, co
// 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) {
More information about the cfe-commits
mailing list