Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the toolchain into a top-level directory. #567

Merged
merged 1 commit into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include "diagnostics/diagnostic_emitter.h"
#include "toolchain/diagnostics/diagnostic_emitter.h"

namespace Carbon {} // namespace Carbon
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 DIAGNOSTICS_DIAGNOSTICEMITTER_H_
#define DIAGNOSTICS_DIAGNOSTICEMITTER_H_
#ifndef TOOLCHAIN_DIAGNOSTICS_DIAGNOSTICEMITTER_H_
#define TOOLCHAIN_DIAGNOSTICS_DIAGNOSTICEMITTER_H_

#include <functional>
#include <string>
Expand Down Expand Up @@ -174,4 +174,4 @@ class ErrorTrackingDiagnosticConsumer : public DiagnosticConsumer {

} // namespace Carbon

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

#include "diagnostics/diagnostic_emitter.h"
#include "toolchain/diagnostics/diagnostic_emitter.h"

#include "diagnostics/mocks.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/FormatVariadic.h"
#include "toolchain/diagnostics/mocks.h"

namespace Carbon {
namespace {
Expand Down
8 changes: 4 additions & 4 deletions diagnostics/mocks.h → toolchain/diagnostics/mocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef DIAGNOSTICS_MOCKS_H_
#define DIAGNOSTICS_MOCKS_H_
#ifndef TOOLCHAIN_DIAGNOSTICS_MOCKS_H_
#define TOOLCHAIN_DIAGNOSTICS_MOCKS_H_

#include "diagnostics/diagnostic_emitter.h"
#include "gmock/gmock.h"
#include "toolchain/diagnostics/diagnostic_emitter.h"

namespace Carbon {
namespace Testing {
Expand Down Expand Up @@ -54,4 +54,4 @@ auto DiagnosticShortName(Matcher&& inner_matcher) -> auto {
} // namespace Testing
} // namespace Carbon

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

#ifndef DIAGNOSTICS_NULL_DIAGNOSTICS_H_
#define DIAGNOSTICS_NULL_DIAGNOSTICS_H_
#ifndef TOOLCHAIN_DIAGNOSTICS_NULL_DIAGNOSTICS_H_
#define TOOLCHAIN_DIAGNOSTICS_NULL_DIAGNOSTICS_H_

#include "diagnostics/diagnostic_emitter.h"
#include "toolchain/diagnostics/diagnostic_emitter.h"

namespace Carbon {

Expand Down Expand Up @@ -36,4 +36,4 @@ inline auto NullDiagnosticEmitter() -> DiagnosticEmitter<LocationT>& {

} // namespace Carbon

#endif // DIAGNOSTICS_NULL_DIAGNOSTICS_H_
#endif // TOOLCHAIN_DIAGNOSTICS_NULL_DIAGNOSTICS_H_
8 changes: 4 additions & 4 deletions driver/BUILD → toolchain/driver/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ cc_library(
hdrs = ["driver.h"],
textual_hdrs = ["flags.def"],
deps = [
"//diagnostics:diagnostic_emitter",
"//lexer:tokenized_buffer",
"//source:source_buffer",
"//toolchain/diagnostics:diagnostic_emitter",
"//toolchain/lexer:tokenized_buffer",
"//toolchain/source:source_buffer",
"@llvm-project//llvm:Support",
],
)
Expand All @@ -25,7 +25,7 @@ cc_test(
srcs = ["driver_test.cpp"],
deps = [
":driver",
"//lexer:tokenized_buffer_test_helpers",
"//toolchain/lexer:tokenized_buffer_test_helpers",
"@llvm-project//llvm:Support",
"@llvm-project//llvm:gmock",
"@llvm-project//llvm:gtest",
Expand Down
File renamed without changes.
16 changes: 8 additions & 8 deletions driver/driver.cpp → toolchain/driver/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include "driver/driver.h"
#include "toolchain/driver/driver.h"

#include "diagnostics/diagnostic_emitter.h"
#include "lexer/tokenized_buffer.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "source/source_buffer.h"
#include "toolchain/diagnostics/diagnostic_emitter.h"
#include "toolchain/lexer/tokenized_buffer.h"
#include "toolchain/source/source_buffer.h"

namespace Carbon {

namespace {

enum class Subcommand {
#define CARBON_SUBCOMMAND(Name, ...) Name,
#include "driver/flags.def"
#include "toolchain/driver/flags.def"
Unknown,
};

auto GetSubcommand(llvm::StringRef name) -> Subcommand {
return llvm::StringSwitch<Subcommand>(name)
#define CARBON_SUBCOMMAND(Name, Spelling, ...) .Case(Spelling, Subcommand::Name)
#include "driver/flags.def"
#include "toolchain/driver/flags.def"
.Default(Subcommand::Unknown);
}

Expand All @@ -52,7 +52,7 @@ auto Driver::RunFullCommand(llvm::ArrayRef<llvm::StringRef> args) -> bool {
#define CARBON_SUBCOMMAND(Name, ...) \
case Subcommand::Name: \
return Run##Name##Subcommand(subcommand_args);
#include "driver/flags.def"
#include "toolchain/driver/flags.def"
}
llvm_unreachable("All subcommands handled!");
}
Expand All @@ -69,7 +69,7 @@ auto Driver::RunHelpSubcommand(llvm::ArrayRef<llvm::StringRef> args) -> bool {

constexpr llvm::StringLiteral SubcommandsAndHelp[][2] = {
#define CARBON_SUBCOMMAND(Name, Spelling, HelpText) {Spelling, HelpText},
#include "driver/flags.def"
#include "toolchain/driver/flags.def"
};

int max_subcommand_width = 0;
Expand Down
6 changes: 3 additions & 3 deletions driver/driver.h → toolchain/driver/driver.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 DRIVER_DRIVER_H_
#define DRIVER_DRIVER_H_
#ifndef TOOLCHAIN_DRIVER_DRIVER_H_
#define TOOLCHAIN_DRIVER_DRIVER_H_

#include <cstdint>

Expand Down Expand Up @@ -67,4 +67,4 @@ class Driver {

} // namespace Carbon

#endif // DRIVER_DRIVER_H_
#endif // TOOLCHAIN_DRIVER_DRIVER_H_
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#include <numeric>
#include <string>

#include "driver/driver.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/raw_ostream.h"
#include "toolchain/driver/driver.h"

namespace Carbon {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

#include <cstdlib>

#include "driver/driver.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "toolchain/driver/driver.h"

auto main(int argc, char** argv) -> int {
if (argc < 1) {
Expand Down
6 changes: 3 additions & 3 deletions driver/driver_test.cpp → toolchain/driver/driver_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include "driver/driver.h"
#include "toolchain/driver/driver.h"

#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "lexer/tokenized_buffer_test_helpers.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/YAMLParser.h"
#include "toolchain/lexer/tokenized_buffer_test_helpers.h"

namespace Carbon {
namespace {
Expand Down Expand Up @@ -78,7 +78,7 @@ TEST(DriverTest, Help) {
// Help text should mention each subcommand.
#define CARBON_SUBCOMMAND(Name, Spelling, ...) \
EXPECT_THAT(help_text, HasSubstr(Spelling));
#include "driver/flags.def"
#include "toolchain/driver/flags.def"

// Check that the subcommand dispatch works.
EXPECT_TRUE(driver.RunFullCommand({"help"}));
Expand Down
File renamed without changes.
30 changes: 15 additions & 15 deletions lexer/BUILD → toolchain/lexer/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ cc_library(
testonly = 1,
hdrs = ["test_helpers.h"],
deps = [
"//diagnostics:diagnostic_emitter",
"//toolchain/diagnostics:diagnostic_emitter",
"@llvm-project//llvm:Support",
],
)
Expand All @@ -48,7 +48,7 @@ cc_library(
hdrs = ["numeric_literal.h"],
deps = [
":character_set",
"//diagnostics:diagnostic_emitter",
"//toolchain/diagnostics:diagnostic_emitter",
"@llvm-project//llvm:Support",
],
)
Expand All @@ -59,7 +59,7 @@ cc_test(
deps = [
":numeric_literal",
":test_helpers",
"//diagnostics:diagnostic_emitter",
"//toolchain/diagnostics:diagnostic_emitter",
"@llvm-project//llvm:Support",
"@llvm-project//llvm:gmock",
"@llvm-project//llvm:gtest",
Expand All @@ -73,8 +73,8 @@ cc_fuzz_test(
corpus = glob(["fuzzer_corpus/numeric_literal/*"]),
deps = [
":numeric_literal",
"//diagnostics:diagnostic_emitter",
"//diagnostics:null_diagnostics",
"//toolchain/diagnostics:diagnostic_emitter",
"//toolchain/diagnostics:null_diagnostics",
"@llvm-project//llvm:Support",
],
)
Expand All @@ -85,7 +85,7 @@ cc_library(
hdrs = ["string_literal.h"],
deps = [
":character_set",
"//diagnostics:diagnostic_emitter",
"//toolchain/diagnostics:diagnostic_emitter",
"@llvm-project//llvm:Support",
],
)
Expand All @@ -96,7 +96,7 @@ cc_test(
deps = [
":string_literal",
":test_helpers",
"//diagnostics:diagnostic_emitter",
"//toolchain/diagnostics:diagnostic_emitter",
"@llvm-project//llvm:Support",
"@llvm-project//llvm:gmock",
"@llvm-project//llvm:gtest",
Expand All @@ -110,8 +110,8 @@ cc_fuzz_test(
corpus = glob(["fuzzer_corpus/string_literal/*"]),
deps = [
":string_literal",
"//diagnostics:diagnostic_emitter",
"//diagnostics:null_diagnostics",
"//toolchain/diagnostics:diagnostic_emitter",
"//toolchain/diagnostics:null_diagnostics",
"@llvm-project//llvm:Support",
],
)
Expand All @@ -125,8 +125,8 @@ cc_library(
":numeric_literal",
":string_literal",
":token_kind",
"//diagnostics:diagnostic_emitter",
"//source:source_buffer",
"//toolchain/diagnostics:diagnostic_emitter",
"//toolchain/source:source_buffer",
"@llvm-project//llvm:Support",
],
)
Expand All @@ -148,8 +148,8 @@ cc_test(
deps = [
":tokenized_buffer",
":tokenized_buffer_test_helpers",
"//diagnostics:diagnostic_emitter",
"//diagnostics:mocks",
"//toolchain/diagnostics:diagnostic_emitter",
"//toolchain/diagnostics:mocks",
"@llvm-project//llvm:Support",
"@llvm-project//llvm:gmock",
"@llvm-project//llvm:gtest",
Expand All @@ -163,8 +163,8 @@ cc_fuzz_test(
corpus = glob(["fuzzer_corpus/tokenized_buffer/*"]),
deps = [
":tokenized_buffer",
"//diagnostics:diagnostic_emitter",
"//diagnostics:null_diagnostics",
"//toolchain/diagnostics:diagnostic_emitter",
"//toolchain/diagnostics:null_diagnostics",
"@llvm-project//llvm:Support",
],
)
6 changes: 3 additions & 3 deletions lexer/character_set.h → toolchain/lexer/character_set.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 LEXER_CHARACTER_SET_H_
#define LEXER_CHARACTER_SET_H_
#ifndef TOOLCHAIN_LEXER_CHARACTER_SET_H_
#define TOOLCHAIN_LEXER_CHARACTER_SET_H_

#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
Expand Down Expand Up @@ -72,4 +72,4 @@ inline bool IsSpace(char c) {

} // namespace Carbon

#endif // LEXER_CHARACTER_SET_H_
#endif // TOOLCHAIN_LEXER_CHARACTER_SET_H_
Loading