[compiler-rt] r334900 - [sanitizer] Use const char* in internal_simple_strtoll

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 17 01:41:45 PDT 2018


Author: vitalybuka
Date: Sun Jun 17 01:41:45 2018
New Revision: 334900

URL: http://llvm.org/viewvc/llvm-project?rev=334900&view=rev
Log:
[sanitizer] Use const char* in internal_simple_strtoll

Modified:
    compiler-rt/trunk/lib/asan/asan_report.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_flag_parser.h
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc
    compiler-rt/trunk/lib/xray/xray_utils.cc
    compiler-rt/trunk/lib/xray/xray_x86_64.cc

Modified: compiler-rt/trunk/lib/asan/asan_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_report.cc?rev=334900&r1=334899&r2=334900&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_report.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_report.cc Sun Jun 17 01:41:45 2018
@@ -84,7 +84,7 @@ static void PrintZoneForPointer(uptr ptr
 bool ParseFrameDescription(const char *frame_descr,
                            InternalMmapVector<StackVarDescr> *vars) {
   CHECK(frame_descr);
-  char *p;
+  const char *p;
   // This string is created by the compiler and has the following form:
   // "n alloc_1 alloc_2 ... alloc_n"
   // where alloc_i looks like "offset size len ObjectName"

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_flag_parser.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_flag_parser.h?rev=334900&r1=334899&r2=334900&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flag_parser.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flag_parser.h Sun Jun 17 01:41:45 2018
@@ -81,7 +81,7 @@ inline bool FlagHandler<const char *>::P
 
 template <>
 inline bool FlagHandler<int>::Parse(const char *value) {
-  char *value_end;
+  const char *value_end;
   *t_ = internal_simple_strtoll(value, &value_end, 10);
   bool ok = *value_end == 0;
   if (!ok) Printf("ERROR: Invalid value for int option: '%s'\n", value);
@@ -90,7 +90,7 @@ inline bool FlagHandler<int>::Parse(cons
 
 template <>
 inline bool FlagHandler<uptr>::Parse(const char *value) {
-  char *value_end;
+  const char *value_end;
   *t_ = internal_simple_strtoll(value, &value_end, 10);
   bool ok = *value_end == 0;
   if (!ok) Printf("ERROR: Invalid value for uptr option: '%s'\n", value);

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc?rev=334900&r1=334899&r2=334900&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc Sun Jun 17 01:41:45 2018
@@ -215,7 +215,7 @@ char *internal_strstr(const char *haysta
   return nullptr;
 }
 
-s64 internal_simple_strtoll(const char *nptr, char **endptr, int base) {
+s64 internal_simple_strtoll(const char *nptr, const char **endptr, int base) {
   CHECK_EQ(base, 10);
   while (IsSpace(*nptr)) nptr++;
   int sgn = 1;

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h?rev=334900&r1=334899&r2=334900&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h Sun Jun 17 01:41:45 2018
@@ -49,7 +49,7 @@ uptr internal_strnlen(const char *s, upt
 char *internal_strrchr(const char *s, int c);
 char *internal_strstr(const char *haystack, const char *needle);
 // Works only for base=10 and doesn't set errno.
-s64 internal_simple_strtoll(const char *nptr, char **endptr, int base);
+s64 internal_simple_strtoll(const char *nptr, const char **endptr, int base);
 int internal_snprintf(char *buffer, uptr length, const char *format, ...);
 
 // Return true if all bytes in [mem, mem+size) are zero.

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc?rev=334900&r1=334899&r2=334900&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux_libcdep.cc Sun Jun 17 01:41:45 2018
@@ -236,7 +236,7 @@ uptr ThreadDescriptorSize() {
   char buf[64];
   uptr len = confstr(_CS_GNU_LIBC_VERSION, buf, sizeof(buf));
   if (len < sizeof(buf) && internal_strncmp(buf, "glibc 2.", 8) == 0) {
-    char *end;
+    const char *end;
     int minor = internal_simple_strtoll(buf + 8, &end, 10);
     if (end != buf + 8 && (*end == '\0' || *end == '.' || *end == '-')) {
       int patch = 0;

Modified: compiler-rt/trunk/lib/xray/xray_utils.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_utils.cc?rev=334900&r1=334899&r2=334900&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_utils.cc (original)
+++ compiler-rt/trunk/lib/xray/xray_utils.cc Sun Jun 17 01:41:45 2018
@@ -82,7 +82,7 @@ bool readValueFromFile(const char *Filen
   if (!Success)
     return false;
   close(Fd);
-  char *End = nullptr;
+  const char *End = nullptr;
   long long Tmp = internal_simple_strtoll(Line, &End, 10);
   bool Result = false;
   if (Line[0] != '\0' && (*End == '\n' || *End == '\0')) {

Modified: compiler-rt/trunk/lib/xray/xray_x86_64.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_x86_64.cc?rev=334900&r1=334899&r2=334900&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/xray_x86_64.cc (original)
+++ compiler-rt/trunk/lib/xray/xray_x86_64.cc Sun Jun 17 01:41:45 2018
@@ -57,7 +57,7 @@ static bool readValueFromFile(const char
   close(Fd);
   if (!Success)
     return false;
-  char *End = nullptr;
+  const char *End = nullptr;
   long long Tmp = internal_simple_strtoll(Line, &End, 10);
   bool Result = false;
   if (Line[0] != '\0' && (*End == '\n' || *End == '\0')) {




More information about the llvm-commits mailing list