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

Neal Sidhwaney via llvm-dev llvm-dev at lists.llvm.org
Sun Dec 19 17:01:40 PST 2021


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

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


More information about the llvm-dev mailing list