GCC主要数据结构之cpp_reader

libcpp/internal.h

/* A cpp_reader encapsulates the "state" of a pre-processor run.    Applying cpp_get_token repeatedly yields a stream of pre-processor    tokens.  Usually, there is only one cpp_reader object active.  */ struct cpp_reader {   /* Top of buffer stack.  */   cpp_buffer *buffer;

  /* Overlaid buffer (can be different after processing #include).  */   cpp_buffer *overlaid_buffer;

  /* Lexer state.  */   struct lexer_state state;

  /* Source line tracking.  */   struct line_maps *line_table;

  /* The line of the '#' of the current directive.  */   source_location directive_line;

  /* Memory buffers.  */   _cpp_buff *a_buff;  /* Aligned permanent storage.  */   _cpp_buff *u_buff;  /* Unaligned permanent storage.  */   _cpp_buff *free_buffs; /* Free buffer chain.  */

  /* Context stack.  */   struct cpp_context base_context;   struct cpp_context *context;

  /* If in_directive, the directive if known.  */   const struct directive *directive;

  /* Token generated while handling a directive, if any. */   cpp_token directive_result;

  /* When expanding a macro at top-level, this is the location of the      macro invocation.  */   source_location invocation_location;

  /* This is the node representing the macro being expanded at      top-level.  The value of this data member is valid iff      in_macro_expansion_p() returns TRUE.  */   cpp_hashnode *top_most_macro_node;

  /* Nonzero if we are about to expand a macro.  Note that if we are      really expanding a macro, the function macro_of_context returns      the macro being expanded and this flag is set to false.  Client      code should use the function in_macro_expansion_p to know if we      are either about to expand a macro, or are actually expanding      one.  */   bool about_to_expand_macro_p;

  /* Search paths for include files.  */   struct cpp_dir *quote_include; /* "" */   struct cpp_dir *bracket_include; /* <> */   struct cpp_dir no_search_path; /* No path.  */

  /* Chain of all hashed _cpp_file instances.  */   struct _cpp_file *all_files;

  struct _cpp_file *main_file;

  /* File and directory hash table.  */   struct htab *file_hash;   struct htab *dir_hash;   struct file_hash_entry_pool *file_hash_entries;

  /* Negative path lookup hash table.  */   struct htab *nonexistent_file_hash;   struct obstack nonexistent_file_ob;

  /* Nonzero means don't look for #include "foo" the source-file      directory.  */   bool quote_ignores_source_dir;

  /* Nonzero if any file has contained #pragma once or #import has      been used.  */   bool seen_once_only;

  /* Multiple include optimization.  */   const cpp_hashnode *mi_cmacro;   const cpp_hashnode *mi_ind_cmacro;   bool mi_valid;

  /* Lexing.  */   cpp_token *cur_token;   tokenrun base_run, *cur_run;   unsigned int lookaheads;

  /* Nonzero prevents the lexer from re-using the token runs.  */   unsigned int keep_tokens;

  /* Buffer to hold macro definition string.  */   unsigned char *macro_buffer;   unsigned int macro_buffer_len;

  /* Descriptor for converting from the source character set to the      execution character set.  */   struct cset_converter narrow_cset_desc;

  /* Descriptor for converting from the source character set to the      UTF-8 execution character set.  */   struct cset_converter utf8_cset_desc;

  /* Descriptor for converting from the source character set to the      UTF-16 execution character set.  */   struct cset_converter char16_cset_desc;

  /* Descriptor for converting from the source character set to the      UTF-32 execution character set.  */   struct cset_converter char32_cset_desc;

  /* Descriptor for converting from the source character set to the      wide execution character set.  */   struct cset_converter wide_cset_desc;

  /* Date and time text.  Calculated together if either is requested.  */   const unsigned char *date;   const unsigned char *time;

  /* EOF token, and a token forcing paste avoidance.  */   cpp_token avoid_paste;   cpp_token eof;

  /* Opaque handle to the dependencies of mkdeps.c.  */   struct deps *deps;

  /* Obstack holding all macro hash nodes.  This never shrinks.      See identifiers.c */   struct obstack hash_ob;

  /* Obstack holding buffer and conditional structures.  This is a      real stack.  See directives.c.  */   struct obstack buffer_ob;

  /* Pragma table - dynamic, because a library user can add to the      list of recognized pragmas.  */   struct pragma_entry *pragmas;

  /* Call backs to cpplib client.  */   struct cpp_callbacks cb;

  /* Identifier hash table.  */   struct ht *hash_table;

  /* Expression parser stack.  */   struct op *op_stack, *op_limit;

  /* User visible options.  */   struct cpp_options opts;

  /* Special nodes - identifiers with predefined significance to the      preprocessor.  */   struct spec_nodes spec_nodes;

  /* Whether cpplib owns the hashtable.  */   bool our_hashtable;

  /* Traditional preprocessing output buffer (a logical line).  */   struct   {     unsigned char *base;     unsigned char *limit;     unsigned char *cur;     source_location first_line;   } out;

  /* Used for buffer overlays by traditional.c.  */   const unsigned char *saved_cur, *saved_rlimit, *saved_line_base;

  /* A saved list of the defined macros, for dependency checking      of precompiled headers.  */   struct cpp_savedstate *savedstate;

  /* Next value of __COUNTER__ macro. */   unsigned int counter;

  /* Table of comments, when state.save_comments is true.  */   cpp_comment_table comments;

  /* List of saved macros by push_macro.  */   struct def_pragma_macro *pushed_macros;

  /* If non-null, the lexer will use this location for the next token      instead of getting a location from the linemap.  */   source_location *forced_token_location_p; };

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值