Skip to content

Commit 55c2e01

Browse files
[Localization] Add comments
1 parent 493d102 commit 55c2e01

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/AST/LocalizationFormat.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ template <> struct ScalarEnumerationTraits<LocalDiagID> {
4848
#include "swift/AST/DiagnosticsAll.def"
4949
// Ignore diagnostic IDs that are available in the YAML file and not
5050
// available in the `.def` file.
51-
if (!io.outputting() && io.matchEnumFallback())
51+
if (io.matchEnumFallback())
5252
value = LocalDiagID::NumDiags;
5353
}
5454
};
@@ -106,6 +106,10 @@ readYAML(llvm::yaml::IO &io, T &Seq, bool, Context &Ctx) {
106106
yamlize(io, current, true, Ctx);
107107
io.postflightElement(SaveInfo);
108108

109+
// A diagnostic ID might be present in YAML and not in `.def` file,
110+
// if that's the case ScalarEnumerationTraits will assign the diagnostic ID
111+
// to `LocalDiagID::NumDiags`. Since the diagnostic ID isn't available
112+
// in `.def` it shouldn't be stored in the diagnostics array.
109113
if (current.id != LocalDiagID::NumDiags) {
110114
// YAML file isn't guaranteed to have diagnostics in order of their
111115
// declaration in `.def` files, to accommodate that we need to leave

0 commit comments

Comments
 (0)