[cfe-dev] Where is clang_CompileCommand_getNumMappedSources?
    Charlie Turner via cfe-dev 
    cfe-dev at lists.llvm.org
       
    Fri May  5 13:00:54 PDT 2017
    
    
  
Hi all,
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
$ 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
tc.cpp:21: error: undefined reference to
'clang_CompileCommand_getNumMappedSources'
I'm a tad baffled by this because the complimentary functions
clang_CompileCommand_getMappedSourcePath and
clang_CompileCommand_getMappedSourceContent do exist.
In the pre-built package I'm using (4.0.0, see above), it seems the thing
doesn't exist at all?
$ strings clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-16.04/lib/* | grep
clang_CompileCommand | sort -u
clang_CompileCommand_getArg
clang_CompileCommand_getDirectory
clang_CompileCommand_getFilename
clang_CompileCommand_getMappedSourceContent
clang_CompileCommand_getMappedSourcePath
clang_CompileCommand_getNumArgs
clang_CompileCommands_dispose
clang_CompileCommands_getCommand
clang_CompileCommands_getSize
Am I going crazy? Where is it? :)
tc.cpp:
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <clang-c/CXCompilationDatabase.h>
int main() {
  CXCompilationDatabase db;
  CXCompilationDatabase_Error err;
  const char *build_dir;
  build_dir = ".";
  db = clang_CompilationDatabase_fromDirectory(build_dir, &err);
  if (err != CXCompilationDatabase_NoError) {
    exit(1);
  }
  CXCompileCommands cmds =
clang_CompilationDatabase_getAllCompileCommands(db);
  unsigned num_commands = clang_CompileCommand_getNumArgs(cmds);
  assert(num_commands > 0);
  printf("%d\n",
clang_CompileCommand_getNumMappedSources(clang_CompileCommands_getCommand(cmds,
0)));
  return 0;
}
Kind regards & TIA,
/Charlie.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170505/2d387f01/attachment.html>
    
    
More information about the cfe-dev
mailing list