[compiler-rt] 09e0d71 - [ubsan] Drop terminal "in " from reports without functions (#77163)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 17:05:35 PST 2024


Author: Vitaly Buka
Date: 2024-01-05T17:05:25-08:00
New Revision: 09e0d71ad34169e075e146e13a93b2d79f992e1d

URL: https://github.com/llvm/llvm-project/commit/09e0d71ad34169e075e146e13a93b2d79f992e1d
DIFF: https://github.com/llvm/llvm-project/commit/09e0d71ad34169e075e146e13a93b2d79f992e1d.diff

LOG: [ubsan] Drop terminal "in " from reports without functions (#77163)

Added: 
    

Modified: 
    compiler-rt/lib/ubsan/ubsan_diag.cpp
    compiler-rt/test/ubsan/TestCases/Misc/print_summary.c

Removed: 
    


################################################################################
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];


        


More information about the llvm-commits mailing list