How can I use incremental compiler?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I use incremental compiler?

Tomohiro Matsuyama
Hi all,

I'm working on C++ code completion in Emacs by using -code-completion-at option.
I know C++ is not fully supported yet, but It seems work well (I'm
looking forward it).
However, I have also found that incremental compiler is not seen, which is the
most important part for code-completion.

So, where can I find incremental compiler? And how can I use it to
make code-completion
faster? If you don't implement it yet, how can I start to implement it?
Actually, all what I need is just incremental parser, not incremental compiler.

I am a newbie for this field. All knowledge currently I have are:

* GCC
  GCC is too complicated and too slow. It is almost impossible to implement
  incremental compiler/parser. Two challenges existed: "A Gcc Compile
Server" and
  "IncrementalCompiler". However, they are outdated.

* Elsa/Elkhound
  A GLR parser for C++ based on Elkhound. I have read a thread "clang
leveraging Elsa?",
  and I understand what clang team is trying to accomplish. Of course,
it is very good
  for code-completion. So, I don't want to extend Elsa anymore.

* EDG C++
  This is one of C++ front ends for commercial use. It has good
compatibilities with
  many other C++ compilers, and I guess it has an incremental compiler
also. Xrefactory,
  which is refactoring tool for C++, uses it internally. Recently,
Visual C++ Team decided
  to use EDG front end for its compiler and intellisense. It will be
available on VS2010.
  Well, it is closed. No anymore talks here.

Xrefactory: http://xref-tech.com/xrefactory/main.html
Rebuilding Intellisense:
http://blogs.msdn.com/vcblog/archive/2009/05/27/rebuilding-intellisense.aspx

I don't like LLVM's license, but I'm really really looking forward
to it, as I said. I want C++ compiler which never segv when compling
C++ source codes...

Anyway, could you please give me information or advice?

Regards,
Tomohiro
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: How can I use incremental compiler?

Douglas Gregor

On Feb 18, 2010, at 3:10 AM, Tomohiro Matsuyama wrote:

Hi all,

I'm working on C++ code completion in Emacs by using -code-completion-at option.
I know C++ is not fully supported yet, but It seems work well (I'm
looking forward it).
However, I have also found that incremental compiler is not seen, which is the
most important part for code-completion.

So, where can I find incremental compiler? And how can I use it to
make code-completion
faster?

Clang does not support incremental compilation, although that's certainly a long-term goal.

First, obvious question: are you using a Release build of Clang, rather than a Debug build? There's more than an order of magnitude of difference between the two, and I've found a Release build to be reasonably responsive.

If you don't implement it yet, how can I start to implement it?

Here are three ideas:

  - First, start with precompiled headers. You can build a precompiled header for the file you're code-completing in (which consists of, say, all of the #includes at the top). Then, Clang doesn't have to parse that code each time you run code-completion. Precompiled headers aren't yet implemented for C++, so that would be the right place to start.

  - Second, teach Clang how to skip parsing function bodies when performing code completion, caching or throwing away the tokens if the code-completion token isn't within that function definition. Here, you'd hook into Clang's Parse module where it parses a function definition. That should eliminate a lot of work that won't affect how code-completion behaves.

  - Finally, consider real incremental parsing. It's going to be tricky, because you  would need to teach both Parse and Sema how to pretend that they're in a particular compilation context to re-parse the code you're in (e.g., if you're inside a function definition). I recommend trying this only if the other two, combined, don't make code-completion fast enough for you.

Actually, all what I need is just incremental parser, not incremental compiler.

Parsing and semantic analysis will need to be incremental for code completion to work. You won't need incremental code generation.

- Doug

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: How can I use incremental compiler?

Ahmed Charles
Here's a blog (with links to more articles) about how VC2010 is implementing features like this, if you're interested:

http://blogs.msdn.com/vcblog/archive/2009/05/27/rebuilding-intellisense.aspx

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev