[compiler-rt] [llvm] [ASan][compiler-rt] Implemented Dormant Mode in ASan (PR #99857)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 12:44:40 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 8107810cad24d41fe43c6777370c7b81ca83ad84 86205e3e453dd4d54b3bd7852e12aa9189d9c888 --extensions inc,h,cpp -- compiler-rt/test/asan/TestCases/dormant.cpp compiler-rt/include/sanitizer/asan_interface.h compiler-rt/lib/asan/asan_interface.inc compiler-rt/lib/asan/asan_interface_internal.h compiler-rt/lib/asan/asan_rtl.cpp llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
``````````

</details>

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

``````````diff
diff --git a/compiler-rt/test/asan/TestCases/dormant.cpp b/compiler-rt/test/asan/TestCases/dormant.cpp
index 5efa2f9836..04c0c140b2 100644
--- a/compiler-rt/test/asan/TestCases/dormant.cpp
+++ b/compiler-rt/test/asan/TestCases/dormant.cpp
@@ -3,14 +3,14 @@
 // REQUIRES: stable-runtime
 
 #include <sanitizer/asan_interface.h>
-int readHeapAfterFree(){
-  int * volatile x = new int[10];
+int readHeapAfterFree() {
+  int *volatile x = new int[10];
   delete[] x;
   return x[5];
 }
 
-static int * volatile y;
-int writeHeapAfterFree(){
+static int *volatile y;
+int writeHeapAfterFree() {
   y = new int[10];
   delete[] y;
   return y[5] = 413;
diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 3665930f9c..a34ec2e82d 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -1742,9 +1742,9 @@ void AddressSanitizer::instrumentMop(ObjectSizeOffsetVisitor &ObjSizeVis,
     NumInstrumentedWrites++;
   else
     NumInstrumentedReads++;
-  
-  Instruction* InsertPoint = O.getInsn();
-  if(CLAsanDormant){
+
+  Instruction *InsertPoint = O.getInsn();
+  if (CLAsanDormant) {
     InstrumentationIRBuilder IRB(InsertPoint);
     InsertPoint = SplitBlockAndInsertIfThen(
         IRB.CreateNot(IRB.CreateLoad(IRB.getInt1Ty(), DormantAsanFlag)),

``````````

</details>


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


More information about the llvm-commits mailing list