<div dir="ltr"><div class="gmail_quote"><div>+Val <br></div><div><br></div><div>On Mon, May 8, 2017 at 12:37 PM Alex L via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Note that `clang_CompileCommand_getNumMappedSources` and the 2 complementary functions should return 0 / empty strings because the mapped sources aren't currently used in Clang. In fact, there's a patch at <a href="https://reviews.llvm.org/D32351" target="_blank">https://reviews.llvm.org/D32351</a> that removes them completely (but preserves the libclang API). So while the fact that `clang_CompileCommand_getNumMappedSources` is not exposed in the exports file is bug, should it really be fixed if it was not (and if that patch will land won't be) used by anyone?</div></blockquote><div><br></div><div>I agree that we should either delete it or fix it. Generally, with an API like this, people will only use it once it works :) The idea is that if you have non-file-system means to get your code in, you cannot do that without this API.</div><div><br></div><div>Looping in a libclang user (Val) to give an opinion on why this might / might not be a useful feature to have.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_extra"><br><div class="gmail_quote">On 8 May 2017 at 11:07, Ranjeet Singh via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div id="m_-2198064968782570980m_-623026393703729518divtagdefaultwrapper" style="font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols" dir="ltr">
<p>Hi Charlie,</p>
<p><br>
</p>
<p>looks like the function '<span>clang_CompileCommand_getNumMappedSources</span>' hasn't been added to the libclang exports file in libclang.exports so isn't exposed externally in libclang.so. Patch <span>c519ef864 added the other 2 complimentary functions
 but missed '*_getNumMappedSources'. </span></p>
<p><span><br>
</span></p>
<p><br>
</p>
<p>Thanks,</p>
<p>Ranjeet</p>
<div style="color:rgb(0,0,0)">
<hr style="display:inline-block;width:98%">
<div id="m_-2198064968782570980m_-623026393703729518divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> cfe-dev <<a href="mailto:cfe-dev-bounces@lists.llvm.org" target="_blank">cfe-dev-bounces@lists.llvm.org</a>> on behalf of Charlie Turner via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br>
<b>Sent:</b> 05 May 2017 21:00<br>
<b>To:</b> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<b>Subject:</b> [cfe-dev] Where is clang_CompileCommand_getNumMappedSources?</font>
<div> </div>
</div><div><div class="m_-2198064968782570980h5">
<div>
<div dir="ltr">
<div class="gmail_default" style="font-family:monospace,monospace">Hi all,<br>
<br>
</div>
<div class="gmail_default" style="font-family:monospace,monospace">I'm trying a quick experiment with clang-c and I've noticed something that seems weird. If I compile the program at the end of this email like so<br>
<br>
</div>
<div class="gmail_default" style="font-family:monospace,monospace">$ g++ -Iclang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-16.04/include -g -Wall tc.cpp -Lclang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-16.04/lib -lclang -o tc<br>
tc.cpp:21: error: undefined reference to 'clang_CompileCommand_getNumMappedSources'<br>
<br>
</div>
<div class="gmail_default" style="font-family:monospace,monospace">I'm a tad baffled by this because the complimentary functions clang_CompileCommand_getMappedSourcePath and clang_CompileCommand_getMappedSourceContent do exist.<br>
<br>
</div>
<div class="gmail_default" style="font-family:monospace,monospace">In the pre-built package I'm using (4.0.0, see above), it seems the thing doesn't exist at all?<br>
<br>
$ strings clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-16.04/lib/* | grep clang_CompileCommand | sort -u<br>
clang_CompileCommand_getArg<br>
clang_CompileCommand_getDirectory<br>
clang_CompileCommand_getFilename<br>
clang_CompileCommand_getMappedSourceContent<br>
clang_CompileCommand_getMappedSourcePath<br>
clang_CompileCommand_getNumArgs<br>
clang_CompileCommands_dispose<br>
clang_CompileCommands_getCommand<br>
clang_CompileCommands_getSize<br>
<br>
</div>
<div class="gmail_default" style="font-family:monospace,monospace">Am I going crazy? Where is it? :)<br>
<br>
</div>
<div class="gmail_default" style="font-family:monospace,monospace">tc.cpp:<br>
#include <stdlib.h><br>
#include <stdio.h><br>
#include <assert.h><br>
#include <clang-c/CXCompilationDatabase.h><br>
<br>
int main() {<br>
  CXCompilationDatabase db;<br>
  CXCompilationDatabase_Error err;<br>
  const char *build_dir;<br>
<br>
  build_dir = ".";<br>
  db = clang_CompilationDatabase_fromDirectory(build_dir, &err);<br>
<br>
  if (err != CXCompilationDatabase_NoError) {<br>
    exit(1);<br>
  }<br>
<br>
  CXCompileCommands cmds = clang_CompilationDatabase_getAllCompileCommands(db);<br>
  unsigned num_commands = clang_CompileCommand_getNumArgs(cmds);<br>
  assert(num_commands > 0);<br>
  printf("%d\n", clang_CompileCommand_getNumMappedSources(clang_CompileCommands_getCommand(cmds, 0)));<br>
<br>
  return 0;<br>
}<br>
<br>
</div>
<div class="gmail_default" style="font-family:monospace,monospace"><br>
</div>
<div class="gmail_default" style="font-family:monospace,monospace">Kind regards & TIA,<br>
<br>
</div>
<div class="gmail_default" style="font-family:monospace,monospace">/Charlie.<br>
</div>
</div>
</div>
</div></div></div>
</div>
</div>

<br>_______________________________________________<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>
<br></blockquote></div><br></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>