[compiler-rt] 3f7d0e7 - [NFC][compiler-rt][test] Fully qualify string -> std::string

Jordan Rupprecht via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 19 09:02:00 PST 2020


Author: Jordan Rupprecht
Date: 2020-02-19T08:59:26-08:00
New Revision: 3f7d0e7e319486fa9ca29896eb35bb2bd60733d2

URL: https://github.com/llvm/llvm-project/commit/3f7d0e7e319486fa9ca29896eb35bb2bd60733d2
DIFF: https://github.com/llvm/llvm-project/commit/3f7d0e7e319486fa9ca29896eb35bb2bd60733d2.diff

LOG: [NFC][compiler-rt][test] Fully qualify string -> std::string

Added: 
    

Modified: 
    compiler-rt/lib/asan/tests/asan_str_test.cpp
    compiler-rt/lib/asan/tests/asan_test.cpp
    compiler-rt/lib/asan/tests/asan_test_utils.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/tests/asan_str_test.cpp b/compiler-rt/lib/asan/tests/asan_str_test.cpp
index 33a38a81567f..12b8e5a5e671 100644
--- a/compiler-rt/lib/asan/tests/asan_str_test.cpp
+++ b/compiler-rt/lib/asan/tests/asan_str_test.cpp
@@ -39,12 +39,12 @@ enum class OOBKind {
   Global,
 };
 
-string LeftOOBReadMessage(OOBKind oob_kind, int oob_distance) {
+std::string LeftOOBReadMessage(OOBKind oob_kind, int oob_distance) {
   return oob_kind == OOBKind::Stack ? kStackReadUnderflow
                                     : ::LeftOOBReadMessage(oob_distance);
 }
 
-string RightOOBReadMessage(OOBKind oob_kind, int oob_distance) {
+std::string RightOOBReadMessage(OOBKind oob_kind, int oob_distance) {
   return oob_kind == OOBKind::Stack ? kStackReadOverflow
                                     : ::RightOOBReadMessage(oob_distance);
 }
@@ -480,7 +480,7 @@ TEST(AddressSanitizer, StrNCatOOBTest) {
   free(from);
 }
 
-static string OverlapErrorMessage(const string &func) {
+static std::string OverlapErrorMessage(const std::string &func) {
   return func + "-param-overlap";
 }
 

diff  --git a/compiler-rt/lib/asan/tests/asan_test.cpp b/compiler-rt/lib/asan/tests/asan_test.cpp
index eb3ded3acc0e..edc98ed18520 100644
--- a/compiler-rt/lib/asan/tests/asan_test.cpp
+++ b/compiler-rt/lib/asan/tests/asan_test.cpp
@@ -739,7 +739,7 @@ TEST(AddressSanitizer, Store128Test) {
 #endif
 
 // FIXME: All tests that use this function should be turned into lit tests.
-string RightOOBErrorMessage(int oob_distance, bool is_write) {
+std::string RightOOBErrorMessage(int oob_distance, bool is_write) {
   assert(oob_distance >= 0);
   char expected_str[100];
   sprintf(expected_str, ASAN_PCRE_DOTALL
@@ -751,19 +751,19 @@ string RightOOBErrorMessage(int oob_distance, bool is_write) {
           is_write ? "WRITE" : "READ",
 #endif
           oob_distance);
-  return string(expected_str);
+  return std::string(expected_str);
 }
 
-string RightOOBWriteMessage(int oob_distance) {
+std::string RightOOBWriteMessage(int oob_distance) {
   return RightOOBErrorMessage(oob_distance, /*is_write*/true);
 }
 
-string RightOOBReadMessage(int oob_distance) {
+std::string RightOOBReadMessage(int oob_distance) {
   return RightOOBErrorMessage(oob_distance, /*is_write*/false);
 }
 
 // FIXME: All tests that use this function should be turned into lit tests.
-string LeftOOBErrorMessage(int oob_distance, bool is_write) {
+std::string LeftOOBErrorMessage(int oob_distance, bool is_write) {
   assert(oob_distance > 0);
   char expected_str[100];
   sprintf(expected_str,
@@ -775,22 +775,22 @@ string LeftOOBErrorMessage(int oob_distance, bool is_write) {
           is_write ? "WRITE" : "READ",
 #endif
           oob_distance);
-  return string(expected_str);
+  return std::string(expected_str);
 }
 
-string LeftOOBWriteMessage(int oob_distance) {
+std::string LeftOOBWriteMessage(int oob_distance) {
   return LeftOOBErrorMessage(oob_distance, /*is_write*/true);
 }
 
-string LeftOOBReadMessage(int oob_distance) {
+std::string LeftOOBReadMessage(int oob_distance) {
   return LeftOOBErrorMessage(oob_distance, /*is_write*/false);
 }
 
-string LeftOOBAccessMessage(int oob_distance) {
+std::string LeftOOBAccessMessage(int oob_distance) {
   assert(oob_distance > 0);
   char expected_str[100];
   sprintf(expected_str, "located %d bytes to the left", oob_distance);
-  return string(expected_str);
+  return std::string(expected_str);
 }
 
 char* MallocAndMemsetString(size_t size, char ch) {
@@ -1199,11 +1199,11 @@ TEST(AddressSanitizer, AttributeNoSanitizeAddressTest) {
 #if !defined(__ANDROID__) && \
     !defined(__APPLE__) && \
     !defined(_WIN32)
-static string MismatchStr(const string &str) {
-  return string("AddressSanitizer: alloc-dealloc-mismatch \\(") + str;
+static std::string MismatchStr(const std::string &str) {
+  return std::string("AddressSanitizer: alloc-dealloc-mismatch \\(") + str;
 }
 
-static string MismatchOrNewDeleteTypeStr(const string &mismatch_str) {
+static std::string MismatchOrNewDeleteTypeStr(const std::string &mismatch_str) {
   return "(" + MismatchStr(mismatch_str) +
          ")|(AddressSanitizer: new-delete-type-mismatch)";
 }

diff  --git a/compiler-rt/lib/asan/tests/asan_test_utils.h b/compiler-rt/lib/asan/tests/asan_test_utils.h
index 2ab44855a491..e619ca3d5967 100644
--- a/compiler-rt/lib/asan/tests/asan_test_utils.h
+++ b/compiler-rt/lib/asan/tests/asan_test_utils.h
@@ -73,13 +73,13 @@ NOINLINE void asan_write(T *a) {
   *a = 0;
 }
 
-string RightOOBErrorMessage(int oob_distance, bool is_write);
-string RightOOBWriteMessage(int oob_distance);
-string RightOOBReadMessage(int oob_distance);
-string LeftOOBErrorMessage(int oob_distance, bool is_write);
-string LeftOOBWriteMessage(int oob_distance);
-string LeftOOBReadMessage(int oob_distance);
-string LeftOOBAccessMessage(int oob_distance);
+std::string RightOOBErrorMessage(int oob_distance, bool is_write);
+std::string RightOOBWriteMessage(int oob_distance);
+std::string RightOOBReadMessage(int oob_distance);
+std::string LeftOOBErrorMessage(int oob_distance, bool is_write);
+std::string LeftOOBWriteMessage(int oob_distance);
+std::string LeftOOBReadMessage(int oob_distance);
+std::string LeftOOBAccessMessage(int oob_distance);
 char* MallocAndMemsetString(size_t size, char ch);
 char* MallocAndMemsetString(size_t size);
 


        


More information about the llvm-commits mailing list