summaryrefslogtreecommitdiffstats
path: root/clang/tools/diagtool/TreeView.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/tools/diagtool/TreeView.cpp')
-rw-r--r--clang/tools/diagtool/TreeView.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/tools/diagtool/TreeView.cpp b/clang/tools/diagtool/TreeView.cpp
index 62981790304..10809c1d8d9 100644
--- a/clang/tools/diagtool/TreeView.cpp
+++ b/clang/tools/diagtool/TreeView.cpp
@@ -94,7 +94,12 @@ static int showGroup(llvm::raw_ostream &out, StringRef RootGroup,
bool FlagsOnly) {
ArrayRef<GroupRecord> AllGroups = getDiagnosticGroups();
- GroupRecord Key = { RootGroup.size(), RootGroup.data(), 0, 0 };
+ if (RootGroup.size() > UINT16_MAX) {
+ llvm::errs() << "No such diagnostic group exists\n";
+ return 1;
+ }
+
+ GroupRecord Key = { RootGroup.data(), (uint16_t)RootGroup.size(), 0, 0 };
const GroupRecord *Found =
std::lower_bound(AllGroups.begin(), AllGroups.end(), Key);
OpenPOWER on IntegriCloud