[lldb-dev] [PATCH] Fix boolean typo

Michael McConville via lldb-dev lldb-dev at lists.llvm.org
Sun Dec 24 12:53:39 PST 2017


In its current form, the below condition always evaluates to true. It seems
like the author meant to use "&&" rather than "||". Someone more familiar with
the code should verify this.

Thanks for your time,
Michael McConville
University of Utah

Index: Module.cpp
===================================================================
--- Module.cpp	(revision 321430)
+++ Module.cpp	(working copy)
@@ -1113,7 +1113,7 @@
     const int format_len = strlen(format);
     if (format_len > 0) {
       const char last_char = format[format_len - 1];
-      if (last_char != '\n' || last_char != '\r')
+      if (last_char == '\n' || last_char == '\r')
         strm.EOL();
     }
     Host::SystemLog(Host::eSystemLogError, "%s", strm.GetData());
@@ -1145,7 +1145,7 @@
         const int format_len = strlen(format);
         if (format_len > 0) {
           const char last_char = format[format_len - 1];
-          if (last_char != '\n' || last_char != '\r')
+          if (last_char == '\n' || last_char == '\r')
             strm.EOL();
         }
         strm.PutCString("The debug session should be aborted as the original "
@@ -1171,7 +1171,7 @@
     const int format_len = strlen(format);
     if (format_len > 0) {
       const char last_char = format[format_len - 1];
-      if (last_char != '\n' || last_char != '\r')
+      if (last_char == '\n' || last_char == '\r')
         strm.EOL();
     }
     Host::SystemLog(Host::eSystemLogWarning, "%s", strm.GetData());


More information about the lldb-dev mailing list