diff options
author | Craig Topper <craig.topper@gmail.com> | 2013-08-28 06:01:10 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2013-08-28 06:01:10 +0000 |
commit | a3891a7568dc7e2fdaf8b4fe393a46ace396f95d (patch) | |
tree | ad5afd5a640a51fa57be384c6bd4b511f6a8bc2f /clang/lib/Basic/DiagnosticIDs.cpp | |
parent | 8a0caa8525f23b3661dbd8ff26826d05814f3a6d (diff) | |
download | bcm5719-llvm-a3891a7568dc7e2fdaf8b4fe393a46ace396f95d.tar.gz bcm5719-llvm-a3891a7568dc7e2fdaf8b4fe393a46ace396f95d.zip |
Reorder and shrink size of NameLen field in diagnostic group table. Shaves ~4K from clang binary.
llvm-svn: 189445
Diffstat (limited to 'clang/lib/Basic/DiagnosticIDs.cpp')
-rw-r--r-- | clang/lib/Basic/DiagnosticIDs.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/Basic/DiagnosticIDs.cpp b/clang/lib/Basic/DiagnosticIDs.cpp index 9741f38684d..cccf418f65f 100644 --- a/clang/lib/Basic/DiagnosticIDs.cpp +++ b/clang/lib/Basic/DiagnosticIDs.cpp @@ -502,11 +502,8 @@ DiagnosticIDs::getDiagnosticLevel(unsigned DiagID, unsigned DiagClass, } 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 @@ void DiagnosticIDs::getDiagnosticsInGroup( 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); |