[clang] [compiler-rt] [lld] [llvm] [Coverage][WebAssembly] Add initial support for WebAssembly/WASI (PR #111332)

via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 6 20:02:41 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 e8f01b0557354a28d17bfe618df5e257ec3e982a ed504c7c7ff3b02a08c3d7465df793377934011f --extensions c,h,cpp -- clang/lib/Driver/ToolChains/WebAssembly.cpp compiler-rt/lib/profile/GCDAProfiling.c compiler-rt/lib/profile/InstrProfilingPlatformLinux.c compiler-rt/lib/profile/InstrProfilingPlatformOther.c compiler-rt/lib/profile/InstrProfilingPort.h compiler-rt/lib/profile/InstrProfilingUtil.c lld/wasm/InputChunks.h lld/wasm/InputFiles.cpp lld/wasm/OutputSections.cpp llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp llvm/lib/MC/MCContext.cpp llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp llvm/test/tools/llvm-cov/binary-formats.c
``````````

</details>

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

``````````diff
diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
index a9791eebab..02f23379ce 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
@@ -6,8 +6,8 @@
 |*
 \*===----------------------------------------------------------------------===*/
 
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \
-    (defined(__sun__) && defined(__svr4__)) || defined(__NetBSD__) || \
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__Fuchsia__) ||      \
+    (defined(__sun__) && defined(__svr4__)) || defined(__NetBSD__) ||          \
     defined(_AIX) || defined(__wasm__)
 
 #if !defined(_AIX) && !defined(__wasm__)
diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformOther.c b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
index e873e9ffbf..52e82273f8 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformOther.c
@@ -8,7 +8,8 @@
 
 #if !defined(__APPLE__) && !defined(__linux__) && !defined(__FreeBSD__) &&     \
     !defined(__Fuchsia__) && !(defined(__sun__) && defined(__svr4__)) &&       \
-    !defined(__NetBSD__) && !defined(_WIN32) && !defined(_AIX) && !defined(__wasm__)
+    !defined(__NetBSD__) && !defined(_WIN32) && !defined(_AIX) &&              \
+    !defined(__wasm__)
 
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
index 347578ad5f..dcbeb9f22a 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
@@ -1187,7 +1187,8 @@ loadBinaryFormat(std::unique_ptr<Binary> Bin, StringRef Arch,
   // because it doesn't have a good way to insert padding bytes.
   std::unique_ptr<MemoryBuffer> CoverageMappingBufferOwner;
   if (!isAddrAligned(Align(8), CoverageMapping.data())) {
-    CoverageMappingBufferOwner = MemoryBuffer::getMemBufferCopy(CoverageMapping);
+    CoverageMappingBufferOwner =
+        MemoryBuffer::getMemBufferCopy(CoverageMapping);
     CoverageMapping = CoverageMappingBufferOwner->getBuffer();
   }
 
diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
index b875f851a5..929c787442 100644
--- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -1408,7 +1408,8 @@ static bool needsRuntimeRegistrationOfSectionRange(const Triple &TT) {
   // compiler-rt uses linker support to get data/counters/name start/end for
   // ELF, COFF, Mach-O, XCOFF, and Wasm.
   if (TT.isOSBinFormatELF() || TT.isOSBinFormatCOFF() ||
-      TT.isOSBinFormatMachO() || TT.isOSBinFormatXCOFF() || TT.isOSBinFormatWasm())
+      TT.isOSBinFormatMachO() || TT.isOSBinFormatXCOFF() ||
+      TT.isOSBinFormatWasm())
     return false;
 
   return true;

``````````

</details>


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


More information about the cfe-commits mailing list