[compiler-rt] 98687aa - [NFC] run clang-format on hwasan use-after-scope tests.

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 20 02:26:38 PDT 2021


Author: Florian Mayer
Date: 2021-07-20T10:26:26+01:00
New Revision: 98687aa0d61b11b102acbfd7d2dab0ad1c54d91e

URL: https://github.com/llvm/llvm-project/commit/98687aa0d61b11b102acbfd7d2dab0ad1c54d91e
DIFF: https://github.com/llvm/llvm-project/commit/98687aa0d61b11b102acbfd7d2dab0ad1c54d91e.diff

LOG: [NFC] run clang-format on hwasan use-after-scope tests.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D106259

Added: 
    

Modified: 
    compiler-rt/test/hwasan/TestCases/use-after-scope-capture.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-dtor-order.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-goto.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-if.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-inlined.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-loop-bug.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-loop-removed.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-loop.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-temp.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-temp2.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope-types.cpp
    compiler-rt/test/hwasan/TestCases/use-after-scope.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-capture.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-capture.cpp
index 916d0cd97cc52..de602f070cf85 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-capture.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-capture.cpp
@@ -11,10 +11,10 @@ int main() {
   {
     int x = 0;
     f = [&x]() __attribute__((noinline)) {
-      return x;  // BOOM
+      return x; // BOOM
       // CHECK: ERROR: AddressSanitizer: stack-use-after-scope
       // CHECK: #0 0x{{.*}} in {{.*}}use-after-scope-capture.cpp:[[@LINE-2]]
     };
   }
-  return f();  // BOOM
+  return f(); // BOOM
 }

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-dtor-order.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-dtor-order.cpp
index ff89bf3734de2..41d419a844587 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-dtor-order.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-dtor-order.cpp
@@ -7,9 +7,9 @@
 #include <stdio.h>
 
 struct IntHolder {
-  explicit IntHolder(int *val = 0) : val_(val) { }
+  explicit IntHolder(int *val = 0) : val_(val) {}
   __attribute__((noinline)) ~IntHolder() {
-    printf("Value: %d\n", *val_);  // BOOM
+    printf("Value: %d\n", *val_); // BOOM
     // CHECK: ERROR: AddressSanitizer: stack-use-after-scope
     // CHECK:  #0 0x{{.*}} in IntHolder::~IntHolder{{.*}}.cpp:[[@LINE-2]]
   }

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-goto.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-goto.cpp
index 148d02e03f905..37d6732ef1463 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-goto.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-goto.cpp
@@ -15,7 +15,7 @@ void f1(int cond) {
     goto label;
   int tmp;
 
- label:
+label:
   ptr = &tmp;
   *ptr = 5;
 }
@@ -45,7 +45,7 @@ void f3(int cond) {
 
     exit(0);
   }
- l2:
+l2:
   goto l1;
 }
 
@@ -59,11 +59,11 @@ void use(int *x) {
 void f4() {
   {
     int x;
- l2:
+  l2:
     use(&x);
     goto l1;
   }
- l1:
+l1:
   goto l2;
 }
 

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-if.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-if.cpp
index 7fd1602321e1c..916b8de62762d 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-if.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-if.cpp
@@ -10,9 +10,9 @@ bool b = true;
 int main() {
   if (b) {
     int x[5];
-    p = x+1;
+    p = x + 1;
   }
-  return *p;  // BOOM
+  return *p; // BOOM
   // CHECK: ERROR: AddressSanitizer: stack-use-after-scope
   // CHECK:  #0 0x{{.*}} in main {{.*}}.cpp:[[@LINE-2]]
 }

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-inlined.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-inlined.cpp
index fdc4bde559393..0ce8d2f9c0695 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-inlined.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-inlined.cpp
@@ -10,16 +10,16 @@
 
 int *arr;
 
-__attribute__((always_inline))
-void inlined(int arg) {
+__attribute__((always_inline)) void inlined(int arg) {
   int x[5];
-  for (int i = 0; i < arg; i++) x[i] = i;
+  for (int i = 0; i < arg; i++)
+    x[i] = i;
   arr = x;
 }
 
 int main(int argc, char *argv[]) {
   inlined(argc);
-  return arr[argc - 1];  // BOOM
+  return arr[argc - 1]; // BOOM
   // CHECK: ERROR: AddressSanitizer: stack-use-after-scope
   // CHECK: READ of size 4 at 0x{{.*}} thread T0
   // CHECK:   #0 0x{{.*}} in main

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-loop-bug.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-loop-bug.cpp
index 213c68d3fb7d5..2392230811f4f 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-loop-bug.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-loop-bug.cpp
@@ -12,7 +12,7 @@ int main() {
     int x[3] = {i, i, i};
     p = x + i;
   }
-  return *p;  // BOOM
+  return *p; // BOOM
   // CHECK: ERROR: AddressSanitizer: stack-use-after-scope
   // CHECK:  #0 0x{{.*}} in main {{.*}}use-after-scope-loop-bug.cpp:[[@LINE-2]]
   // CHECK: Address 0x{{.*}} is located in stack of thread T{{.*}} at offset [[OFFSET:[^ ]+]] in frame

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-loop-removed.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-loop-removed.cpp
index 0df9101b86077..708f17aeab344 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-loop-removed.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-loop-removed.cpp
@@ -13,7 +13,7 @@ int main() {
     int x;
     p = &x;
   }
-  return *p;  // BOOM
+  return *p; // BOOM
   // CHECK: ERROR: AddressSanitizer: stack-use-after-scope
   // CHECK:  #0 0x{{.*}} in main {{.*}}use-after-scope-loop-removed.cpp:[[@LINE-2]]
   // CHECK: Address 0x{{.*}} is located in stack of thread T{{.*}} at offset [[OFFSET:[^ ]+]] in frame

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-loop.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-loop.cpp
index 7048ce3aa1887..6f3d404e919b7 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-loop.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-loop.cpp
@@ -11,7 +11,7 @@ int main() {
     int x;
     p[i] = &x;
   }
-  return **p;  // BOOM
+  return **p; // BOOM
   // CHECK: ERROR: AddressSanitizer: stack-use-after-scope
   // CHECK: #0 0x{{.*}} in main {{.*}}.cpp:[[@LINE-2]]
 }

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-temp.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-temp.cpp
index 8f5b6647437ea..39fec6b29f693 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-temp.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-temp.cpp
@@ -4,7 +4,6 @@
 // Not expected to work yet with HWAsan.
 // XFAIL: *
 
-
 struct IntHolder {
   int val;
 };
@@ -17,7 +16,7 @@ __attribute__((noinline)) void save(const IntHolder &holder) {
 
 int main(int argc, char *argv[]) {
   save({argc});
-  int x = saved->val;  // BOOM
+  int x = saved->val; // BOOM
   // CHECK: ERROR: AddressSanitizer: stack-use-after-scope
   // CHECK:  #0 0x{{.*}} in main {{.*}}use-after-scope-temp.cpp:[[@LINE-2]]
   return x;

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-temp2.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-temp2.cpp
index d5e9bc0da1bf4..93f8bfe2a999a 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-temp2.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-temp2.cpp
@@ -4,7 +4,6 @@
 // Not expected to work yet with HWAsan.
 // XFAIL: *
 
-
 struct IntHolder {
   __attribute__((noinline)) const IntHolder &Self() const {
     return *this;
@@ -16,7 +15,7 @@ const IntHolder *saved;
 
 int main(int argc, char *argv[]) {
   saved = &IntHolder().Self();
-  int x = saved->val;  // BOOM
+  int x = saved->val; // BOOM
   // CHECK: ERROR: AddressSanitizer: stack-use-after-scope
   // CHECK:  #0 0x{{.*}} in main {{.*}}use-after-scope-temp2.cpp:[[@LINE-2]]
   return x;

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope-types.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope-types.cpp
index 26b617d7f372a..2800178b87abe 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope-types.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope-types.cpp
@@ -18,7 +18,8 @@
 #include <string>
 #include <vector>
 
-template <class T> struct Ptr {
+template <class T>
+struct Ptr {
   void Store(T *ptr) { t = ptr; }
 
   void Access() { *t = {}; }
@@ -26,7 +27,8 @@ template <class T> struct Ptr {
   T *t;
 };
 
-template <class T, size_t N> struct Ptr<T[N]> {
+template <class T, size_t N>
+struct Ptr<T[N]> {
   using Type = T[N];
   void Store(Type *ptr) { t = *ptr; }
 
@@ -35,7 +37,8 @@ template <class T, size_t N> struct Ptr<T[N]> {
   T *t;
 };
 
-template <class T> __attribute__((noinline)) void test() {
+template <class T>
+__attribute__((noinline)) void test() {
   Ptr<T> ptr;
   {
     T x;
@@ -52,17 +55,17 @@ template <class T> __attribute__((noinline)) void test() {
 int main(int argc, char **argv) {
   using Tests = void (*)();
   Tests tests[] = {
-    &test<bool>,
-    &test<char>,
-    &test<int>,
-    &test<double>,
-    &test<float>,
-    &test<void*>,
-    &test<std::vector<std::string>>,
-    &test<int[3]>,
-    &test<int[1000]>,
-    &test<char[3]>,
-    &test<char[1000]>,
+      &test<bool>,
+      &test<char>,
+      &test<int>,
+      &test<double>,
+      &test<float>,
+      &test<void *>,
+      &test<std::vector<std::string>>,
+      &test<int[3]>,
+      &test<int[1000]>,
+      &test<char[3]>,
+      &test<char[1000]>,
   };
 
   int n = atoi(argv[1]);

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-scope.cpp b/compiler-rt/test/hwasan/TestCases/use-after-scope.cpp
index 6fc3185b89bfd..67e1b8bf0c8d4 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-scope.cpp
+++ b/compiler-rt/test/hwasan/TestCases/use-after-scope.cpp
@@ -15,7 +15,7 @@ int main() {
     int x = 0;
     p = &x;
   }
-  *p = 5;  // BOOM
+  *p = 5; // BOOM
   // CHECK: ERROR: AddressSanitizer: stack-use-after-scope
   // CHECK:  #0 0x{{.*}} in main {{.*}}use-after-scope.cpp:[[@LINE-2]]
   // CHECK: Address 0x{{.*}} is located in stack of thread T{{.*}} at offset [[OFFSET:[^ ]+]] in frame


        


More information about the llvm-commits mailing list