このページを編集する際は,編集に関する方針に従ってください.[]
概要[]
- gcc-4.1.0/gcc/tree.cにて定義
- ある式にたいしてファイル名と行番号の情報を付加する
- node->exp.locusのfile,lineを設定する
引数[]
- tree node
- const char *file
- int line
実装[]
3134 /* Record the exact location where an expression or an identifier were
3135 encountered. */
式または識別子が遭遇された正確な場所を記録してください。
3136
3137 void
3138 annotate_with_file_line (tree node, const char *file, int line)
3139 {
~
3140 /* Roughly one percent of the calls to this function are to annotate
3141 a node with the same information already attached to that node!
3142 Just return instead of wasting memory. */
この関数への呼び出しのおよそ1パーセントは、すでにそのノードに付けられる同じ情報で、
ノードに注釈をつけることになっています!
ちょっと記憶を浪費する代わりに、返ってください。
*nodeとline,fileの情報がいっしょなので、終了
3143 if (EXPR_LOCUS (node)
3144 && EXPR_LINENO (node) == line
3145 && (EXPR_FILENAME (node) == file
3146 || !strcmp (EXPR_FILENAME (node), file)))
3147 {
3148 last_annotated_node = EXPR_LOCUS (node);
3149 return;
3150 }
3151
~
3152 /* In heavily macroized code (such as GCC itself) this single
3153 entry cache can reduce the number of allocations by more
3154 than half. */
かなりmacroizedされたコード(例えばGCC自体)では、
このシングルエントリキャッシュは、半分より多くのものによって、配分の数を減らすことができます
3155 if (last_annotated_node
3156 && last_annotated_node->line == line
3157 && (last_annotated_node->file == file
3158 || !strcmp (last_annotated_node->file, file)))
3159 {
*上書き
3160 SET_EXPR_LOCUS (node, last_annotated_node);
3161 return;
3162 }
3163
~
3164 SET_EXPR_LOCUS (node, ggc_alloc (sizeof (location_t)));
3165 EXPR_LINENO (node) = line;
3166 EXPR_FILENAME (node) = file;
3167 last_annotated_node = EXPR_LOCUS (node);
3168 }