c++ - Configure Eclipse CDT or Codeblocks to get LLVM IR intellisense -
i want configure eclipse (or codeblocks) when write pass, can @ least take advantage of intellisense (even if building passes directly within eclipse not possible). update: getting @ least intellisense once enabled parsing-based proposals in eclipse (details below)
so far have configured eclipse use clang compile simple c++ programs.
to intellisense llvm pass, added /usr/local/include includes directories , tried code:
#include <iostream> #include <llvm/ir/function.h> using namespace std: int main() { cout << "hello world" << endl; return 0; } it doesn't fail on #include <llvm/ir/function.h> (i.e. can find header file), upon including subsequent files, gives me
/usr/local/include/llvm/support/datatypes.h:58:3: error: "must #define __stdc_limit_macros before #including support/datatypes.h" any pointers how make give me intellisense @ least?
complete log
01:22:48 **** rebuild of configuration debug project helloworld2 **** info: internal builder used build clang++ -i/usr/local/include -o0 -emit-llvm -g3 -wall -c -fmessage-length=0 -o src/helloworld2.bc ../src/helloworld2.cpp in file included ../src/helloworld2.cpp:10: in file included /usr/local/include/llvm/ir/function.h:22: in file included /usr/local/include/llvm/ir/argument.h:17: in file included /usr/local/include/llvm/adt/twine.h:14: /usr/local/include/llvm/support/datatypes.h:58:3: error: "must #define __stdc_limit_macros before #including support/datatypes.h" # error "must #define __stdc_limit_macros before #including support/datatypes.h" ^ /usr/local/include/llvm/support/datatypes.h:62:3: error: "must #define __stdc_constant_macros before " "#including support/datatypes.h" # error "must #define __stdc_constant_macros before " \ ^ in file included ../src/helloworld2.cpp:10: in file included /usr/local/include/llvm/ir/function.h:22: in file included /usr/local/include/llvm/ir/argument.h:19: in file included /usr/local/include/llvm/ir/attributes.h:19: in file included /usr/local/include/llvm/adt/arrayref.h:14: in file included /usr/local/include/llvm/adt/smallvector.h:20: /usr/local/include/llvm/support/mathextras.h:273:24: error: use of undeclared identifier 'int64_c' return n >= 64 || (-(int64_c(1)<<(n-1)) <= x && x < (int64_c(1)<<(n-1))); ^ /usr/local/include/llvm/support/mathextras.h:273:56: error: use of undeclared identifier 'int64_c' return n >= 64 || (-(int64_c(1)<<(n-1)) <= x && x < (int64_c(1)<<(n-1))); ^ /usr/local/include/llvm/support/mathextras.h:299:26: error: use of undeclared identifier 'uint64_c' return n >= 64 || x < (uint64_c(1)<<(n)); ^ /usr/local/include/llvm/support/mathextras.h:331:24: error: use of undeclared identifier 'int64_c' return n >= 64 || (-(int64_c(1)<<(n-1)) <= x && x < (int64_c(1)<<(n-1))); ^ /usr/local/include/llvm/support/mathextras.h:331:56: error: use of undeclared identifier 'int64_c' return n >= 64 || (-(int64_c(1)<<(n-1)) <= x && x < (int64_c(1)<<(n-1))); ^ in file included ../src/helloworld2.cpp:10: in file included /usr/local/include/llvm/ir/function.h:22: in file included /usr/local/include/llvm/ir/argument.h:19: in file included /usr/local/include/llvm/ir/attributes.h:19: in file included /usr/local/include/llvm/adt/arrayref.h:14: /usr/local/include/llvm/adt/smallvector.h:232:20: warning: rvalue references c++11 extension [-wc++11-extensions] void push_back(t &&elt) { ^ /usr/local/include/llvm/adt/smallvector.h:476:33: warning: rvalue references c++11 extension [-wc++11-extensions] iterator insert(iterator i, t &&elt) { ^ /usr/local/include/llvm/adt/smallvector.h:645:46: warning: rvalue references c++11 extension [-wc++11-extensions] smallvectorimpl &operator=(smallvectorimpl &&rhs); ^ /usr/local/include/llvm/adt/smallvector.h:383:12: warning: 'auto' type specifier c++11 extension [-wc++11-extensions] (auto = this->end(), e = this->begin() + n; != e; ++i) ^ /usr/local/include/llvm/adt/smallvector.h:764:70: warning: rvalue references c++11 extension [-wc++11-extensions] smallvectorimpl<t> &smallvectorimpl<t>::operator=(smallvectorimpl<t> &&rhs) { ^ /usr/local/include/llvm/adt/smallvector.h:878:27: warning: rvalue references c++11 extension [-wc++11-extensions] smallvector(smallvector &&rhs) : smallvectorimpl<t>(n) { ^ /usr/local/include/llvm/adt/smallvector.h:883:44: warning: rvalue references c++11 extension [-wc++11-extensions] const smallvector &operator=(smallvector &&rhs) { ^ in file included ../src/helloworld2.cpp:10: in file included /usr/local/include/llvm/ir/function.h:22: in file included /usr/local/include/llvm/ir/argument.h:19: in file included /usr/local/include/llvm/ir/attributes.h:20: in file included /usr/local/include/llvm/adt/foldingset.h:21: /usr/local/include/llvm/support/allocator.h:134:70: error: expected expression bumpptrallocatorimpl<allocatort, slabsize, sizethreshold>> { ^ /usr/local/include/llvm/support/allocator.h:346:2: error: expected type }; ^ /usr/local/include/llvm/support/allocator.h:346:2: error: expected class name /usr/local/include/llvm/support/allocator.h:346:2: error: expected '{' after base class list /usr/local/include/llvm/support/allocator.h:362:53: warning: rvalue references c++11 extension [-wc++11-extensions] specificbumpptrallocator(specificbumpptrallocator &&old) ^ /usr/local/include/llvm/support/allocator.h:366:64: warning: rvalue references c++11 extension [-wc++11-extensions] specificbumpptrallocator &operator=(specificbumpptrallocator &&rhs) { ^ /usr/local/include/llvm/support/allocator.h:375:5: warning: 'auto' type specifier c++11 extension [-wc++11-extensions] auto destroyelements = [](char *begin, char *end) { ^ /usr/local/include/llvm/support/allocator.h:375:28: error: expected expression auto destroyelements = [](char *begin, char *end) { ^ /usr/local/include/llvm/support/allocator.h:381:10: warning: 'auto' type specifier c++11 extension [-wc++11-extensions] (auto = allocator.slabs.begin(), e = allocator.slabs.end(); != e; ^ /usr/local/include/llvm/support/allocator.h:381:29: error: no member named 'slabs' in 'llvm::bumpptrallocatorimpl<llvm::mallocallocator, 4096, 4096>' (auto = allocator.slabs.begin(), e = allocator.slabs.end(); != e; ~~~~~~~~~ ^ /usr/local/include/llvm/support/allocator.h:381:58: error: no member named 'slabs' in 'llvm::bumpptrallocatorimpl<llvm::mallocallocator, 4096, 4096>' (auto = allocator.slabs.begin(), e = allocator.slabs.end(); != e; ~~~~~~~~~ ^ /usr/local/include/llvm/support/allocator.h:383:52: error: no member named 'computeslabsize' in 'llvm::bumpptrallocatorimpl<llvm::mallocallocator, 4096, 4096>' size_t allocatedslabsize = bumpptrallocator::computeslabsize( ~~~~~~~~~~~~~~~~~~^ /usr/local/include/llvm/support/allocator.h:384:35: error: no member named 'slabs' in 'llvm::bumpptrallocatorimpl<llvm::mallocallocator, 4096, 4096>' std::distance(allocator.slabs.begin(), i)); ~~~~~~~~~ ^ /usr/local/include/llvm/support/allocator.h:386:35: error: no member named 'slabs' in 'llvm::bumpptrallocatorimpl<llvm::mallocallocator, 4096, 4096>' char *end = *i == allocator.slabs.back() ? allocator.curptr ~~~~~~~~~ ^ /usr/local/include/llvm/support/allocator.h:386:60: error: no member named 'curptr' in 'llvm::bumpptrallocatorimpl<llvm::mallocallocator, 4096, 4096>' char *end = *i == allocator.slabs.back() ? allocator.curptr ~~~~~~~~~ ^ /usr/local/include/llvm/support/allocator.h:392:10: warning: 'auto' type specifier c++11 extension [-wc++11-extensions] (auto &ptrandsize : allocator.customsizedslabs) { ^ /usr/local/include/llvm/support/allocator.h:392:39: error: no member named 'customsizedslabs' in 'llvm::bumpptrallocatorimpl<llvm::mallocallocator, 4096, 4096>' (auto &ptrandsize : allocator.customsizedslabs) { ~~~~~~~~~ ^ /usr/local/include/llvm/support/allocator.h:392:27: warning: range-based loop c++11 extension [-wc++11-extensions] (auto &ptrandsize : allocator.customsizedslabs) { ^ fatal error: many errors emitted, stopping [-ferror-limit=] 13 warnings , 20 errors generated. 01:22:50 build finished (took 1s.509ms) update: eclipse give me intellisense (at least of it), had check parsing-based proposals in window -> preferences -> c/c++ -> editor -> content assist -> advanced (it unchecked default).
this not answering question directly, ensure, have correctly working build environment. specific code blocks.
first checkout source tree of llvm (directly taken getting started guide):
git clone http://llvm.org/git/llvm.git cd llvm/tools git clone http://llvm.org/git/clang.git cd .. cd projects git clone http://llvm.org/git/compiler-rt.git git clone http://llvm.org/git/libcxx.git git clone http://llvm.org/git/libcxxabi.git git clone http://llvm.org/git/test-suite.git git clone http://llvm.org/git/openmp.git remove don't like.
then create directory outside llvm directory:
cd .. mkdir build change directory (cd) there , run:
cd build cmake -g "codeblocks - unix makefiles" <your configure options> ../llvm assuming llvm shares root path, otherwise change ../llvm line correct path. open existing project in code::blocks.
if went well, build environment setup correctly , code completion should work.
Comments
Post a Comment