[compiler-rt] f154f10 - [sanitizer] Adjust code path of ChooseExternalSymbolizer for Windows

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 14:51:52 PDT 2023


Author: Wu, Yingcong
Date: 2023-06-13T14:51:47-07:00
New Revision: f154f10887e908fa8fe3282c3cc0735717a8e97d

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

LOG: [sanitizer] Adjust code path of ChooseExternalSymbolizer for Windows

If `path` is null, `user_path` must also be null. With the current code path, the message of explicitly disabling symbolizer will never be reported. This patch adjusts the if-else structure to make that message can be reported.

Reviewed By: cchen15, MaskRay

Differential Revision: https://reviews.llvm.org/D148907

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp
index 2a7137fe1f840..ae2d3be19ef38 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cpp
@@ -292,15 +292,15 @@ static void ChooseSymbolizerTools(IntrusiveList<SymbolizerTool> *list,
   const char *path =
       user_path ? user_path : FindPathToBinary("llvm-symbolizer.exe");
   if (path) {
-    VReport(2, "Using llvm-symbolizer at %spath: %s\n",
-            user_path ? "user-specified " : "", path);
-    list->push_back(new(*allocator) LLVMSymbolizer(path, allocator));
-  } else {
     if (user_path && user_path[0] == '\0') {
       VReport(2, "External symbolizer is explicitly disabled.\n");
     } else {
-      VReport(2, "External symbolizer is not present.\n");
+      VReport(2, "Using llvm-symbolizer at %spath: %s\n",
+              user_path ? "user-specified " : "", path);
+      list->push_back(new (*allocator) LLVMSymbolizer(path, allocator));
     }
+  } else {
+    VReport(2, "External symbolizer is not present.\n");
   }
 
   // Add the dbghelp based symbolizer.


        


More information about the llvm-commits mailing list