<div dir="ltr">Hi Manuel and Benjamin,<div><br></div><div>Is this available on clang 3.8? (I'm building clang 3.8 now to try it out)</div><div><br></div><div>Is it too much trouble if you could provide some example? Do you simply add code from builtin headers content and map to a virtual file with the same name?</div><div><br></div><div>Thank you,</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-02-02 16:13 GMT+00:00 Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.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">Benjamin has added virtual fs capabilities that should enable us to be virtually overlay the builtin headers while still doing a normal header search (we are successfully doing that).<div><br><div class="gmail_quote"><div><div class="h5"><div dir="ltr">On Tue, Feb 2, 2016 at 4:58 PM Mikhail Ramalho via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hello all,<div><br></div><div>I'm using clang as a frontend to parse C and C++ code, which I convert to an internal format that my tool understand.</div><div><br></div><div>Since the beginning of the development, there was the problem including the builtin headers to the compilation which I kinda fix with a code to search for headers on the system.</div><div><br></div><div>The problem is that we ship the binary, including static and dynamic versions, which requires that the users to have clang installed on their machines. It's OK for the dynamic version but for the static one it's a bad solution.</div><div><br></div><div>So, right now I only found this two solutions:</div><div><br></div><div>1. Either the user must have clang installed in their machines (which I can't tell if there will be a problem about using headers from different versions of clang).</div><div><br></div><div>2. Ship all the builtin headers, even for the static version, and hard code a path for them from the binary (like clang does).</div><div><br></div><div>Is it possible to implement a third solution: circumvent the requirement for all the builtin headers? I even tried to copy the builitin headers as virtualFiles, but it doesn't work.</div><div><br></div><div>I'm using the following code to generate the AST:</div><div><br></div><div>bool llvm_languaget::parse(const std::string& path)</div><div>{</div><div>  // Finish the compiler string</div><div>  std::vector<std::string> compiler_string;</div><div>  build_compiler_string(compiler_string);</div><div><br></div><div>  clang::tooling::FixedCompilationDatabase Compilations("./", compiler_string);<br></div><div><br></div><div>  std::vector<std::string> sources;</div><div>  sources.push_back("/esbmc_intrinsics.h");</div><div>  sources.push_back(path);</div><div><br></div><div>  clang::tooling::ClangTool Tool(Compilations, sources);</div><div>  Tool.mapVirtualFile("/esbmc_intrinsics.h", intrinsics);</div><div><br></div><div>  Tool.buildASTs(ASTs);</div><div><br></div><div>  // Use diagnostics to find errors, rather than the return code.</div><div>  for (const auto &astunit : ASTs) {</div><div>    if (astunit->getDiagnostics().hasErrorOccurred()) {</div><div>      std::cerr << std::endl;</div><div>      return true;</div><div>    }</div><div>  }</div><div><br></div><div>  return false;</div><div>} </div><div><div><br></div><div>I already use VirtualFile to map some variables and function declarations but it doesn't work if add, for example, the code from stddef.h and map to a virtual stddef.h.</div><div><br></div><div>Thank you,</div><div><br></div>-- <br><div><div dir="ltr"><div><br></div><div>Mikhail Ramalho.</div></div></div>
</div></div></div></div>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><br></div><div>Mikhail Ramalho.</div></div></div>
</div>