xref: /llvm-project/llvm/utils/TableGen/Common/Utils.h (revision 3ae71d154e5dfb5e5a5d27b3699b27ce2b55f44d)
1 //===- Utils.h - Common Utilities -------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_UTILS_TABLEGEN_COMMON_UTILS_H
10 #define LLVM_UTILS_TABLEGEN_COMMON_UTILS_H
11 
12 #include "llvm/ADT/ArrayRef.h"
13 #include "llvm/ADT/StringRef.h"
14 
15 namespace llvm {
16 class Record;
17 
18 /// Sort an array of Records on the "Name" field, and check for records with
19 /// duplicate "Name" field. If duplicates are found, report a fatal error.
20 void sortAndReportDuplicates(MutableArrayRef<const Record *> Records,
21                              StringRef ObjectName);
22 
23 } // namespace llvm
24 
25 #endif // LLVM_UTILS_TABLEGEN_COMMON_UTILS_H
26