试图理解GCC-XML输出变量的含义
Trying to understand GCC-XML OutPut Variables Meaning
当我在GCC_XML上运行头文件时,我会得到以下输出:
<GCC_XML cvs_revision="1.135"><Namespace id="_1" name="::" members="_3 _4 _5 _6 _7 _8 _9 _10 _11 _12 _13 _14 _16 _17 _18 _19 _20 _21 _22 _23 _24 _25 _26 _27 _29 _31 _32 _33 _35 _36 _37 _38 _39 _40 _41 _42 _43 _44 _46 _47 _48 _49 _50 _52 _53 _54 _55 _56 _57 _58 _59 _60 _61 _62 _63 _64 _66 _67 _68 _69 _70 _71 _72 _73 _74 _75 _76 _77 _78 _79 _80 _81 _82 _83 _84 _85 _86 _87 _88 _89 _90 _91 _93 _94 _95 _96 _97 _98 _99 _100 _101 _103 _104 _105 _106 _107 _108 _109 _110 _111 _112 _113 _114 _115 _116 _117 _118 _119 _120 _121 _122 _123 _124 _125 _126 _127 _128 _129 _130 _131 _132 _133 _134 _135 _136 _137 _138 _139 _140 _141 _142 _143 _144 _145 _146 _147 _148 _149 _150 _151 _152 _153 _154 _155 _156 _157 _2 _158 _159 _160 _161 _162 _163 _164 _165 _166 _167 _168 _169 _170 _171 _173 _174 _175 _176 _177 _178 _179 _181 _182 _183 _184 _185 _186 _187 _188 _189 _190 _191 _192 _193 _194 _195 _196 _197 _198 _200 _201 _202 _203 _204 _205 _206 _207 _208 _209 _210 _211 _212 _213 _214 _216 _217 _218 _219 _220 _221 _222 _223 _224 _225 _226 _227 _228 _229 _230 _231 _232 _233 _234 _235 _236 _237 _238 _239 _240 _241 _242 _243 _244 _245 _246 _247 _248 _249 _250 _252 " mangled="_Z2::" demangled="::"/>
<Namespace id="_2" name="std" context="_1" members="" mangled="_Z3std" demangled="std"/>
<Function id="_3" name="__builtin_nans" returns="_253" context="_1" location="f0:21" file="f0" line="21" extern="1" attributes="nothrow const nonnull">
<Argument name="str" type="_254" location="f0:21" file="f0" line="21"/>
</Function><Function id="_4" name="__builtin_acosf" returns="_255" context="_1" mangled="acosf" location="f0:25" file="f0" line="25" extern="1" attributes="nothrow"><Argument type="_255" location="f0:25" file="f0" line="25"/></Function>
<Function id="_5" name="__builtin_acosl" returns="_256" context="_1" mangled="acosl" location="f0:26" file="f0" line="26" extern="1" attributes="nothrow"><Argument type="_256" location="f0:26" file="f0" line="26"/></Function><Function id="_6" name="__builtin_va_arg_pack" returns="_257" context="_1" location="f0:147" file="f0" line="147" extern="1"><Ellipsis/></Function>
<Function id="_7" name="__builtin_log10" returns="_253" context="_1" mangled="log10" location="f0:63" file="f0" line="63" extern="1" attributes="nothrow">
<Argument type="_253" location="f0:63" file="f0" line="63"/>
现在我的主要问题是这些值代表什么,例如,我得到Argument type="_253"
(_253(代表什么?我找不到任何有用的文档或对输出的解释,所以任何提示都将不胜感激。
这些数字是文件中其他内容的标识符。为了了解_253,您必须找到一个具有id="_253"
的XML元素。它很可能是一个类型定义或内置类型。
示例:
此CXX:
struct EmptyClass {};
int a_function(float f, EmptyClass e)
{
}
int main(void)
{
return 0;
}
编译成以下XML:
<?xml version="1.0"?>
<GCC_XML>
<Namespace id="_1" name="::" members="_2 _3 _4 "/>
<Function id="_2" name="main" returns="_5" context="_1" location="f0:8"/>
<Function id="_3" name="a_function" returns="_5" context="_1" location="f0:4">
<Argument name="f" type="_6"/>
<Argument name="e" type="_4"/>
</Function>
<Struct id="_4" name="EmptyClass" context="_1" location="f0:1" members="_7 _8 " bases=""/>
<FundamentalType id="_5" name="int"/>
<FundamentalType id="_6" name="float"/>
<Constructor id="_7" name="EmptyClass" context="_4" location="f0:1">
<Argument name="_ctor_arg" type="_9"/>
</Constructor>
<Constructor id="_8" name="EmptyClass" context="_4" location="f0:1"/>
<ReferenceType id="_9" type="_4c"/>
<File id="f0" name="example1.cxx"/>
</GCC_XML>
如果您查看函数main
:的属性元素
<Function id="_2" name="main" returns="_5" context="_1" location="f0:8"/>
它的返回类型是returns="_5"
,所以您必须在XML中找到一个具有id="_5"
的元素。请注意,它可能在之前的,也可能在您当前查看的之后的.还请注意,编译器的不同运行可能会为相同类型产生不同的标识符。在这种情况下:
<FundamentalType id="_5" name="int"/>
其含义应该是显而易见的:_5
是类型int
:所以main
返回int
。
一种不同的类型来自:
<ReferenceType id="_9" type="_4c"/>
这是对类型id="_4c"
的引用,但没有这样的类型。id="_4"
类型的const
版本(即c
(很简单:
<Struct id="_4" name="EmptyClass" context="_1" location="f0:1" members="_7 _8 " bases=""/>
因此类型id="_9"
是对名为"EmptyClass"的常量结构的引用,即const EmptyClass &
。
我希望这现在更有意义。
相关文章:
- 为什么我不能在不创建字符串变量的情况下使用函数的字符串输出
- 使用静态变量的递归调用的不同输出
- C++具有模板成员变量的类. 和参数内存输出
- 更改输出的变量
- 如何在C++中访问作用域的变量输出?
- 简化C++包括变量名称和函数输出的模式
- C++ - 输出与初始化变量不同?
- 是否可以在C++中基于程序集输出(.dll或.exe)定义变量
- 当对字符变量使用toupper()时,所述char变量输出多个字符.我该如何防止这种情况发生
- 如何让变量随机输出四个单词之一
- 输出(用于 GraphViz)提升图顶点及其属性,使用具有私有变量的类作为捆绑属性
- 如何将C++输出捕获到 Bash 变量?
- 当我在循环内打印变量时无限输出
- 字符串比较在与变量一起使用时给出不同的输出
- 双变量输出 32767 始终代替用户输入
- 使用std :: ofstream中的c 中的float变量输出
- C++:Xcode中未初始化的变量输出为0
- C++转义字符和引用变量输出混淆
- 矢量类C++的变量输出不正确
- 硬编码变量输出中没有反斜杠,但在文件输出中存在