Reorder and shrink size of NameLen field in diagnostic group table. Shaves ~4K from clang binary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189445 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Basic/DiagnosticIDs.cpp b/lib/Basic/DiagnosticIDs.cpp
index 9741f38..cccf418 100644
--- a/lib/Basic/DiagnosticIDs.cpp
+++ b/lib/Basic/DiagnosticIDs.cpp
@@ -502,11 +502,8 @@
 }
 
 struct clang::WarningOption {
-  // Be safe with the size of 'NameLen' because we don't statically check if
-  // the size will fit in the field; the struct size won't decrease with a
-  // shorter type anyway.
-  size_t NameLen;
   const char *NameStr;
+  uint16_t NameLen;
   uint16_t Members;
   uint16_t SubGroups;
 
@@ -558,7 +555,9 @@
 bool DiagnosticIDs::getDiagnosticsInGroup(
     StringRef Group,
     SmallVectorImpl<diag::kind> &Diags) const {
-  WarningOption Key = { Group.size(), Group.data(), 0, 0 };
+  if (Group.size() > UINT16_MAX)
+    return true; // Option is too long to be one in the table.
+  WarningOption Key = { Group.data(), (uint16_t)Group.size(), 0, 0 };
   const WarningOption *Found =
   std::lower_bound(OptionTable, OptionTable + OptionTableSize, Key,
                    WarningOptionCompare);