static SymbolizerTool *ChooseExternalSymbolizer(LowLevelAllocator *allocator) {
const char *path = common_flags()->external_symbolizer_path;
const char *binary_name = path ? StripModuleName(path) : "";
- if (path && path[0] == '\0') {
- VReport(2, "External symbolizer is explicitly disabled.\n");
- return nullptr;
- } else if (!internal_strcmp(binary_name, "llvm-symbolizer")) {
- VReport(2, "Using llvm-symbolizer at user-specified path: %s\n", path);
- return new(*allocator) LLVMSymbolizer(path, allocator);
- } else if (!internal_strcmp(binary_name, "atos")) {
+
+ if (path) {
+ if (path[0] == '\0') {
+ VReport(2, "External symbolizer is explicitly disabled.\n");
+ return nullptr;
+ } else if (!internal_strcmp(binary_name, "llvm-symbolizer")) {
+ VReport(2, "Using llvm-symbolizer at user-specified path: %s\n", path);
+ return new(*allocator) LLVMSymbolizer(path, allocator);
+ } else if (!internal_strcmp(binary_name, "atos")) {
#if SANITIZER_MAC
- VReport(2, "Using atos at user-specified path: %s\n", path);
- return new(*allocator) AtosSymbolizer(path, allocator);
+ VReport(2, "Using atos at user-specified path: %s\n", path);
+ return new(*allocator) AtosSymbolizer(path, allocator);
#else // SANITIZER_MAC
- Report("ERROR: Using `atos` is only supported on Darwin.\n");
- Die();
+ Report("ERROR: Using `atos` is only supported on Darwin.\n");
+ Die();
#endif // SANITIZER_MAC
- } else if (!internal_strcmp(binary_name, "addr2line")) {
- VReport(2, "Using addr2line at user-specified path: %s\n", path);
- return new(*allocator) Addr2LinePool(path, allocator);
- } else if (path) {
- Report("ERROR: External symbolizer path is set to '%s' which isn't "
- "a known symbolizer. Please set the path to the llvm-symbolizer "
- "binary or other known tool.\n", path);
- Die();
+ } else if (!internal_strcmp(binary_name, "addr2line")) {
+ VReport(2, "Using addr2line at user-specified path: %s\n", path);
+ return new(*allocator) Addr2LinePool(path, allocator);
+ } else {
+ Report("ERROR: External symbolizer path is set to '%s' which isn't "
+ "a known symbolizer. Please set the path to the llvm-symbolizer "
+ "binary or other known tool.\n", path);
+ Die();
+ }
}
// Otherwise symbolizer program is unknown, let's search $PATH