Use the new version of isSubClassOf
[oota-llvm.git] / support / tools / TableGen / TableGenBackend.cpp
1 //===- TableGenBackend.cpp - Base class for TableGen Backends ---*- C++ -*-===//
2 //
3 // This file provides useful services for TableGen backends...
4 //
5 //===----------------------------------------------------------------------===//
6
7 #include "TableGenBackend.h"
8 #include "Record.h"
9 #include <iostream>
10
11 void TableGenBackend::EmitSourceFileHeader(const std::string &Desc,
12                                            std::ostream &OS) const {
13   OS << "//===- TableGen'erated file -------------------------------------*-"
14        " C++ -*-===//\n//\n// " << Desc << "\n//\n// Automatically generate"
15        "d file, do not edit!\n//\n//===------------------------------------"
16        "----------------------------------===//\n\n";
17 }
18
19 /// getQualifiedName - Return the name of the specified record, with a
20 /// namespace qualifier if the record contains one.
21 ///
22 std::string TableGenBackend::getQualifiedName(Record *R) const {
23   std::string Namespace = R->getValueAsString("Namespace");
24   if (Namespace.empty()) return R->getName();
25   return Namespace + "::" + R->getName();
26 }
27