Skip to content

Commit

Permalink
Rename //explorer/common to base (#3103)
Browse files Browse the repository at this point in the history
Renaming per #3100
  • Loading branch information
jonmeow authored Aug 15, 2023
1 parent a6ba782 commit 357baae
Show file tree
Hide file tree
Showing 80 changed files with 194 additions and 194 deletions.
2 changes: 1 addition & 1 deletion explorer/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ cc_library(
deps = [
"//common:error",
"//common:ostream",
"//explorer/common:trace_stream",
"//explorer/base:trace_stream",
"//explorer/parse_and_execute",
"@llvm-project//llvm:Support",
],
Expand Down
6 changes: 3 additions & 3 deletions explorer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ RTTI switches, so that the compiler can help ensure the code is updated when a
new type is added.

`explorer` never uses plain pointer types directly. Instead, we use the
[`Nonnull<T*>`](common/nonnull.h) alias for pointers that are not nullable, or
[`Nonnull<T*>`](base/nonnull.h) alias for pointers that are not nullable, or
`std::optional<Nonnull<T*>>` for pointers that are nullable.

Many of the most commonly-used objects in `explorer` have lifetimes that are
tied to the lifespan of the entire Carbon program. We manage the lifetimes of
those objects by allocating them through an [`Arena`](common/arena.h) object,
those objects by allocating them through an [`Arena`](base/arena.h) object,
which can allocate objects of arbitrary types, and retains ownership of them. As
of this writing, all of `explorer` uses a single `Arena` object, we may
introduce multiple `Arena`s for different lifetime groups in the future.

For simplicity, `explorer` generally treats all errors as fatal. Errors caused
by bugs in the user-provided Carbon code should be reported with the error
builders in [`error_builders.h`](common/error_builders.h). Errors caused by bugs
builders in [`error_builders.h`](base/error_builders.h). Errors caused by bugs
in `explorer` itself should be reported with
[`CHECK` or `FATAL`](../common/check.h).

Expand Down
30 changes: 15 additions & 15 deletions explorer/ast/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ cc_library(
"//common:error",
"//common:indirect_value",
"//common:ostream",
"//explorer/common:arena",
"//explorer/common:decompose",
"//explorer/common:error_builders",
"//explorer/common:nonnull",
"//explorer/common:source_location",
"//explorer/base:arena",
"//explorer/base:decompose",
"//explorer/base:error_builders",
"//explorer/base:nonnull",
"//explorer/base:source_location",
"@llvm-project//llvm:Support",
],
)
Expand All @@ -81,7 +81,7 @@ cc_test(
deps = [
":ast",
":ast_test_matchers",
"//explorer/common:arena",
"//explorer/base:arena",
"//testing/util:gtest_main",
"@com_google_googletest//:gtest",
],
Expand All @@ -93,7 +93,7 @@ cc_test(
deps = [
":ast",
":paren_contents",
"//explorer/common:arena",
"//explorer/base:arena",
"//testing/util:gtest_main",
"@com_google_googletest//:gtest",
"@llvm-project//llvm:Support",
Expand All @@ -109,8 +109,8 @@ cc_library(
name = "paren_contents",
hdrs = ["paren_contents.h"],
deps = [
"//explorer/common:error_builders",
"//explorer/common:source_location",
"//explorer/base:error_builders",
"//explorer/base:source_location",
],
)

Expand All @@ -120,7 +120,7 @@ cc_test(
deps = [
":ast",
":paren_contents",
"//explorer/common:arena",
"//explorer/base:arena",
"//testing/util:gtest_main",
"@com_google_googletest//:gtest",
"@llvm-project//llvm:Support",
Expand All @@ -133,7 +133,7 @@ cc_test(
deps = [
":ast",
":paren_contents",
"//explorer/common:arena",
"//explorer/base:arena",
"//testing/util:gtest_main",
"@com_google_googletest//:gtest",
"@llvm-project//llvm:Support",
Expand All @@ -149,10 +149,10 @@ cc_library(
"//common:check",
"//common:error",
"//common:ostream",
"//explorer/common:error_builders",
"//explorer/common:nonnull",
"//explorer/common:source_location",
"//explorer/common:trace_stream",
"//explorer/base:error_builders",
"//explorer/base:nonnull",
"//explorer/base:source_location",
"//explorer/base:trace_stream",
"@llvm-project//llvm:Support",
],
)
Expand Down
2 changes: 1 addition & 1 deletion explorer/ast/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "explorer/ast/declaration.h"
#include "explorer/ast/library_name.h"
#include "explorer/common/nonnull.h"
#include "explorer/base/nonnull.h"

namespace Carbon {

Expand Down
2 changes: 1 addition & 1 deletion explorer/ast/ast_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define CARBON_EXPLORER_AST_AST_NODE_H_

#include "explorer/ast/ast_rtti.h"
#include "explorer/common/source_location.h"
#include "explorer/base/source_location.h"
#include "llvm/Support/Casting.h"

namespace Carbon {
Expand Down
2 changes: 1 addition & 1 deletion explorer/ast/ast_test_matchers_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "explorer/ast/expression.h"
#include "explorer/ast/pattern.h"
#include "explorer/ast/statement.h"
#include "explorer/common/arena.h"
#include "explorer/base/arena.h"

namespace Carbon::Testing {
namespace {
Expand Down
2 changes: 1 addition & 1 deletion explorer/ast/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "common/ostream.h"
#include "explorer/ast/clone_context.h"
#include "explorer/common/nonnull.h"
#include "explorer/base/nonnull.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringExtras.h"

Expand Down
2 changes: 1 addition & 1 deletion explorer/ast/clone_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "common/check.h"
#include "explorer/ast/ast_rtti.h"
#include "explorer/common/arena.h"
#include "explorer/base/arena.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/Casting.h"

Expand Down
4 changes: 2 additions & 2 deletions explorer/ast/declaration.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include "explorer/ast/return_term.h"
#include "explorer/ast/statement.h"
#include "explorer/ast/value_node.h"
#include "explorer/common/nonnull.h"
#include "explorer/common/source_location.h"
#include "explorer/base/nonnull.h"
#include "explorer/base/source_location.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/Compiler.h"

Expand Down
4 changes: 2 additions & 2 deletions explorer/ast/element.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

#include "common/ostream.h"
#include "explorer/ast/ast_rtti.h"
#include "explorer/common/decompose.h"
#include "explorer/common/nonnull.h"
#include "explorer/base/decompose.h"
#include "explorer/base/nonnull.h"
#include "llvm/ADT/PointerUnion.h"

namespace Carbon {
Expand Down
2 changes: 1 addition & 1 deletion explorer/ast/element_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "explorer/ast/declaration.h"
#include "explorer/ast/expression.h"
#include "explorer/ast/value.h"
#include "explorer/common/arena.h"
#include "explorer/base/arena.h"
#include "llvm/Support/Casting.h"

namespace Carbon::Testing {
Expand Down
4 changes: 2 additions & 2 deletions explorer/ast/expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

#include "explorer/ast/pattern.h"
#include "explorer/ast/value.h"
#include "explorer/common/arena.h"
#include "explorer/common/error_builders.h"
#include "explorer/base/arena.h"
#include "explorer/base/error_builders.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/raw_ostream.h"
Expand Down
4 changes: 2 additions & 2 deletions explorer/ast/expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
#include "explorer/ast/expression_category.h"
#include "explorer/ast/paren_contents.h"
#include "explorer/ast/value_node.h"
#include "explorer/common/arena.h"
#include "explorer/common/source_location.h"
#include "explorer/base/arena.h"
#include "explorer/base/source_location.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/Compiler.h"

Expand Down
2 changes: 1 addition & 1 deletion explorer/ast/expression_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <string>

#include "explorer/ast/paren_contents.h"
#include "explorer/common/arena.h"
#include "explorer/base/arena.h"
#include "llvm/Support/Casting.h"

namespace Carbon::Testing {
Expand Down
4 changes: 2 additions & 2 deletions explorer/ast/paren_contents.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include <string>
#include <vector>

#include "explorer/common/error_builders.h"
#include "explorer/common/source_location.h"
#include "explorer/base/error_builders.h"
#include "explorer/base/source_location.h"

namespace Carbon {

Expand Down
4 changes: 2 additions & 2 deletions explorer/ast/pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#include "explorer/ast/expression.h"
#include "explorer/ast/impl_binding.h"
#include "explorer/ast/value.h"
#include "explorer/common/arena.h"
#include "explorer/common/error_builders.h"
#include "explorer/base/arena.h"
#include "explorer/base/error_builders.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Casting.h"

Expand Down
2 changes: 1 addition & 1 deletion explorer/ast/pattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "explorer/ast/expression.h"
#include "explorer/ast/expression_category.h"
#include "explorer/ast/value_node.h"
#include "explorer/common/source_location.h"
#include "explorer/base/source_location.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLFunctionalExtras.h"

Expand Down
2 changes: 1 addition & 1 deletion explorer/ast/pattern_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "explorer/ast/expression.h"
#include "explorer/ast/paren_contents.h"
#include "explorer/common/arena.h"
#include "explorer/base/arena.h"
#include "llvm/Support/Casting.h"

namespace Carbon::Testing {
Expand Down
4 changes: 2 additions & 2 deletions explorer/ast/return_term.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "common/ostream.h"
#include "explorer/ast/clone_context.h"
#include "explorer/ast/expression.h"
#include "explorer/common/nonnull.h"
#include "explorer/common/source_location.h"
#include "explorer/base/nonnull.h"
#include "explorer/base/source_location.h"

namespace Carbon {

Expand Down
2 changes: 1 addition & 1 deletion explorer/ast/statement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "common/check.h"
#include "explorer/ast/declaration.h"
#include "explorer/common/arena.h"
#include "explorer/base/arena.h"
#include "llvm/Support/Casting.h"

namespace Carbon {
Expand Down
4 changes: 2 additions & 2 deletions explorer/ast/statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#include "explorer/ast/pattern.h"
#include "explorer/ast/return_term.h"
#include "explorer/ast/value_node.h"
#include "explorer/common/arena.h"
#include "explorer/common/source_location.h"
#include "explorer/base/arena.h"
#include "explorer/base/source_location.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/Compiler.h"

Expand Down
2 changes: 1 addition & 1 deletion explorer/ast/static_scope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <optional>

#include "common/ostream.h"
#include "explorer/common/error_builders.h"
#include "explorer/base/error_builders.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/Support/Error.h"

Expand Down
6 changes: 3 additions & 3 deletions explorer/ast/static_scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

#include "common/error.h"
#include "explorer/ast/value_node.h"
#include "explorer/common/nonnull.h"
#include "explorer/common/source_location.h"
#include "explorer/common/trace_stream.h"
#include "explorer/base/nonnull.h"
#include "explorer/base/source_location.h"
#include "explorer/base/trace_stream.h"
#include "llvm/ADT/StringMap.h"

namespace Carbon {
Expand Down
4 changes: 2 additions & 2 deletions explorer/ast/value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "explorer/ast/element.h"
#include "explorer/ast/element_path.h"
#include "explorer/ast/value_transform.h"
#include "explorer/common/arena.h"
#include "explorer/common/error_builders.h"
#include "explorer/base/arena.h"
#include "explorer/base/error_builders.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Casting.h"
Expand Down
2 changes: 1 addition & 1 deletion explorer/ast/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "explorer/ast/element_path.h"
#include "explorer/ast/expression_category.h"
#include "explorer/ast/statement.h"
#include "explorer/common/nonnull.h"
#include "explorer/base/nonnull.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/Compiler.h"

Expand Down
2 changes: 1 addition & 1 deletion explorer/ast/value_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "explorer/ast/ast_node.h"
#include "explorer/ast/clone_context.h"
#include "explorer/ast/expression_category.h"
#include "explorer/common/nonnull.h"
#include "explorer/base/nonnull.h"

namespace Carbon {

Expand Down
2 changes: 1 addition & 1 deletion explorer/common/BUILD → explorer/base/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ cc_library(
":source_location",
"//common:check",
"//common:ostream",
"//explorer/common:nonnull",
"//explorer/base:nonnull",
"@llvm-project//llvm:Support",
],
)
Expand Down
8 changes: 4 additions & 4 deletions explorer/common/arena.h → explorer/base/arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef CARBON_EXPLORER_COMMON_ARENA_H_
#define CARBON_EXPLORER_COMMON_ARENA_H_
#ifndef CARBON_EXPLORER_BASE_ARENA_H_
#define CARBON_EXPLORER_BASE_ARENA_H_

#include <any>
#include <map>
Expand All @@ -13,7 +13,7 @@
#include <utility>
#include <vector>

#include "explorer/common/nonnull.h"
#include "explorer/base/nonnull.h"
#include "llvm/ADT/Hashing.h"

namespace Carbon {
Expand Down Expand Up @@ -277,4 +277,4 @@ char Arena::TypeId<T>::id = 1;

} // namespace Carbon

#endif // CARBON_EXPLORER_COMMON_ARENA_H_
#endif // CARBON_EXPLORER_BASE_ARENA_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include "explorer/common/arena.h"
#include "explorer/base/arena.h"

#include <gtest/gtest.h>

Expand Down
Loading

0 comments on commit 357baae

Please sign in to comment.