Fix some stylistic issues with my last commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103164 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sean Hunt 2010-05-06 05:24:38 +00:00
parent 1ef7c82128
commit 44ed2c31a5
2 changed files with 81 additions and 73 deletions

View File

@ -1,10 +1,19 @@
//=== ClangASTNodesEmitter.cpp - Generate Clang AST node tables -*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// These tablegen backends emit Clang AST node tables
//
//===----------------------------------------------------------------------===//
#include "ClangASTNodesEmitter.h"
#include "Record.h"
#include <vector>
#include <stack>
#include <string>
#include <map>
#include <utility>
#include <cctype>
using namespace llvm;
@ -12,23 +21,23 @@ using namespace llvm;
// Statement Node Tables (.inc file) generation.
//===----------------------------------------------------------------------===//
// Sort to create a tree-like structure based on the 'Base' field.
namespace {
// Create a macro-ized version of a name
std::string macroName(std::string S) {
// Create a macro-ized version of a name
static std::string macroName(std::string S) {
for (unsigned i = 0; i < S.size(); ++i)
S[i] = std::toupper(S[i]);
return S;
}
}
// A map from a node to each of its derived nodes.
typedef std::multimap<Record*, Record*> ChildMap;
typedef ChildMap::const_iterator ChildIterator;
// A map from a node to each of its derived nodes.
typedef std::multimap<Record*, Record*> ChildMap;
typedef ChildMap::const_iterator ChildIterator;
// Returns the first and last non-abstract subrecords
std::pair<Record *, Record *> EmitStmtNode(const ChildMap &Tree,
raw_ostream &OS, Record *Base) {
// Returns the first and last non-abstract subrecords
// Called recursively to ensure that nodes remain contiguous
static std::pair<Record *, Record *> EmitStmtNode(const ChildMap &Tree,
raw_ostream &OS,
Record *Base) {
std::string BaseName = macroName(Base->getName());
ChildIterator i = Tree.lower_bound(Base), e = Tree.upper_bound(Base);
@ -92,7 +101,6 @@ namespace {
OS << "#undef LAST_" << BaseName << "\n\n";
return std::make_pair(First, Last);
}
}
void ClangStmtNodesEmitter::run(raw_ostream &OS) {

View File

@ -1,4 +1,4 @@
//===- ClangDiagnosticsEmitter.h - Generate Clang diagnostics tables -*- C++ -*-
//===- ClangASTNodesEmitter.h - Generate Clang AST node tables -*- C++ -*--===//
//
// The LLVM Compiler Infrastructure
//
@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
// These tablegen backends emit Clang diagnostics tables.
// These tablegen backends emit Clang AST node tables
//
//===----------------------------------------------------------------------===//