95

Is there some C/C++ IDE for Windows, which is integrated with the LLVM compiler (and Clang C/C++ analyzer), just like modern Xcode do.

I have Dev-Cpp (it uses outdated GCC) and Code::Blocks (with some GCC). But GCC gives me very cryptic error messages. I want to get some more user-friendly error messages from the Clang frontend.

Yes, Clang was not able to be used with complex C++ code, but trunk Clang already can compile LLVM itself. So I wonder if is there any of LLVM IDEs in development or in beta versions.

Yes, I can use Clang as other compiler with GCC-compatible IDEs. But is there any IDE, that are integrated with Clang? Clang have a different output format, so the IDE must parse it. Clang can provide IDE parsing of sources. Clang has an analyze option, which must be supported in an IDE. Take a look, e.g http://iosdevelopertips.com/xcode/static-code-analysis-clang-and-xcode-3-2.html

And the most wanted feature of Clang - is smart auto-completion, so the IDE can suggest only syntaxilly-correct variants, e.g. list only fields of this struct, class.

Results: (merged from answers):

Cœur
  • 37,241
  • 25
  • 195
  • 267
osgx
  • 90,338
  • 53
  • 357
  • 513
  • 3
    I wonder if in the future, Emacs gains support for Clang. Btw there is an emacs minor-mode here https://llvm.org/svn/llvm-project/cfe/trunk/utils/clang-completion-mode.el though I haven't tested it myself. – ustun Jul 10 '10 at 11:22
  • Code::Blocks works with Clang. – James Harper Aug 26 '14 at 06:53

13 Answers13

59

LLVM is supported in Eclipse CDT via plug-in (llvm4eclipsecdt). It is the only Windows supported IDE supporting LLVM as far as I know. I am the main author of the plug-in so you can ask any questions related to it.

The plug-in offers the basic functionality for Clang and llvm-gcc compilation and support Linux and Windows (w/ Cygwin & MiNGW). LLVM tools such as assembler, archiver, linker, and static compiler (llc) are configured and can be customized via UI. The plug-in offers all the benefits that IDE can offer such as easy configuration and building with one action.

The only drawback is that it is not ready yet as it lacks of some of the advanced features that LLVM can offer such as Clang analyze and smart auto-completion. The plug-in is also not tested well and may not work perfectly therefore I hope I can get user feedback via mailing list found from Google code development site (listed below). I wish I had time to develop it further. I only develop it in my spare time, which is very limited. I welcome any developers to participate and contribute to the project.

Development site:
http://code.google.com/p/llvm4eclipsecdt/
https://github.com/TuononenP/llvm4eclipsecdt

Eclipse marketplace (100% free & open-source):
http://marketplace.eclipse.org/content/llvm-toolchain-eclipse-cdt

UPDATE: The plugin is deprecated. Instead install "C/C++ LLVM-Family Compiler Build Support" under Programming Languages using the official Eclipse update site e.g. http://download.eclipse.org/releases/mars

Petri Tuononen
  • 1,939
  • 1
  • 16
  • 19
  • Hi. Glad to see you here! You say "MinGW binaries are provided for LLVM and front-ends" - can you add (here or on google-code site) a link to mingw binaries of LLVM? – osgx May 12 '11 at 14:07
  • 1
    Also, about thesis from your blog. clang is not for ada or fortran: "For other languages, including Java, Fortran and Ada, LLVM remains dependent on GCC" – osgx May 12 '11 at 14:19
  • 2
    You can get mingw binaries for LLVM 2.9 from here: http://llvm.org/releases/download.html#2.9 – Petri Tuononen May 13 '11 at 07:58
  • 1
    Good note: you're right that LLVM-GCC is for other languages. I should have written that "LLVM compiles" with no specific front-end mentioned but I will remove Fortran and Ada from the abstract. – Petri Tuononen May 13 '11 at 08:03
  • You can also integrate the LLVM compiler with the Microsoft VS. Here is the link http://llvm.org/docs/GettingStartedVS.html. hope this helps. – Krishna Oza Aug 27 '14 at 05:09
21

LLVM contributor Dan Gohman recently added Clang code completion to vim.

http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/vim/vimrc is intended for use in developing LLVM itself and helps with the LLVM coding style, but the code completion portion should be easy enough to extract.

Yeah, yeah, vim isn't an IDE, but it may be useful to know about.

[edit] https://llvm.org/svn/llvm-project/cfe/trunk/utils/clang-completion-mode.el provides a similar option for emacs.

osgx
  • 90,338
  • 53
  • 357
  • 513
ohmantics
  • 1,799
  • 14
  • 16
11

Qt Creator works also with Clang...

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Kokizzu
  • 24,974
  • 37
  • 137
  • 233
  • Thanks, added to question. Can you say, from which version of QTcreator there is the support of clang? – osgx Mar 25 '12 at 22:15
  • 1
    2.4.1 would do.. on linux, you don't have to add clang tool chain manually.. here's the info how to add the toolchain if you're using windows: http://doc.qt.nokia.com/qtcreator-2.4/creator-tool-chains.html – Kokizzu Mar 26 '12 at 01:47
  • but it is only using it for auto complete and parsing – James Harper Aug 26 '14 at 06:51
9

Now they are adding support for Visual Studio link. It can be downloaded here.

relaxxx
  • 7,566
  • 8
  • 37
  • 64
5

Also, CodeLite has Clang backend for smart code completion. See Using clang code-completion with CodeLite.

CodeLite is available for Windows, however, I haven't tested it under Windows yet.

Michał Wróbel
  • 684
  • 4
  • 10
5

There isn't one for windows. But if you want smart auto-completion, netbeans has one of the best code completions for C++. It parses macros, generic containers, and smart pointers. Plus it provides refactoring, code insertion of constructors and getters and setters. It works really well. However, since it still uses a separate parser for C++, it doesn't catch as many errors as the compiler does.

Netbeans for java is integrated in with the compiler, so it gives errors and warnings as you type, as well as syntactically correct code completion. So, netbeans will very likely in the future integrate with clang to provide the same kind of features for C++.

Paul Fultz II
  • 17,682
  • 13
  • 62
  • 59
  • 2
    how does netbeans parse the source? Which C/C++ frontend does it use? – osgx Dec 24 '10 at 05:01
  • 3
    Yes netbeans parses the source itself for code completion. Perhaps in the future they will use clang for parsing, but that hasn't been integrated in yet. You can select different compilers for netbeans gcc or clang. I havent tried it with clang yet. – Paul Fultz II Dec 24 '10 at 14:45
5

LLVM support has been added to Eclipse: http://marketplace.eclipse.org/node/28778

osgx
  • 90,338
  • 53
  • 357
  • 513
4

May I add SublimeText 2? It already has a plugin SublimeClang that supports clang based smart code-completion.

Hindol
  • 2,924
  • 2
  • 28
  • 41
4

LLVM provides Windows snapshot builds - a clang toolset for Visual Studio as Windows installer. Currently it should integrate with Visual Studio 2010, 2012 and 2013. More information can be found on LLVM's blog post A path forward for an LLVM toolchain on Windows.

Paweł Bylica
  • 3,780
  • 1
  • 31
  • 44
4

KDevelop for Windows is another option. While still in early stages there (you currently need to set up the environment to be able to use MSVC/MinGW compilers yourself), it's usable and brings the awesome code comprehension of the IDE to Windows.

https://www.kdevelop.org/features

kfunk
  • 2,002
  • 17
  • 25
  • KDevelop works well with the llvm-mingw compiler in my winlua toolchain but I am still working on debugger support: http://winlua.net – Dinsdale Feb 15 '21 at 07:46
3

Clang has a driver that's (at least supposed to be) a direct substitute for gcc, so essentially any IDE that can use gcc as its compiler should be able to use clang as its compiler as well (though I haven't tested it personally, so I can't really vouch for how well it works).

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
  • 3
    But won't be able to use any features that are in addition to the standard toolset, such as code-analysis and tab-completion. – Mooing Duck Sep 04 '12 at 16:48
3

No.

Only xcode has minimal clang support currently. If you want to use clang static analysis on windows you'll have to do it through the CLI.

Arelius
  • 1,216
  • 8
  • 15
  • 6
    This kind of answer/questions should have a timeout.. ( meta topic ) – Hernán Eche Nov 02 '10 at 18:58
  • Hernán Eche, yes, but I can change the accepted answer anytime. You can ask me if you feels that situation is changed and the answer is "Yes" – osgx Nov 08 '10 at 17:22
1

Not quite an IDE, but kind of a crossover between IDE and plain editor, a usable alternative for those who don't mind writing configs by hand: a combo of Sublime Text 3 editor and EasyClangComplete plugin (plus Clang Format to keep your code neat and tidy). Works well on Windows thanks to recent efforts to make LLVM MSVC-compatible (Clang-cl is also capable of generating compatible .PDBs as of 2018, which is crucial for debugging).

Update: As of 2019, a much better and future-proof alternative to EasyClangComplete is using Clangd via LSP plugin.

sunny moon
  • 1,313
  • 3
  • 16
  • 30