Files
llvm/utils/TableGen/TableGenBackend.cpp
T

42 lines
1.5 KiB
C++
Raw Normal View History

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