GCC Middle and Back End API Reference
godump.c File Reference

Data Structures

struct  macro_hash_value
struct  godump_container

Functions

static hashval_t macro_hash_hashval ()
static int macro_hash_eq ()
static void macro_hash_del ()
static int string_hash_eq ()
static void go_define ()
static void go_undef ()
static void go_decl ()
static void go_function_decl ()
static void go_global_decl ()
static void go_type_decl ()
static void go_append_string ()
static bool go_format_type (struct godump_container *container, tree type, bool use_type_name, bool is_func_ok)
static void go_output_type ()
static void go_output_fndecl ()
static void go_output_typedef ()
static void go_output_var ()
static int go_print_macro ()
static void keyword_hash_init ()
static bool find_dummy_types ()
static void go_finish ()
struct gcc_debug_hooksdump_go_spec_init ()

Variables

static struct gcc_debug_hooks go_debug_hooks
static struct gcc_debug_hooksreal_debug_hooks
static FILE * go_dump_file
static vec< tree, va_gc > * queue
static htab_t macro_hash
static const char *const keywords []

Function Documentation

static bool find_dummy_types ( )
static
Traversing the pot_dummy_types and seeing which types are present
   in the global types hash table and creating dummy definitions if
   not found.  This function is invoked by pointer_set_traverse.   

References go_dump_file, godump_container::invalid_hash, and godump_container::type_hash.

Referenced by go_finish().

static void go_append_string ( )
static
Append an IDENTIFIER_NODE to OB.   

Referenced by go_format_type().

static void go_decl ( )
static
A function or variable decl.   

References queue, and vec_safe_push().

Referenced by go_function_decl(), and go_global_decl().

static bool go_format_type ( struct godump_container container,
tree  type,
bool  use_type_name,
bool  is_func_ok 
)
static
Write the Go version of TYPE to CONTAINER->TYPE_OBSTACK.
   USE_TYPE_NAME is true if we can simply use a type name here without
   needing to define it.  IS_FUNC_OK is true if we can output a func
   type here; the "func" keyword will already have been added.  Return
   true if the type can be represented in Go, false otherwise.   

References godump_container::decls_seen, go_append_string(), host_integerp(), HOST_WIDE_INT_PRINT_DEC, godump_container::invalid_hash, godump_container::keyword_hash, obstack, pointer_set_contains(), pointer_set_insert(), godump_container::pot_dummy_types, prototype_p(), snprintf(), stdarg_p(), strlen(), tree_int_cst_sgn(), tree_low_cst(), and godump_container::type_obstack.

Referenced by go_output_fndecl(), go_output_typedef(), and go_output_var().

static void go_function_decl ( )
static
A function decl.   

References gcc_debug_hooks::function_decl, and go_decl().

Referenced by dump_go_spec_init().

static void go_global_decl ( )
static
A global variable decl.   

References gcc_debug_hooks::global_decl, and go_decl().

Referenced by dump_go_spec_init().

static void go_output_fndecl ( )
static
Output a function declaration.   

References go_dump_file, go_format_type(), and go_output_type().

Referenced by go_finish().

static void go_output_type ( )
static
Output the type which was built on the type obstack, and then free
   it.   

References go_dump_file, obstack, and godump_container::type_obstack.

Referenced by go_output_fndecl(), go_output_typedef(), and go_output_var().

static int go_print_macro ( )
static
Output the final value of a preprocessor macro or enum constant.
   This is called via htab_traverse_noresize.   

References go_dump_file, macro_hash_value::name, and macro_hash_value::value.

Referenced by go_finish().

static void go_type_decl ( )
static
A type declaration.   

References queue, gcc_debug_hooks::type_decl, and vec_safe_push().

Referenced by dump_go_spec_init().

static void go_undef ( )
static
static void keyword_hash_init ( )
static

References count, godump_container::keyword_hash, and keywords.

Referenced by go_finish().

static void macro_hash_del ( )
static
Free values deleted from the macro hash table.   

References macro_hash_value::name, and macro_hash_value::value.

Referenced by dump_go_spec_init(), go_define(), and go_output_typedef().

static int macro_hash_eq ( )
static
Compare values in the macro hash table for equality.   

References macro_hash_value::name.

Referenced by dump_go_spec_init().

static hashval_t macro_hash_hashval ( )
static
Calculate the hash value for an entry in the macro hash table.   

References macro_hash_value::name.

Referenced by dump_go_spec_init().

static int string_hash_eq ( )
static
For the string hash tables.   

Referenced by go_finish().


Variable Documentation

struct gcc_debug_hooks go_debug_hooks
static
@verbatim Output Go language descriptions of types.

Copyright (C) 2008-2013 Free Software Foundation, Inc. Written by Ian Lance Taylor iant@.nosp@m.goog.nosp@m.le.co.nosp@m.m.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.

This file is used during the build process to emit Go language
   descriptions of declarations from C header files.  It uses the
   debug info hooks to emit the descriptions.  The Go language
   descriptions then become part of the Go runtime support
   library.

   All global names are output with a leading underscore, so that they
   are all hidden in Go.   
We dump this information from the debug hooks.  This gives us a
   stable and maintainable API to hook into.  In order to work
   correctly when -g is used, we build our own hooks structure which
   wraps the hooks we need to change.   
Our debug hooks.  This is initialized by dump_go_spec_init.   

Referenced by dump_go_spec_init().

FILE* go_dump_file
static
const char* const keywords[]
static
Initial value:
{
"__asm__", "break", "case", "chan", "const", "continue", "default",
"defer", "else", "fallthrough", "for", "func", "go", "goto", "if",
"import", "interface", "map", "package", "range", "return", "select",
"struct", "switch", "type", "var"
}
Build a hash table with the Go keywords.   

Referenced by keyword_hash_init().

htab_t macro_hash
static
A hash table of macros we have seen.   

Referenced by dump_go_spec_init(), go_define(), go_finish(), go_output_typedef(), and go_undef().

struct gcc_debug_hooks* real_debug_hooks
static
The real debug hooks.