- Extract code for sorting and checking duplicate Records into a helper
function and update `collectProcModels` to use the helper.
- Update `FeatureKeyValues` to:
(a) Remove code for duplicate checks and use the helper.
(b) Trim features with empty name explicitly to be able to use
the helper.
- Make the sorting deterministic by using record name as a secondary
key for sorting, and re-enable SubtargetFeatureUniqueNames.td test
that was disabled due to the non-determinism of the error messages.
- Change wording of error message when duplicate records are found to
be source code position agnostic, since `First` may not be before
`Second` lexically.
26 lines
888 B
C++
26 lines
888 B
C++
//===- Utils.h - 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_UTILS_TABLEGEN_COMMON_UTILS_H
|
|
#define LLVM_UTILS_TABLEGEN_COMMON_UTILS_H
|
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
|
#include "llvm/ADT/StringRef.h"
|
|
|
|
namespace llvm {
|
|
class Record;
|
|
|
|
/// 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 sortAndReportDuplicates(MutableArrayRef<Record *> Records,
|
|
StringRef ObjectName);
|
|
|
|
} // namespace llvm
|
|
|
|
#endif // LLVM_UTILS_TABLEGEN_COMMON_UTILS_H
|