Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

Does any one have interests to build a clang plugin for CC

(1/3) > >>

ollydbg:
I just create a simple cb project(console), and modified the c-index-test.c file a little to let it build.
I just added it as the attachment. (I have tested under Loaden's MinGW)

If you would like to try, I think the only thing you need is to adjust the "include search path" and the "lib search path", beside that, every thing should work fine. (sure, you need a llvm+clang lib)

to briefly understand what lib clang can supply, you can see the:
http://llvm.org/devmtg/2010-11/
especially Doug Gregor's PDF and Video.

Linking to libclang's lib is not quite difficult, but the main difficult thing is some need to create a framework for the C::B plugin. so that we  can do simple test on that. (including codecompletion test, find reference test, loop throuth the top level declaration, we can get the symbol tree structure....... clang can give use very precise result, it is amazing)

I personally don't has too much time on it, but if someone can create a frame work, than I think I can add many bricks, especially we can reuse many code snippet from the current CodeCompletion plugin.

any ideas??

thanks.


ollydbg:
Hi, no body was interested on this topic?? :(

I create a minimal sample, which has a simple interpreter to show how codecompletion works. My project was linked to clang's index.

see https://quexparser.googlecode.com/svn/trunk/clang


Now, here is my test code: (test.cpp)

--- Code: ---#include <vector>
using namespace std;




class AAA
{
public:
   int aaa;
   int bbb;
};


int myfunction()
{
  AAA a;
  //a.
  std::vector<AAA> b;
  b[1].
  return 0;
}

--- End code ---

and here is the log output:

--- Quote ---code completion demo project with lib clang support!!! asmwarrior
ollydbg from codeblocks forum

it will bydefault open the test.cpp file!
* to show the code completion list, please enter the command
cc line column [ENTER]
* to exit, just enterexit [ENTER]
cc 20 8
ClassDecl:{TypedText AAA}{Text ::} (75)
FieldDecl:{ResultType int}{TypedText aaa} (35)
FieldDecl:{ResultType int}{TypedText bbb} (35)
CXXMethod:{ResultType AAA &}{TypedText operator=}{LeftParen (}{Placeholder const
 AAA &}{RightParen )} (34)
CXXDestructor:{ResultType void}{TypedText ~AAA}{LeftParen (}{RightParen )} (34)


--- End quote ---

Please note I have use a feature called:
CXTranslationUnit_PrecompiledPreamble

Here is the explanation:

--- Quote ---   

Used to indicate that the translation unit should be built with an implicit precompiled header for the preamble.

An implicit precompiled header is used as an optimization when a particular translation unit is likely to be reparsed many times when the sources aren't changing that often. In this case, an implicit precompiled header will be built containing all of the initial includes at the top of the main file (what we refer to as the "preamble" of the file). In subsequent parses, if the preamble or the files in it have not changed, clang_reparseTranslationUnit() will re-use the implicit precompiled header to improve parsing performance.

--- End quote ---

see:
clang: clang: Translation unit manipulation

Even you edit the source file, then a implicit PCH will build internally. So, the performance is quite good.

ollydbg/asmwarrior



ollydbg:
Here is another question:

clang and llvm has a bsd style license, but C::B is under GPL.

So, if we implement a plugin link to clang and llvm library, are there any conflict???

If so, I would choose some other alternative.

oBFusCATed:
The SDK is LGPL 3.0.
And I think these two licenses are compatible, so you can use BSD libs in GPL/LGPL code.
Because BSD is the less restrictive license, the other way round is not possible (all code becomes GPL'ed).

But you should ask the FSF or some other competent organization. Also read the GPL FAQ.

ollydbg:

--- Quote from: oBFusCATed on January 20, 2011, 08:57:11 am ---The SDK is LGPL 3.0.
And I think these two licenses are compatible, so you can use BSD libs in GPL/LGPL code.
Because BSD is the less restrictive license, the other way round is not possible (all code becomes GPL'ed).

But you should ask the FSF or some other competent organization. Also read the GPL FAQ.

--- End quote ---
thanks.

so the new clang plugin's source code will released under BSD? or GPL?

The big problem is: currently no one was interested on this plugin. :(

Navigation

[0] Message Index

[#] Next page

Go to full version