1 //===- TableGenBackend.cpp - Base class for TableGen Backends ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file provides useful services for TableGen backends...
12 //===----------------------------------------------------------------------===//
14 #include "TableGenBackend.h"
18 void TableGenBackend::EmitSourceFileHeader(const std::string &Desc,
19 std::ostream &OS) const {
20 OS << "//===- TableGen'erated file -------------------------------------*-"
21 " C++ -*-===//\n//\n// " << Desc << "\n//\n// Automatically generate"
22 "d file, do not edit!\n//\n//===------------------------------------"
23 "----------------------------------===//\n\n";
26 /// getQualifiedName - Return the name of the specified record, with a
27 /// namespace qualifier if the record contains one.
29 std::string TableGenBackend::getQualifiedName(Record *R) const {
30 std::string Namespace = R->getValueAsString("Namespace");
31 if (Namespace.empty()) return R->getName();
32 return Namespace + "::" + R->getName();