[llvm] [compiler-rt] [libunwind] [libc] [libcxx] [clang] [NFC][tsan] Move SkipInternalFrames into sanitizer_common (PR #77146)

Vitaly Buka via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 5 16:52:28 PST 2024


https://github.com/vitalybuka updated https://github.com/llvm/llvm-project/pull/77146

>From 250c84b0b0278e4f03aace2bfc03943543ed5f23 Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Fri, 5 Jan 2024 14:06:44 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20change?=
 =?UTF-8?q?s=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4

[skip ci]
---
 compiler-rt/lib/tsan/rtl/tsan_report.cpp | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/compiler-rt/lib/tsan/rtl/tsan_report.cpp b/compiler-rt/lib/tsan/rtl/tsan_report.cpp
index 35cb6710a54fa4..c6b764bd891752 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_report.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_report.cpp
@@ -274,25 +274,22 @@ static ReportStack *ChooseSummaryStack(const ReportDesc *rep) {
 }
 
 static bool FrameIsInternal(const SymbolizedStack *frame) {
-  if (frame == 0)
-    return false;
+  if (!frame)
+    return true;
   const char *file = frame->info.file;
   const char *module = frame->info.module;
-  if (file != 0 &&
-      (internal_strstr(file, "tsan_interceptors_posix.cpp") ||
-       internal_strstr(file, "tsan_interceptors_memintrinsics.cpp") ||
-       internal_strstr(file, "sanitizer_common_interceptors.inc") ||
-       internal_strstr(file, "tsan_interface_")))
+  if (file && (internal_strstr(file, "/compiler-rt/lib/")))
     return true;
-  if (module != 0 && (internal_strstr(module, "libclang_rt.tsan_")))
+  if (module && (internal_strstr(module, "libclang_rt.")))
     return true;
   return false;
 }
 
 static SymbolizedStack *SkipTsanInternalFrames(SymbolizedStack *frames) {
-  while (FrameIsInternal(frames) && frames->next)
-    frames = frames->next;
-  return frames;
+  for (SymbolizedStack *f = frames; f; f = f->next)
+    if (!FrameIsInternal(f))
+      return f;
+  return frames;  // Fallback to the top frame.
 }
 
 void PrintReport(const ReportDesc *rep) {



More information about the cfe-commits mailing list