[llvm-dev] creating translation units using libclang/CXCompilationDatabase command lines

Neal Sidhwaney via llvm-dev llvm-dev at lists.llvm.org
Mon Dec 20 14:48:54 PST 2021


Ah, please disregard - it turns out two jobs were being created because I was passing the input file in two places, one in the source_filename parameter to clang_parseTranslationUnit2, as well as part of the args array created from the command line arguments.

Thank you,

Neal

> On Dec 19, 2021, at 6:01 PM, Neal Sidhwaney via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Hello,
> 
> I’m writing a library that uses libclang, and I’m running into an error when I try to use arguments from a CXCompilationDatabase to call clang_parseTranslationUnit2().  The error I’m getting is CXError_ASTReadError.  It seems to start at https://github.com/llvm/llvm-project/blob/main/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp#L85 <https://github.com/llvm/llvm-project/blob/main/clang/lib/Frontend/CreateInvocationFromCommandLine.cpp#L85>, as far as I can debug (Jobs.size() == 2 in this case).
> 
> The code I’m working on is here: https://github.com/nealsid/elclang/blob/main/elclang.c#L148 <https://github.com/nealsid/elclang/blob/main/elclang.c#L148> - I was wondering if anyone sees anything that I missed.  The output from line 142 in that same file is pasted below.  Thank you!
> 
> Neal
> 
> Arg: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
> Arg: --driver-mode=g++
> Arg: -DGTEST_HAS_RTTI=0
> Arg: -DHAVE_ROUND
> Arg: -DLLDB_CONFIGURATION_DEBUG
> Arg: -D_DEBUG
> Arg: -D__STDC_CONSTANT_MACROS
> Arg: -D__STDC_FORMAT_MACROS
> Arg: -D__STDC_LIMIT_MACROS
> Arg: -Itools/lldb/source/Host
> Arg: -I/Users/nealsid/src/github/llvm-project/lldb/source/Host
> Arg: -I/Users/nealsid/src/github/llvm-project/lldb/include
> Arg: -Itools/lldb/include
> Arg: -Iinclude
> Arg: -I/Users/nealsid/src/github/llvm-project/llvm/include
> Arg: -I/Users/nealsid/src/github/llvm-project/llvm/../clang/include
> Arg: -Itools/lldb/../clang/include
> Arg: -I/usr/local/include
> Arg: -I/Users/nealsid/src/github/llvm-project/lldb/source
> Arg: -Itools/lldb/source
> Arg: -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include
> Arg: -isystem
> Arg: /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/libxml2
> Arg: -fPIC
> Arg: -fvisibility-inlines-hidden
> Arg: -Werror=date-time
> Arg: -Werror=unguarded-availability-new
> Arg: -Wall
> Arg: -Wextra
> Arg: -Wno-unused-parameter
> Arg: -Wwrite-strings
> Arg: -Wcast-qual
> Arg: -Wmissing-field-initializers
> Arg: -pedantic
> Arg: -Wno-long-long
> Arg: -Wc++98-compat-extra-semi
> Arg: -Wimplicit-fallthrough
> Arg: -Wcovered-switch-default
> Arg: -Wno-noexcept-type
> Arg: -Wnon-virtual-dtor
> Arg: -Wdelete-non-virtual-dtor
> Arg: -Wsuggest-override
> Arg: -Wstring-conversion
> Arg: -Wmisleading-indentation
> Arg: -fdiagnostics-color
> Arg: -Wno-deprecated-declarations
> Arg: -Wno-unknown-pragmas
> Arg: -Wno-strict-aliasing
> Arg: -Wno-deprecated-register
> Arg: -Wno-vla-extension
> Arg: -g
> Arg: -isysroot
> Arg: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
> Arg: -fno-exceptions
> Arg: -fno-rtti
> Arg: -std=c++14
> Arg: -o
> Arg: tools/lldb/source/Host/CMakeFiles/lldbHost.dir/common/Editline.cpp.o
> Arg: -c
> Arg: /Users/nealsid/src/github/llvm-project/lldb/source/Host/common/Editline.cpp
> 
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211220/be385a2a/attachment.html>


More information about the llvm-dev mailing list