mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
I wanted to choose one or the other. I think some code has been using each from early on. We're predominately using `filename`, so consolidating on that. This conveniently matches the [Google dev doc style guide](https://developers.google.com/style/word-list#filename) (which we use for docs) which says "filename: Not file name". In toolchain: ``` ╚╡git grep file_name . | wc -l 35 ╚╡git grep filename . | wc -l 489 ```
33 lines
970 B
C++
33 lines
970 B
C++
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
#include "toolchain/diagnostics/mocks.h"
|
|
|
|
namespace Carbon {
|
|
|
|
void PrintTo(const Diagnostic& diagnostic, std::ostream* os) {
|
|
*os << "Diagnostic{" << diagnostic.message.kind << ", ";
|
|
PrintTo(diagnostic.level, os);
|
|
*os << ", " << diagnostic.message.location.filename << ":"
|
|
<< diagnostic.message.location.line_number << ":"
|
|
<< diagnostic.message.location.column_number << ", \""
|
|
<< diagnostic.message.format_fn(diagnostic.message) << "\"}";
|
|
}
|
|
|
|
void PrintTo(DiagnosticLevel level, std::ostream* os) {
|
|
switch (level) {
|
|
case DiagnosticLevel::Note:
|
|
*os << "Note";
|
|
break;
|
|
case DiagnosticLevel::Warning:
|
|
*os << "Warning";
|
|
break;
|
|
case DiagnosticLevel::Error:
|
|
*os << "Error";
|
|
break;
|
|
}
|
|
}
|
|
|
|
} // namespace Carbon
|