mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Revert "Update LocalizationFormat to use diagnosticIDStringFor"
The depenedency on libAST this introduced is causing build time
regressions.
This reverts commit ea86221d41.
This commit is contained in:
@@ -4,5 +4,3 @@ add_swift_host_library(swiftLocalization STATIC
|
||||
|
||||
LLVM_LINK_COMPONENTS
|
||||
support)
|
||||
target_link_libraries(swiftLocalization PRIVATE
|
||||
swiftAST)
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "swift/Localization/LocalizationFormat.h"
|
||||
#include "swift/AST/DiagnosticEngine.h"
|
||||
#include "swift/Basic/Range.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
@@ -40,6 +39,12 @@ enum LocalDiagID : uint32_t {
|
||||
NumDiags
|
||||
};
|
||||
|
||||
static constexpr const char *const diagnosticNameStrings[] = {
|
||||
#define DIAG(KIND, ID, Options, Text, Signature) " [" #ID "]",
|
||||
#include "swift/AST/DiagnosticsAll.def"
|
||||
"<not a diagnostic>",
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace llvm {
|
||||
@@ -110,9 +115,9 @@ LocalizationProducer::getMessageOr(swift::DiagID id,
|
||||
if (localizedMessage.empty())
|
||||
return defaultMessage;
|
||||
if (printDiagnosticNames) {
|
||||
llvm::StringRef diagnosticID(DiagnosticEngine::diagnosticIDStringFor(id));
|
||||
llvm::StringRef diagnosticName(diagnosticNameStrings[(unsigned)id]);
|
||||
auto localizedDebugDiagnosticMessage =
|
||||
localizationSaver.save(localizedMessage.str() + " [" + diagnosticID.str() + "]");
|
||||
localizationSaver.save(localizedMessage.str() + diagnosticName.str());
|
||||
return localizedDebugDiagnosticMessage;
|
||||
}
|
||||
return localizedMessage;
|
||||
|
||||
Reference in New Issue
Block a user