[compiler-rt] [compiler-rt][xray] porting to sunos platforms. (PR #90362)

via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 27 14:42:30 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff ff03f23be8bc6df701efd9e1093779fbcf382d87 3d4670784bae759e4517a88ec73d4ef3e03efe28 -- compiler-rt/lib/xray/xray_x86_64.cpp compiler-rt/test/xray/TestCases/Posix/fork_basic_logging.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/compiler-rt/lib/xray/xray_x86_64.cpp b/compiler-rt/lib/xray/xray_x86_64.cpp
index 6ae93426c6..a8b59b8a2e 100644
--- a/compiler-rt/lib/xray/xray_x86_64.cpp
+++ b/compiler-rt/lib/xray/xray_x86_64.cpp
@@ -105,33 +105,34 @@ uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT {
 }
 #elif SANITIZER_SOLARIS
 uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT {
-    kstat_named_t *nm;
-    kstat_ctl_t *ctl;
-    kstat_t *s;
-    uint64_t TSCFrequency;
+  kstat_named_t *nm;
+  kstat_ctl_t *ctl;
+  kstat_t *s;
+  uint64_t TSCFrequency;
 
-    ctl = kstat_open();
-    if (!ctl) {
-      return 0;
-    }
-    s = kstat_lookup(ctl, "cpu_info", 0, NULL);
-    if (!s) {
-      kstat_close(ctl);
-      return 0;
-    }
+  ctl = kstat_open();
+  if (!ctl) {
+    return 0;
+  }
+  s = kstat_lookup(ctl, "cpu_info", 0, NULL);
+  if (!s) {
+    kstat_close(ctl);
+    return 0;
+  }
 
-    if (kstat_read(ctl, s, NULL) == -1) {
-      kstat_close(ctl);
-      return 0;
-    }
+  if (kstat_read(ctl, s, NULL) == -1) {
+    kstat_close(ctl);
+    return 0;
+  }
 
-    nm = reinterpret_cast<kstat_named_t *>(kstat_data_lookup(s, "clock_MHz"));
+  nm = reinterpret_cast<kstat_named_t *>(kstat_data_lookup(s, "clock_MHz"));
 
-    auto clock = nm->data_type == KSTAT_DATA_INT32 ? nm->value.i32 : nm->value.i64;
-    TSCFrequency = static_cast<uint64_t>(clock) * 1000000;
-    kstat_close(ctl);
+  auto clock =
+      nm->data_type == KSTAT_DATA_INT32 ? nm->value.i32 : nm->value.i64;
+  TSCFrequency = static_cast<uint64_t>(clock) * 1000000;
+  kstat_close(ctl);
 
-    return TSCFrequency;
+  return TSCFrequency;
 }
 #elif !SANITIZER_FUCHSIA
 uint64_t getTSCFrequency() XRAY_NEVER_INSTRUMENT {

``````````

</details>


https://github.com/llvm/llvm-project/pull/90362


More information about the llvm-commits mailing list