Browse Source

Move PrettyStackTraceFunction to common (#5739)

I'm looking at using this as part of file_test to dump streaming,
related to #5733
Jon Ross-Perkins 10 months ago
parent
commit
9855818bb8

+ 8 - 0
common/BUILD

@@ -405,6 +405,14 @@ cc_library(
     ],
 )
 
+cc_library(
+    name = "pretty_stack_trace_function",
+    hdrs = ["pretty_stack_trace_function.h"],
+    deps = [
+        "@llvm-project//llvm:Support",
+    ],
+)
+
 cc_library(
     name = "raw_hashtable",
     srcs = ["raw_hashtable.cpp"],

+ 3 - 3
toolchain/base/pretty_stack_trace_function.h → common/pretty_stack_trace_function.h

@@ -2,8 +2,8 @@
 // Exceptions. See /LICENSE for license information.
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 
-#ifndef CARBON_TOOLCHAIN_BASE_PRETTY_STACK_TRACE_FUNCTION_H_
-#define CARBON_TOOLCHAIN_BASE_PRETTY_STACK_TRACE_FUNCTION_H_
+#ifndef CARBON_COMMON_PRETTY_STACK_TRACE_FUNCTION_H_
+#define CARBON_COMMON_PRETTY_STACK_TRACE_FUNCTION_H_
 
 #include <functional>
 
@@ -26,4 +26,4 @@ class PrettyStackTraceFunction : public llvm::PrettyStackTraceEntry {
 
 }  // namespace Carbon
 
-#endif  // CARBON_TOOLCHAIN_BASE_PRETTY_STACK_TRACE_FUNCTION_H_
+#endif  // CARBON_COMMON_PRETTY_STACK_TRACE_FUNCTION_H_

+ 0 - 8
toolchain/base/BUILD

@@ -45,14 +45,6 @@ cc_test(
     ],
 )
 
-cc_library(
-    name = "pretty_stack_trace_function",
-    hdrs = ["pretty_stack_trace_function.h"],
-    deps = [
-        "@llvm-project//llvm:Support",
-    ],
-)
-
 cc_library(
     name = "mem_usage",
     hdrs = ["mem_usage.h"],

+ 1 - 1
toolchain/check/BUILD

@@ -186,9 +186,9 @@ cc_library(
         "//common:growing_range",
         "//common:map",
         "//common:ostream",
+        "//common:pretty_stack_trace_function",
         "//common:vlog",
         "//toolchain/base:kind_switch",
-        "//toolchain/base:pretty_stack_trace_function",
         "//toolchain/base:shared_value_stores",
         "//toolchain/base:timings",
         "//toolchain/diagnostics:diagnostic_emitter",

+ 1 - 1
toolchain/check/check_unit.cpp

@@ -10,11 +10,11 @@
 #include <utility>
 
 #include "common/growing_range.h"
+#include "common/pretty_stack_trace_function.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/VirtualFileSystem.h"
 #include "toolchain/base/kind_switch.h"
-#include "toolchain/base/pretty_stack_trace_function.h"
 #include "toolchain/check/diagnostic_helpers.h"
 #include "toolchain/check/generic.h"
 #include "toolchain/check/handle.h"

+ 1 - 1
toolchain/driver/BUILD

@@ -121,11 +121,11 @@ cc_library(
         "//common:command_line",
         "//common:error",
         "//common:ostream",
+        "//common:pretty_stack_trace_function",
         "//common:raw_string_ostream",
         "//common:version",
         "//common:vlog",
         "//toolchain/base:llvm_tools",
-        "//toolchain/base:pretty_stack_trace_function",
         "//toolchain/base:shared_value_stores",
         "//toolchain/base:timings",
         "//toolchain/check",

+ 1 - 1
toolchain/driver/compile_subcommand.cpp

@@ -11,10 +11,10 @@
 #include <system_error>
 #include <utility>
 
+#include "common/pretty_stack_trace_function.h"
 #include "common/vlog.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/ScopeExit.h"
-#include "toolchain/base/pretty_stack_trace_function.h"
 #include "toolchain/base/timings.h"
 #include "toolchain/check/check.h"
 #include "toolchain/codegen/codegen.h"

+ 1 - 1
toolchain/driver/driver.cpp

@@ -9,8 +9,8 @@
 #include <optional>
 
 #include "common/command_line.h"
+#include "common/pretty_stack_trace_function.h"
 #include "common/version.h"
-#include "toolchain/base/pretty_stack_trace_function.h"
 #include "toolchain/driver/clang_subcommand.h"
 #include "toolchain/driver/compile_subcommand.h"
 #include "toolchain/driver/format_subcommand.h"

+ 1 - 1
toolchain/lower/BUILD

@@ -51,11 +51,11 @@ cc_library(
         "//common:check",
         "//common:growing_range",
         "//common:map",
+        "//common:pretty_stack_trace_function",
         "//common:raw_string_ostream",
         "//common:vlog",
         "//toolchain/base:fixed_size_value_store",
         "//toolchain/base:kind_switch",
-        "//toolchain/base:pretty_stack_trace_function",
         "//toolchain/parse:tree",
         "//toolchain/sem_ir:absolute_node_id",
         "//toolchain/sem_ir:diagnostic_loc_converter",

+ 1 - 1
toolchain/lower/file_context.cpp

@@ -11,6 +11,7 @@
 
 #include "clang/CodeGen/ModuleBuilder.h"
 #include "common/check.h"
+#include "common/pretty_stack_trace_function.h"
 #include "common/vlog.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/Sequence.h"
@@ -18,7 +19,6 @@
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
 #include "llvm/Transforms/Utils/ModuleUtils.h"
 #include "toolchain/base/kind_switch.h"
-#include "toolchain/base/pretty_stack_trace_function.h"
 #include "toolchain/lower/constant.h"
 #include "toolchain/lower/function_context.h"
 #include "toolchain/lower/mangler.h"

+ 1 - 1
toolchain/lower/function_context.cpp

@@ -4,9 +4,9 @@
 
 #include "toolchain/lower/function_context.h"
 
+#include "common/pretty_stack_trace_function.h"
 #include "common/vlog.h"
 #include "toolchain/base/kind_switch.h"
-#include "toolchain/base/pretty_stack_trace_function.h"
 #include "toolchain/sem_ir/diagnostic_loc_converter.h"
 #include "toolchain/sem_ir/file.h"
 #include "toolchain/sem_ir/generic.h"

+ 1 - 1
toolchain/parse/BUILD

@@ -106,7 +106,7 @@ cc_library(
         ":tree",
         "//common:check",
         "//common:ostream",
-        "//toolchain/base:pretty_stack_trace_function",
+        "//common:pretty_stack_trace_function",
         "//toolchain/base:shared_value_stores",
         "//toolchain/diagnostics:diagnostic_emitter",
         "//toolchain/diagnostics:format_providers",

+ 1 - 1
toolchain/parse/parse.cpp

@@ -5,7 +5,7 @@
 #include "toolchain/parse/parse.h"
 
 #include "common/check.h"
-#include "toolchain/base/pretty_stack_trace_function.h"
+#include "common/pretty_stack_trace_function.h"
 #include "toolchain/parse/context.h"
 #include "toolchain/parse/handle.h"
 #include "toolchain/parse/node_kind.h"