[llvm-branch-commits] [compiler-rt] [ubsan] Drop terminal "in " from reports without functions (PR #77163)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jan 5 16:53:02 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Vitaly Buka (vitalybuka)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/77163.diff


2 Files Affected:

- (modified) compiler-rt/lib/ubsan/ubsan_diag.cpp (+1-1) 
- (modified) compiler-rt/test/ubsan/TestCases/Misc/print_summary.c (+2-2) 


``````````diff
diff --git a/compiler-rt/lib/ubsan/ubsan_diag.cpp b/compiler-rt/lib/ubsan/ubsan_diag.cpp
index aac27041531851..67e884e4916c50 100644
--- a/compiler-rt/lib/ubsan/ubsan_diag.cpp
+++ b/compiler-rt/lib/ubsan/ubsan_diag.cpp
@@ -88,7 +88,7 @@ static void MaybeReportErrorSummary(Location Loc, ErrorType Type) {
       AI.file = internal_strdup(SLoc.getFilename());
       AI.line = SLoc.getLine();
       AI.column = SLoc.getColumn();
-      AI.function = internal_strdup("");  // Avoid printing ?? as function name.
+      AI.function = nullptr;
       ReportErrorSummary(ErrorKind, AI, GetSanititizerToolName());
       AI.Clear();
       return;
diff --git a/compiler-rt/test/ubsan/TestCases/Misc/print_summary.c b/compiler-rt/test/ubsan/TestCases/Misc/print_summary.c
index b67a0614dd2f11..17885094b6ad76 100644
--- a/compiler-rt/test/ubsan/TestCases/Misc/print_summary.c
+++ b/compiler-rt/test/ubsan/TestCases/Misc/print_summary.c
@@ -2,8 +2,8 @@
 // RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT
 // RUN: %env_ubsan_opts=print_summary=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NO_SUMMARY
 
-// CHECK-DEFAULT: SUMMARY: UndefinedBehaviorSanitizer: {{.*}}
-// CHECK-NO_SUMMARY-NOT: SUMMARY: UndefinedBehaviorSanitizer: {{.*}}
+// CHECK-DEFAULT: SUMMARY: UndefinedBehaviorSanitizer: {{.*}}print_summary.c{{[:0-9 ]*$}}
+// CHECK-NO_SUMMARY-NOT: SUMMARY: UndefinedBehaviorSanitizer:
 
 int main(int argc, char **argv) {
   int arr[argc - 2];

``````````

</details>


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


More information about the llvm-branch-commits mailing list