@@ -34,11 +34,6 @@ using namespace llvm::opt;
34
34
// / The path for Swift libraries in the OS on Darwin.
35
35
#define DARWIN_OS_LIBRARY_PATH " /usr/lib/swift"
36
36
37
- static constexpr const char *const localeCodes[] = {
38
- #define SUPPORTED_LOCALE (Code, Language ) #Code,
39
- #include " swift/AST/LocalizationLanguages.def"
40
- };
41
-
42
37
swift::CompilerInvocation::CompilerInvocation () {
43
38
setTargetTriple (llvm::sys::getDefaultTargetTriple ());
44
39
}
@@ -62,14 +57,6 @@ void CompilerInvocation::setMainExecutablePath(StringRef Path) {
62
57
llvm::sys::path::append (DiagnosticDocsPath, " share" , " doc" , " swift" ,
63
58
" diagnostics" );
64
59
DiagnosticOpts.DiagnosticDocumentationPath = std::string (DiagnosticDocsPath.str ());
65
-
66
- // Compute the path of the YAML diagnostic messages directory files
67
- // in the toolchain.
68
- llvm::SmallString<128 > DiagnosticMessagesDir (Path);
69
- llvm::sys::path::remove_filename (DiagnosticMessagesDir); // Remove /swift
70
- llvm::sys::path::remove_filename (DiagnosticMessagesDir); // Remove /bin
71
- llvm::sys::path::append (DiagnosticMessagesDir, " share" , " swift" );
72
- DiagnosticOpts.LocalizationPath = std::string (DiagnosticMessagesDir.str ());
73
60
}
74
61
75
62
void CompilerInvocation::setDefaultPrebuiltCacheIfNecessary () {
@@ -941,43 +928,6 @@ static bool ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
941
928
if (Arg *A = Args.getLastArg (OPT_diagnostic_documentation_path)) {
942
929
Opts.DiagnosticDocumentationPath = A->getValue ();
943
930
}
944
- if (Arg *A = Args.getLastArg (OPT_locale)) {
945
- std::string localeCode = A->getValue ();
946
-
947
- // Check if the locale code is available.
948
- if (llvm::none_of (localeCodes, [&](const char *locale) {
949
- return localeCode == locale;
950
- })) {
951
- std::string availableLocaleCodes = " " ;
952
- llvm::interleave (
953
- std::begin (localeCodes), std::end (localeCodes),
954
- [&](std::string locale) { availableLocaleCodes += locale; },
955
- [&] { availableLocaleCodes += " , " ; });
956
-
957
- Diags.diagnose (SourceLoc (), diag::error_invalid_locale_code,
958
- availableLocaleCodes);
959
- return true ;
960
- }
961
- Opts.LocalizationCode = localeCode;
962
- }
963
- if (Arg *A = Args.getLastArg (OPT_localization_path)) {
964
- if (!llvm::sys::fs::exists (A->getValue ())) {
965
- Diags.diagnose (SourceLoc (), diag::warning_locale_path_not_found,
966
- A->getValue ());
967
- } else if (!Opts.LocalizationCode .empty ()) {
968
- // Check if the localization path exists but it doesn't have a file
969
- // for the specified locale code.
970
- llvm::SmallString<128 > localizationPath (A->getValue ());
971
- llvm::sys::path::append (localizationPath, Opts.LocalizationCode );
972
- llvm::sys::path::replace_extension (localizationPath, " .yaml" );
973
- if (!llvm::sys::fs::exists (localizationPath)) {
974
- Diags.diagnose (SourceLoc (), diag::warning_cannot_find_locale_file,
975
- Opts.LocalizationCode , localizationPath);
976
- }
977
-
978
- Opts.LocalizationPath = A->getValue ();
979
- }
980
- }
981
931
assert (!(Opts.WarningsAsErrors && Opts.SuppressWarnings ) &&
982
932
" conflicting arguments; should have been caught by driver" );
983
933
0 commit comments