<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" 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 tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> cfe-dev <cfe-dev-bounces@lists.llvm.org> on behalf of Charlie Turner via cfe-dev <cfe-dev@lists.llvm.org><br>
<b>Sent:</b> 05 May 2017 21:00<br>
<b>To:</b> cfe-dev@lists.llvm.org<br>
<b>Subject:</b> [cfe-dev] Where is clang_CompileCommand_getNumMappedSources?</font>
<div> </div>
</div>
<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>
</body>
</html>