cppit / libclangmm Goto Github PK
View Code? Open in Web Editor NEWlibclangmm - An easy to use C++-wrapper for libclang
License: MIT License
libclangmm - An easy to use C++-wrapper for libclang
License: MIT License
clang::Index
creates an instance of CXIndex
in its constructor.
However, it will never be freed.
Suggested fix:
Add a deconstructor and call clang_disposeIndex(cx_index)
in it.
On Fedora 26, CMake fails with the following output: (note: i'm using libclangmm as a submodule -- not that it should make any difference)
Searcing for libclang
CMake Error at libclangmm/src/CMakeLists.txt:12 (find_package):
By not providing "FindLibClang.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "LibClang",
but CMake did not find one.
Could not find a package configuration file provided by "LibClang" with any
of the following names:
LibClangConfig.cmake
libclang-config.cmake
Add the installation prefix of "LibClang" to CMAKE_PREFIX_PATH or set
"LibClang_DIR" to a directory containing one of the above files. If
"LibClang" provides a separate development package or SDK, be sure it has
been installed.
-- Configuring incomplete, errors occurred!
See also "clang-experiments/CMakeFiles/CMakeOutput.log".
Curiously enough, Fedora provides ClangConfig.cmake (without the Lib
). After modifying libclangmm's CMakeFiles to find_package(Clang)
, the build is successful, though I assume that breaks it for other distros.
For some reason, ClangConfig.cmake also pulls in static libLLVM as a dependency (130 MB!), although this isn't required if I link against libclang manually. Is there a way to bypass the find_package
altogether and specify libclang include/lib paths manually? (preferably without modifying libclangmm's CMakeLists)
Assertion failed: (Val && "isa<> used on a null pointer"), function doit, file /tmp/llvm20150628-7874-1qnjbb2/llvm-3.6.1.src/include/llvm/Support/Casting.h, line 95.
make[2]: *** No rule to make target '/usr/local/lib/libclang.so', needed by 'lib/libclangmm.so'γ stopγ
CMakeFiles/Makefile2:85: recipe for target 'src/CMakeFiles/clangmm.dir/all' failed
make[1]: *** [src/CMakeFiles/clangmm.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
Hi,
in the CmakeLists.txt file, LIBCLANGMM_BUILD_TESTS is incorrectly spelled in lowercase (line 14)
Main issues: circular includes, forward declarations and the library can be more c++ friendly. TranslationUnit becomes the main class with the following important methods:
clang::CodeCompleteResults get_code_completions(const std::map<std::string, std::string> &buffers, int line_number, int column);
std::vector<clang::Diagnostic> get_diagnostics();
std::unique_ptr<Tokens> get_tokens(unsigned start_offset, unsigned end_offset);
Also going to label all the CX* objects to for instance cx_tu instead of tu_.
$ ./clangmm_tests
Running 8 test cases...
/foo/bar/libclangmm/tests/TranslationUnit_Test.cc(18): error: in "translation_unit": check tu.ReparseTranslationUnit(buffer) == 0 has failed
unknown location(0): fatal error: in "completion_string": std::invalid_argument: clangmm::CodeCompleteResults::get(unsigned i): i>=size()
/foo/bar/libclangmm/tests/CompletionString_H_Test.cc(12): last checkpoint: "completion_string" entry.
/foo/bar/libclangmm/tests/CodeCompleteResults_H_Test.cc(32): error: in "code_complete_results": check substr_found has failed
/foo/bar/libclangmm/tests/Cursor_H_Test.cc(17): error: in "cursor": check cursor.get_kind() == clangmm::Cursor::Kind::ReturnStmt has failed
/foo/bar/libclangmm/tests/Token_H_Test.cc(14): error: in "token": check tokens->size() == 32 has failed
unknown location(0): fatal error: in "token": memory access violation at address: 0x00000030: no mapping at fault address
/foo/bar/libclangmm/tests/Token_H_Test.cc(15): last checkpoint
*** 6 failures are detected in the test module "clangmm_tests"
Linux stumble 4.9.0-2-amd64 #1 SMP Debian 4.9.18-1 (2017-03-30) x86_64 GNU/Linux
$ gcc --version
gcc (Debian 6.3.0-16) 6.3.0 20170425
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ clang --version
clang version 3.8.1-23 (tags/RELEASE_381/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Please create docs/install.md in this project
libclangmm does no longer compile on windows
The naming was chosen by the convention used by gnome for writing wrappers.
The mm's stands for minusminus which since the wrappers for gnome in the late 90's where named gtk-- instad of gtkmm.
I think this convention is sort of ugly, however I'm responsible for the name. So I'd like to hear some suggestions to naming of this project. If you already like the name, why not argue for it :)
Also the lib-prefix is kind of ugly.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.