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

GCCSense is quite good!

<< < (2/2)

ollydbg:
here is another source I found which Can be really usefull to support our codecompletion plugin.

http://codesynthesis.com/~boris/blog/2010/05/10/parsing-cxx-with-gcc-plugin-part-2/

GCC's plugin system is really quite nice place to retrieve the full AST.

Edit
it seems the plugin framework does not work under windows by default, see:
http://gcc.gnu.org/ml/gcc/2010-07/msg00003.html

thomas:
We discussed this a few years ago, I think, when there was first talk about GCC running as server some day in the future (is this still planned?). The ability of dumping the intermediate language tree existed as something between an experimental patch and an idea in the form of xml-gcc then.

I'd very much like to see a code completion based on the compiler, since it is really the only thing that makes sense. However, it should not need to launch the compiler a thousand times, for performance reasons. And, before spending weeks/months on writing a tree-dump-parser, one should be sure that the gcc guys have frozen the format (which may take years).

ollydbg:

--- Quote from: thomas on January 24, 2011, 10:00:29 am ---We discussed this a few years ago, I think, when there was first talk about GCC running as server some day in the future (is this still planned?). The ability of dumping the intermediate language tree existed as something between an experimental patch and an idea in the form of xml-gcc then.
--- End quote ---
I have read those topics about using gcc, I also notices that TDM has doing some testing, but he said it take several seconds to parse the stl header. so he said this was not satisfied.
currently, gcc-xml project was not active, see:
http://www.gccxml.org/pipermail/gccxml/2010-November/001435.html
the author suggest using clang instead.


--- Quote ---I'd very much like to see a code completion based on the compiler, since it is really the only thing that makes sense. However, it should not need to launch the compiler a thousand times, for performance reasons. And, before spending weeks/months on writing a tree-dump-parser, one should be sure that the gcc guys have frozen the format (which may take years).

--- End quote ---
If we can use a PCH(or dynamically create a PCH), the speed of codecompletion can be quite nice. I have review the gccsense's patch against the gcc's parser. it does very simple thing.

The parser will normally skip any function body, but when the parser find a function body which embrace the current caret position, it will rollback to parse the current function body again.

But I think the AST tree structure can not help to do the codecompletion. then information need to do the completion is "the scope" information of the current caret position. I don't think the dumped AST has these information.

ollydbg:

--- Quote from: jens on December 05, 2010, 05:48:40 pm ---The proble I see is, that it uses it's on gcc-derivate (if I see it correctly) and that it is not (yet) available for windows.

--- End quote ---
I just create gccsense under windows, it works fine.
I create patches so it can apply on vanilla gcc 4.5.2 source.

See the attachment for more details. (includes patches and Howto) :D

ollydbg:
FYI:
here:
http://blogs.msdn.com/b/vcblog/archive/2010/01/26/precompiled-header-files-in-visual-studio-2010.aspx
but "reparse" the source file is quite tricky

--- Quote ---In order for the intellisense compiler to provide this information, the intellisense engine must initially parse the TU like the command-line compiler, recursively parsing all #include files listed at the top of the source file before parsing the rest of the source file.  Thanks to C++ scoping rules, we know that we can skip all method bodies except the one you might currently be in, but, other than this optimization, the rest of the translation unit must be parsed to give an accurate answer.  We refer to this as the “pre-parse.”

Pre-parses are not always required, as users spend much of their time writing code inside of a local scope.  Through careful tracking of user edits, we can say whether or not the user has changed information which requires a new pre-parse.  When this happens, we throw away our old pre-parse and start again.

--- End quote ---
it seems that code completion result can be reused if we don't change the "scope". :D, but we maybe need to track the "}".

Navigation

[0] Message Index

[*] Previous page

Go to full version