1 //===- OptionStrCmp.h - Option String Comparison ----------------*- 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_SUPPORT_OPTIONSTRCMP_H 10 #define LLVM_SUPPORT_OPTIONSTRCMP_H 11 12 #include "llvm/ADT/ArrayRef.h" 13 #include "llvm/ADT/StringRef.h" 14 15 namespace llvm { 16 17 // Comparison function for Option strings (option names & prefixes). 18 // The ordering is *almost* case-insensitive lexicographic, with an exception. 19 // '\0' comes at the end of the alphabet instead of the beginning (thus options 20 // precede any other options which prefix them). Additionally, if two options 21 // are identical ignoring case, they are ordered according to case sensitive 22 // ordering if `FallbackCaseSensitive` is true. 23 int StrCmpOptionName(StringRef A, StringRef B, 24 bool FallbackCaseSensitive = true); 25 26 // Comparison function for Option prefixes. 27 int StrCmpOptionPrefixes(ArrayRef<StringRef> APrefixes, 28 ArrayRef<StringRef> BPrefixes); 29 30 } // namespace llvm 31 32 #endif // LLVM_SUPPORT_OPTIONSTRCMP_H 33