llvm/llvm/utils/TableGen/Common/Utils.cpp

//===- Utils.cpp - Common Utilities -----------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "Utils.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
#include <algorithm>

usingnamespacellvm;

namespace {
/// Sorting predicate to sort record pointers by their Name field, and break
/// ties using record ID (which corresponds to creation/parse order).
struct LessRecordFieldNameAndID {};
} // End anonymous namespace

/// Sort an array of Records on the "Name" field, and check for records with
/// duplicate "Name" field. If duplicates are found, report a fatal error.
void llvm::sortAndReportDuplicates(MutableArrayRef<Record *> Records,
                                   StringRef ObjectName) {}