summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/DiagnosticIDs.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2013-08-28 06:01:10 +0000
committerCraig Topper <craig.topper@gmail.com>2013-08-28 06:01:10 +0000
commita3891a7568dc7e2fdaf8b4fe393a46ace396f95d (patch)
treead5afd5a640a51fa57be384c6bd4b511f6a8bc2f /clang/lib/Basic/DiagnosticIDs.cpp
parent8a0caa8525f23b3661dbd8ff26826d05814f3a6d (diff)
downloadbcm5719-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.cpp9
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);
OpenPOWER on IntegriCloud