Search code examples
c++clangllvmllvm-clangllvm-ir

Does "clang -S -emit-llvm file.cpp" run any other executables except clang?


Does clang -S -emit-llvm file.cpp (compiling c++ source code to LLVM IR) run any other executables except clang behind the scene (like linker or smth)?


Solution

  • Kind of. Clang will spawn another instance of clang, as what you're really spawning with this kind of invocation is merely the driver, which then runs the compiler proper and then possibly invokes the assembler, the linker and any other tools necessary — but none are needed in the case of just -S -emit-llvm.

    You can see it for yourself by running Clang with -v, it will print all the processes spawned, their arguments and their output.