Move common functions shared by TableGen Option Emitter and Options library to Support: - Move `StrCmpOptionName` and base it on the existing version in OptTable.cpp, with an additional mode to control fall back to case insensitive comparison. - Add `StrCmpOptionPrefixes` to compare prefixes and use zip() to iterate through lists of prefixes. - Rename `CompareOptionRecords` to less ambiguous name `IsOptionRecordLess`. - Merge 2 back-to-back ifs with same condition in `IsOptionRecordLess`. Fixes https://github.com/llvm/llvm-project/issues/107723
19 lines
691 B
C++
19 lines
691 B
C++
//===- OptEmitter.h - Helper for emitting options ---------------*- 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_OPTEMITTER_H
|
|
#define LLVM_UTILS_TABLEGEN_COMMON_OPTEMITTER_H
|
|
|
|
namespace llvm {
|
|
class Record;
|
|
/// Return true of Option record \p A is ordered before \p B.
|
|
bool IsOptionRecordsLess(const Record *A, const Record *B);
|
|
} // namespace llvm
|
|
|
|
#endif // LLVM_UTILS_TABLEGEN_COMMON_OPTEMITTER_H
|