xref: /freebsd-src/contrib/llvm-project/lldb/utils/TableGen/LLDBTableGenUtils.cpp (revision 5b27928474e6a4103d65b347544705c40c9618fd)
1*9dba64beSDimitry Andric //===- LLDBTableGenUtils.cpp ----------------------------------------------===//
2*9dba64beSDimitry Andric //
3*9dba64beSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*9dba64beSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*9dba64beSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*9dba64beSDimitry Andric //
7*9dba64beSDimitry Andric //===----------------------------------------------------------------------===//
8*9dba64beSDimitry Andric 
9*9dba64beSDimitry Andric #include "LLDBTableGenUtils.h"
10*9dba64beSDimitry Andric #include "llvm/TableGen/Record.h"
11*9dba64beSDimitry Andric 
12*9dba64beSDimitry Andric using namespace llvm;
13*9dba64beSDimitry Andric using namespace lldb_private;
14*9dba64beSDimitry Andric 
getRecordsByName(std::vector<Record * > Records,StringRef Name)15*9dba64beSDimitry Andric RecordsByName lldb_private::getRecordsByName(std::vector<Record *> Records,
16*9dba64beSDimitry Andric                                              StringRef Name) {
17*9dba64beSDimitry Andric   RecordsByName Result;
18*9dba64beSDimitry Andric   for (Record *R : Records)
19*9dba64beSDimitry Andric     Result[R->getValueAsString(Name).str()].push_back(R);
20*9dba64beSDimitry Andric   return Result;
21*9dba64beSDimitry Andric }
22