user541686
user541686

Reputation: 210352

Clang vs. LLVMC -- what's the difference?

What's the difference between llvmc.exe and clang.exe? Which one do I use for compiling C or C++ code?

Upvotes: 4

Views: 1299

Answers (3)

Chris Lattner
Chris Lattner

Reputation: 829

llvmc was an experimental driver that was intended to support multiple different source languages. Clang and Clang++ have always been the preferred way to drive the (C / C++ / Objective-C) compiler. In fact, llvmc has been removed from mainline.

In short, you should definitely use "clang" and never "llvmc".

Upvotes: 8

Matthieu M.
Matthieu M.

Reputation: 299730

LLVM originally stands for Low-Level Virtual Machine, and is today mostly used either:

  • as a backend optimizer/compiler
  • as a JIT compiler

On the other hand, Clang is a collection of libraries for dealing with the C language family that notably contains a compiler (clang) which acts as a front-end for C, C++, Objective-C and Objective-C++ on top of the LLVM libraries.

So, in your case, you will want to use clang and clang++ to compile C and C++ respectively, and don't worry about the fact that LLVM is used behind the scenes to optimize your code and deal with generation of machine instructions adapted to your architecture.

Upvotes: 3

Christoph
Christoph

Reputation: 169523

llvmc is a frontend for various programs in the LLVM toolchain, in particular the llvm-* ones, ie by default it will try to use llvm-gcc and llvm-g++ to compile C and C++ files.

You can pass -clang to llvmc if that's what you want to use, and it's probably possible to configure llvmc so clang will be used by default, but I have no idea how to do that.

I'd recommend to just use clang and clang++ directly, which can be used as drop-in replacements for gcc and g++.

Upvotes: 12

Related Questions