<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">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><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_-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_<wbr>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_-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.<wbr>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_<wbr>getNumMappedSources?</font>
<div> </div>
</div><div><div class="h5">
<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-<wbr>linux-gnu-ubuntu-16.04/include -g -Wall tc.cpp -Lclang+llvm-4.0.0-x86_64-<wbr>linux-gnu-ubuntu-16.04/lib -lclang -o tc<br>
tc.cpp:21: error: undefined reference to 'clang_CompileCommand_<wbr>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_<wbr>getMappedSourcePath and clang_CompileCommand_<wbr>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-<wbr>gnu-ubuntu-16.04/lib/* | grep clang_CompileCommand | sort -u<br>
clang_CompileCommand_getArg<br>
clang_CompileCommand_<wbr>getDirectory<br>
clang_CompileCommand_<wbr>getFilename<br>
clang_CompileCommand_<wbr>getMappedSourceContent<br>
clang_CompileCommand_<wbr>getMappedSourcePath<br>
clang_CompileCommand_<wbr>getNumArgs<br>
clang_CompileCommands_dispose<br>
clang_CompileCommands_<wbr>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/<wbr>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_<wbr>fromDirectory(build_dir, &err);<br>
<br>
  if (err != CXCompilationDatabase_NoError) {<br>
    exit(1);<br>
  }<br>
<br>
  CXCompileCommands cmds = clang_CompilationDatabase_<wbr>getAllCompileCommands(db);<br>
  unsigned num_commands = clang_CompileCommand_<wbr>getNumArgs(cmds);<br>
  assert(num_commands > 0);<br>
  printf("%d\n", clang_CompileCommand_<wbr>getNumMappedSources(clang_<wbr>CompileCommands_getCommand(<wbr>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>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">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/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>