LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

llvm-g++

Obsolete G++-based C++ front-end for LLVM, superseded by clang++

TLDR

Compile C++ program
$ llvm-g++ -o [program] [source.cpp]
copy
Compile with optimization
$ llvm-g++ -O2 -o [program] [source.cpp]
copy
Generate LLVM bitcode
$ llvm-g++ -emit-llvm -c [source.cpp] -o [source.bc]
copy
Generate human-readable LLVM assembly
$ llvm-g++ -emit-llvm -S [source.cpp] -o [source.ll]
copy
Modern equivalent using clang++
$ clang++ -std=c++20 -O2 -o [program] [source.cpp]
copy

SYNOPSIS

llvm-g++ [options] filename...

DESCRIPTION

llvm-g++ was the LLVM C++ front-end: a modified version of g++ from GCC 4.2 that compiled C++ and Objective-C++ into native code, LLVM bitcode or LLVM assembly. By default it produced native objects like g++; with -emit-llvm it wrote LLVM IR instead. It accepted most g++ options and extensions.

PARAMETERS

-o file

Output file name.
-O level
Optimization level (0-3, s).
-emit-llvm
Emit LLVM bitcode (with -c) or LLVM assembly (with -S) instead of native code.
-c
Compile only, no linking.
-S
Generate assembly output.
-std= standard
C++ standard version (at most c++98 / gnu++98 and partial c++0x, as in GCC 4.2).
-I directory
Add a directory to the header search path.
-L directory
Add a directory to the library search path.
-lname
Link with library name.
-g
Include debug information.
--help
Print a summary of command line options.

CAVEATS

Obsolete and unmaintained, with no support for modern C++ standards. It is not part of any current LLVM release, and on macOS any remaining llvm-g++ name is just an alias for clang++. Use clang++ instead.

HISTORY

llvm-g++ shipped alongside llvm-gcc as part of the original LLVM GCC-based front-end. Apple bundled it in Xcode 4. It was deprecated after LLVM 2.9 (2011) in favor of clang++ and removed from Xcode in version 5 (2013).

SEE ALSO

clang++(1), g++(1), llvm-gcc(1), opt(1), llc(1)

RESOURCES

Copied to clipboard
Kai