Diagnostic: Replace 'info' with 'note'

Change-Id: Icde015422882bad9a1427d5480718c822a28fd6a
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/45242
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
diff --git a/src/diagnostic/diagnostic.h b/src/diagnostic/diagnostic.h
index a067855..79d978f 100644
--- a/src/diagnostic/diagnostic.h
+++ b/src/diagnostic/diagnostic.h
@@ -25,7 +25,7 @@
 namespace diag {
 
 /// Severity is an enumerator of diagnostic severities.
-enum class Severity { Info, Warning, Error, InternalCompilerError, Fatal };
+enum class Severity { Note, Warning, Error, InternalCompilerError, Fatal };
 
 /// @return true iff `a` is more than, or of equal severity to `b`
 inline bool operator>=(Severity a, Severity b) {
@@ -97,6 +97,17 @@
     }
   }
 
+  /// adds the note message with the given Source to the end of this list.
+  /// @param note_msg the note message
+  /// @param source the source of the note diagnostic
+  void add_note(const std::string& note_msg, const Source& source) {
+    diag::Diagnostic error{};
+    error.severity = diag::Severity::Note;
+    error.source = source;
+    error.message = note_msg;
+    add(std::move(error));
+  }
+
   /// adds the error message without a source to the end of this list.
   /// @param err_msg the error message
   void add_error(const std::string& err_msg) {
diff --git a/src/diagnostic/formatter.cc b/src/diagnostic/formatter.cc
index ccf85a9..6f5a9ec 100644
--- a/src/diagnostic/formatter.cc
+++ b/src/diagnostic/formatter.cc
@@ -26,8 +26,8 @@
 
 const char* to_str(Severity severity) {
   switch (severity) {
-    case Severity::Info:
-      return "info";
+    case Severity::Note:
+      return "note";
     case Severity::Warning:
       return "warning";
     case Severity::Error:
@@ -172,7 +172,7 @@
 
   Color severity_color = Color::kDefault;
   switch (diag.severity) {
-    case Severity::Info:
+    case Severity::Note:
       break;
     case Severity::Warning:
       severity_color = Color::kYellow;
diff --git a/src/diagnostic/formatter_test.cc b/src/diagnostic/formatter_test.cc
index 8bd763d..0863030 100644
--- a/src/diagnostic/formatter_test.cc
+++ b/src/diagnostic/formatter_test.cc
@@ -31,7 +31,7 @@
 class DiagFormatterTest : public testing::Test {
  public:
   Source::File file{"file.name", content};
-  Diagnostic diag_info{Severity::Info,
+  Diagnostic diag_note{Severity::Note,
                        Source{Source::Range{Source::Location{1, 14}}, &file},
                        "purr"};
   Diagnostic diag_warn{Severity::Warning,
@@ -49,7 +49,7 @@
 
 TEST_F(DiagFormatterTest, Simple) {
   Formatter fmt{{false, false, false, false}};
-  auto got = fmt.format(List{diag_info, diag_warn, diag_err});
+  auto got = fmt.format(List{diag_note, diag_warn, diag_err});
   auto* expect = R"(1:14: purr
 2:14: grrr
 3:16 abc123: hiss)";
@@ -58,7 +58,7 @@
 
 TEST_F(DiagFormatterTest, SimpleNewlineAtEnd) {
   Formatter fmt{{false, false, false, true}};
-  auto got = fmt.format(List{diag_info, diag_warn, diag_err});
+  auto got = fmt.format(List{diag_note, diag_warn, diag_err});
   auto* expect = R"(1:14: purr
 2:14: grrr
 3:16 abc123: hiss
@@ -68,7 +68,7 @@
 
 TEST_F(DiagFormatterTest, SimpleNoSource) {
   Formatter fmt{{false, false, false, false}};
-  Diagnostic diag{Severity::Info, Source{}, "no source!"};
+  Diagnostic diag{Severity::Note, Source{}, "no source!"};
   auto got = fmt.format(List{diag});
   auto* expect = "no source!";
   ASSERT_EQ(expect, got);
@@ -76,7 +76,7 @@
 
 TEST_F(DiagFormatterTest, WithFile) {
   Formatter fmt{{true, false, false, false}};
-  auto got = fmt.format(List{diag_info, diag_warn, diag_err});
+  auto got = fmt.format(List{diag_note, diag_warn, diag_err});
   auto* expect = R"(file.name:1:14: purr
 file.name:2:14: grrr
 file.name:3:16 abc123: hiss)";
@@ -85,8 +85,8 @@
 
 TEST_F(DiagFormatterTest, WithSeverity) {
   Formatter fmt{{false, true, false, false}};
-  auto got = fmt.format(List{diag_info, diag_warn, diag_err});
-  auto* expect = R"(1:14 info: purr
+  auto got = fmt.format(List{diag_note, diag_warn, diag_err});
+  auto* expect = R"(1:14 note: purr
 2:14 warning: grrr
 3:16 error abc123: hiss)";
   ASSERT_EQ(expect, got);
@@ -94,7 +94,7 @@
 
 TEST_F(DiagFormatterTest, WithLine) {
   Formatter fmt{{false, false, true, false}};
-  auto got = fmt.format(List{diag_info, diag_warn, diag_err});
+  auto got = fmt.format(List{diag_note, diag_warn, diag_err});
   auto* expect = R"(1:14: purr
 the cat says meow
              ^
@@ -112,8 +112,8 @@
 
 TEST_F(DiagFormatterTest, BasicWithFileSeverityLine) {
   Formatter fmt{{true, true, true, false}};
-  auto got = fmt.format(List{diag_info, diag_warn, diag_err});
-  auto* expect = R"(file.name:1:14 info: purr
+  auto got = fmt.format(List{diag_note, diag_warn, diag_err});
+  auto* expect = R"(file.name:1:14 note: purr
 the cat says meow
              ^