<div dir="ltr">Hi all,<div><br></div><div>Apparently the problem was that USRGen couldn't handle line directives.</div><div><br></div><div>I submitted a patch to fix it [0] but changes the format of the generated USR. </div><div><br></div><div>Any feedback is welcome.</div><div><br></div><div>[0] <a href="https://reviews.llvm.org/D42966">https://reviews.llvm.org/D42966</a></div><div><br></div><div>Thank you,</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-12-08 17:18 GMT+00:00 Mikhail Ramalho <span dir="ltr"><<a href="mailto:mikhail.ramalho@gmail.com" target="_blank">mikhail.ramalho@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all,<div><br></div><div>We're having some problems with the name generation for ParamVarDecls in our tool, can anyone give us some help?</div><div><br></div><div>A bit of context:</div><div><br></div><div>We use libTooling to generate the AST of a given program that we later convert to our format and do a number of analyses. </div><div><br></div><div>We also define a bunch of functions in every TU, so we don't get 'implicit function declaration' warnings/errors [0] by adding them to the preprocessor's predefines [1].</div><div><br></div><div>We want to use clang to generate the name of every declaration (VarDecl, ParmVar, <wbr>FunctionDecl and maybe FieldDecl as well), and it seems to work fine for everything except the code we just added to the preprocessor, i.e.:</div><div><br></div><div>FunctionDecl 0x3ad9620 <esbmc_intrinsics.h:3:1, col:61> col:6 __ESBMC_assert 'void (_Bool, const char *)'<br></div><div><div>|-ParmVarDecl 0x3a84c48 <col:21, col:27> col:27 assertion '_Bool'</div><div>`-ParmVarDecl 0x3a84cc0 <col:38, col:50> col:50 description 'const char *'</div><div><br></div><div>Name: c:@F@__ESBMC_assert</div><div><br></div><div>~</div><div><br></div><div>ParmVarDecl 0x3a84c48 <esbmc_intrinsics.h:3:21, col:27> col:27 assertion '_Bool'</div><div>Name: c:</div><div><br></div><div>~</div><div><br></div><div>ParmVarDecl 0x3a84cc0 <esbmc_intrinsics.h:3:38, col:50> col:50 description 'const char *'</div><div>Name: c:</div></div><div><br></div><div>~</div><div><br></div><div>We do: </div><div><br></div><div><div>clang::SmallString<128> declUSR;</div><div>bool ret = clang::index::<wbr>generateUSRForDecl(&d, declUSR); (void)ret;</div><div><br></div><div>and ret is false, meaning it actually failed. </div></div><div><br></div><div>At first, we thought it was because of the missing filename, so we added to our predefines: </div><div><br></div><div> "# 1 \"esbmc_intrinsics.h\" 1\n"<br></div><div><br></div><div>But it's still not working.</div><div><br></div><div>~</div><div><br></div><div>I had a look at the code maybe it's related to the printLoc function [2]? It fails if it can't find the fileEntry in the SourceManager.</div><div><br></div><div>Any clue how to make it work? I'm currently trying to add a file named esbmc_intrinsics.h to the VFS and see if it fixes the issue.</div><div><br></div><div>Thank you,</div><div><br></div><div>[0] <a href="https://github.com/esbmc/esbmc/blob/master/src/clang-c-frontend/clang_c_language.cpp#L204" target="_blank">https://github.com/esbmc/<wbr>esbmc/blob/master/src/clang-c-<wbr>frontend/clang_c_language.cpp#<wbr>L204</a><br clear="all"><div>[1] <a href="https://github.com/esbmc/esbmc/blob/master/src/clang-c-frontend/AST/esbmc_action.h#L28" target="_blank">https://github.com/esbmc/<wbr>esbmc/blob/master/src/clang-c-<wbr>frontend/AST/esbmc_action.h#<wbr>L28</a></div><div>[2] <a href="https://clang.llvm.org/doxygen/USRGeneration_8cpp_source.html#l00026" target="_blank">https://clang.llvm.org/<wbr>doxygen/USRGeneration_8cpp_<wbr>source.html#l00026</a></div><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_4921738469561900315gmail_signature"><div dir="ltr"><div><br></div><div>Mikhail Ramalho.</div></div></div>
</font></span></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><br></div><div>Mikhail Ramalho.</div></div></div>
</div>