User forums > Using Code::Blocks
Another code completion problem
ollydbg:
--- Quote from: Neil Butterworth on August 14, 2011, 09:28:42 am ---> what does this sentence means?
I mean that CodeLite appears to have the same problem that CB does - a
using std::string;
does not allow for code completion on string variables, but
using namespace std;
does.
--- End quote ---
Ok, I see.
The fact that this feature is quite complex to implement is that it need symbol scope lookup in the context in the parser. our Codecompletion plugin's parser has not implemented this. It is hard to build a full c++ parser. :D
zabzonk:
I fully appreciate the difficulty, but real C++ code uses this feature a lot, and if it is not supported I think CB uptake will gradually fall off, as people seem to be using namespaces (or using libraries that require the use of namespaces) more and more..
While I'm at it, there is actually what I take to be an associated problem with the symbols browser. Given this code:
#include <string>
struct A {
void f( std::string );
};
using namespace std;
void A :: f( string ) {
}
The symbols browser shows two different functions called f when surely it should only show one.
eranif:
--- Quote from: Neil Butterworth on August 14, 2011, 09:28:42 am ---> what does this sentence means?
I mean that CodeLite appears to have the same problem that CB does - a
using std::string;
does not allow for code completion on string variables, but
using namespace std;
does.
--- End quote ---
Since you mentioned it, I need to correct you: if you enables codelite's clang support - the above sample works as expected
(only available in trunk version of codelite)
I too feels that writing a full blown c++ parser is just too much, so I took the path of clang as a "completion" for the built-in parser that I already have in codelite (I think that C::B should do the same)
Eran
ollydbg:
--- Quote from: eranif on August 17, 2011, 04:42:06 pm ---I too feels that writing a full blown c++ parser is just too much.
--- End quote ---
I totally agree on this. :D writing a full c++ parser is tooooo much.
--- Quote ---so I took the path of clang as a "completion" for the built-in parser that I already have in codelite (I think that C::B should do the same)
Eran
--- End quote ---
Some days ago, I tested the clang completion(in command line or link to libclang library), and it works fine.
Hope it was not much work to use clang in C::B.
eranif:
--- Quote ---Hope it was not much work to use clang in C::B.
--- End quote ---
The basics works fine.
But when I started trying playing with it responded very slow on large files with many include files
The key was to implement the caching for clang using an automated mechanism of PCH creation by stripping the include files from a source file and generate a dummy header file which will be used as our PCH file. The generated PCH is then "injected" to the command line by the -include switch.
Another thing to put it mind is to implement a mechanism that will invalidate the cache (some entries) when needed (e.g. new header file was added to the source file)
If you need assist, please free to email me or start a new thread about it.
Eran
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version