-//===----------------------------------------------------------------------===//
-// Generic routines for all Clang TableGen backends.
-//===----------------------------------------------------------------------===//
-
-typedef std::vector<Record*> RecordVector;
-typedef std::vector<Record*> SuperClassVector;
-typedef std::vector<RecordVal> RecordValVector;
-
-static const RecordVal* findRecordVal(const Record& R, const std::string &key) {
- const RecordValVector &Vals = R.getValues();
- for (RecordValVector::const_iterator I=Vals.begin(), E=Vals.end(); I!=E; ++I)
- if ((*I).getName() == key)
- return &*I;
-
- return 0;
-}
-
-static const Record* getDiagKind(const Record* DiagClass, const Record &R) {
- const SuperClassVector &SC = R.getSuperClasses();
- for (SuperClassVector::const_iterator I=SC.begin(), E=SC.end(); I!=E; ++I)
- if ((*I)->isSubClassOf(DiagClass) &&
- (*I)->getName() != "DiagnosticControlled")
- return *I;
-
- return 0;
-}
-
-static void EmitEscaped(std::ostream& OS, const std::string &s) {
- for (std::string::const_iterator I=s.begin(), E=s.end(); I!=E; ++I)
- switch (*I) {
- default: OS << *I; break;
- case '\"': OS << "\\" << *I; break;
- case '\\': OS << "\\\\"; break;
- }
-}
-
-static void EmitAllCaps(std::ostream& OS, const std::string &s) {
- for (std::string::const_iterator I=s.begin(), E=s.end(); I!=E; ++I)
- OS << char(toupper(*I));
-}
-