1 //===- TableGenBackend.cpp - Base class for TableGen Backends ---*- C++ -*-===//
3 // This file provides useful services for TableGen backends...
5 //===----------------------------------------------------------------------===//
7 #include "TableGenBackend.h"
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";
19 /// getQualifiedName - Return the name of the specified record, with a
20 /// namespace qualifier if the record contains one.
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();