File indexing completed on 2026-05-10 08:44:36
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef LLVM_TABLEGEN_STRINGMATCHER_H
0014 #define LLVM_TABLEGEN_STRINGMATCHER_H
0015
0016 #include "llvm/ADT/StringRef.h"
0017 #include <string>
0018 #include <utility>
0019 #include <vector>
0020
0021 namespace llvm {
0022
0023 class raw_ostream;
0024
0025
0026
0027
0028
0029
0030 class StringMatcher {
0031 public:
0032 using StringPair = std::pair<std::string, std::string>;
0033
0034 private:
0035 StringRef StrVariableName;
0036 const std::vector<StringPair> &Matches;
0037 raw_ostream &OS;
0038
0039 public:
0040 StringMatcher(StringRef strVariableName,
0041 const std::vector<StringPair> &matches, raw_ostream &os)
0042 : StrVariableName(strVariableName), Matches(matches), OS(os) {}
0043
0044 void Emit(unsigned Indent = 0, bool IgnoreDuplicates = false) const;
0045
0046 private:
0047 bool EmitStringMatcherForChar(const std::vector<const StringPair *> &Matches,
0048 unsigned CharNo, unsigned IndentCount,
0049 bool IgnoreDuplicates) const;
0050 };
0051
0052 }
0053
0054 #endif