Chapter 8, Working with Compiler Flags and Toolchains
- It is common to override the assembling and linking stage, since different platforms tend to support different assemblers and linkers. But is it possible to override the compiling stage (which is Clang)? If it is possible, how do we do it? What might be the possible reasons for people to do that?
- You can override the
ToolChain::SelectTool
method and provide an alternativeTool
instance (which represents the compilation stage) according to the argument. Here is an example:Tool* MyToolChain::SelectTool(const JobAction &JA) const override {   if (JA.getKind() == Action::CompileJobClass &&       getTriple().getArch() == CUSTOM_HARDWARE)     return new MyCompiler(…);   …   // Run the default `SelectTool` otherwise   return ToolChain::SelectTool(JA); }
In the preceding snippet, we provided our own compiler instance &...
- You can override the