OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [go/] [gofrontend/] [ast-dump.h] - Blame information for rev 714

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 714 jeremybenn
// ast-dump.h -- AST debug dump.    -*- C++ -*-
2
 
3
// Copyright 2011 The Go Authors. All rights reserved.
4
// Use of this source code is governed by a BSD-style
5
// license that can be found in the LICENSE file.
6
 
7
#ifndef GO_AST_DUMP_H
8
#define GO_AST_DUMP_H
9
 
10
#include "string-dump.h"
11
 
12
class Expression;
13
class Expression_list;
14
class Named_object;
15
class Statement;
16
class Gogo;
17
 
18
// This class implements fgo-dump-ast. the
19
// Abstract syntax tree dump of the Go program.
20
 
21
class Ast_dump_context : public String_dump
22
{
23
 public:
24
  Ast_dump_context(std::ostream* out = NULL, bool dump_subblocks = true);
25
 
26
  // Initialize the dump context.
27
  void
28
  dump(Gogo*, const char* basename);
29
 
30
  // Dump spaces to dumpfile as indentation.
31
  void
32
  print_indent();
33
 
34
  // Increase current indentation for print_indent().
35
  void
36
  indent()
37
  { ++this->indent_;}
38
 
39
  // Decrease current indentation for print_indent().
40
  void
41
  unindent()
42
  { --this->indent_;}
43
 
44
  // Whether subblocks should be dumped or not.
45
  bool
46
  dump_subblocks()
47
  { return this->dump_subblocks_; }
48
 
49
  // Get dump output stream.
50
  std::ostream&
51
  ostream()
52
  { return *this->ostream_;}
53
 
54
  // Dump a Block to dump file.
55
  void
56
  dump_block(Block*);
57
 
58
  // Dump a type to dump file.
59
  void
60
  dump_type(const Type*);
61
 
62
  // Dump an expression to dump file.
63
  void
64
  dump_expression(const Expression*);
65
 
66
  // Dump an expression list to dump file.
67
  void
68
  dump_expression_list(const Expression_list*, bool as_pairs = false);
69
 
70
  // Dump a typed identifier to dump file.
71
  void
72
  dump_typed_identifier(const  Typed_identifier*);
73
 
74
  // Dump a typed identifier list to dump file.
75
  void
76
  dump_typed_identifier_list(const Typed_identifier_list*);
77
 
78
  // Dump temporary variable name to dump file.
79
  void
80
  dump_temp_variable_name(const Statement*);
81
 
82
  // Dump unamed lable name to dump file.
83
  void
84
  dump_label_name(const Unnamed_label*);
85
 
86
  // Dump operator symbol to dump file.
87
  void
88
  dump_operator(Operator);
89
 
90
  // Implementation of String_dump interface.
91
  void
92
  write_c_string(const char*);
93
 
94
  // Implements the String_dump interface.
95
  void
96
  write_string(const std::string& s);
97
 
98
  // Dump statement to stream.
99
  static void
100
  dump_to_stream(const Statement*, std::ostream*);
101
 
102
  // Dump expression to stream.
103
  static void
104
  dump_to_stream(const Expression* expr, std::ostream* out);
105
 
106
 private:
107
   // Current indent level.
108
  int indent_;
109
 
110
  // Indentation offset.
111
  static const int offset_;
112
 
113
  // Whether subblocks of composite statements should be dumped or not.
114
  bool dump_subblocks_;
115
 
116
  // Stream on output dump file.
117
  std::ostream* ostream_;
118
 
119
  Gogo* gogo_;
120
};
121
 
122
#endif  // GO_AST_DUMP_H

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.