<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54759>54759</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Please guide me, how can I return the declaration of global variable in stmt way
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
leinjay
</td>
</tr>
</table>
<pre>
when i trave the astcontext with "RecursiveASTVisitor.h", i get the top level decl by "getTranslationUnitDecl", but it only return the decl of global var in the c++ source file, how can i get the declstmt of this decl, such as:
`using foo_name::CFoo;
// using std::vector;
int global = 10;
int main()
{
return 0;
}`
"global" is the global var in c++, how can i get the declstmt of "int global = 10"
please guide me or give me an example, thank you so much!
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyFUsGOmzAQ_RpzGTUiJsBy4JDdaKXeqnbba2VgAG-NHdljsvn7DiTpbtpDJUvYfvOe38yjcd25Po1oQQN5NSPQiKACtc4SvhGcNI0gpPyKbfRBz7j_9vJDB03Ob0a-F_KJqQPSSiR3BIMzGuiwNdCcFyqDL17ZYBRpZ79bTQcGr9wmEmgCZ80ZPFL0dhVa6a6HwbhGGZiVB31BWiEfeUFw0bcIvTa46IzuBK2yH7wsEoEmWmRo1GG9WEpDbEduUWR7kR5EuhdFGoO2A_TO_bRqwgXJ9k_Pzons8Vojn3nBpS5QdymZseU5_CnSlm6GRXaAbXqHTEpbIR-ErK6S5RWEW-Pv9aI8sKvb0_IiyhvgNpbe7sdyHcn_x8AK_3rkHNZ3jgZVYOmoO4QJwXkYOO9ly4L4pqbjZdQ0KvsLzi5yBjDxMIXcJl2ddVVWqYQ0Gay_3It9tPb575yVX3-M-7i1agwuza3eT-qcRG_qkei4BrfGMfC_GZtN6yY-GDPfPp-O3r1yNHzUIUQMvMl3ZV4lY43VLpVNWWybvJB9U1RF33fVtqvS8qHCIk-MatCEWuSPIj8kupaplOkuzbdZvpNy02UqzZCvWmbnZSd2KXKyZrM8vHF-SHy9emjiEBg0OlB4B1UIerCIN30VaXTMQG1fucfVbr16_Q1YwScZ">