diagnostic_kind.cpp 611 B

12345678910111213141516171819
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. #include "toolchain/diagnostics/diagnostic_kind.h"
  5. namespace Carbon {
  6. auto operator<<(llvm::raw_ostream& out, DiagnosticKind kind)
  7. -> llvm::raw_ostream& {
  8. static constexpr llvm::StringLiteral Names[] = {
  9. #define CARBON_DIAGNOSTIC_KIND(DiagnosticName) #DiagnosticName,
  10. #include "toolchain/diagnostics/diagnostic_registry.def"
  11. };
  12. out << Names[static_cast<int>(kind)];
  13. return out;
  14. }
  15. } // namespace Carbon