[llvm-dev] Using C++14 code in LLVM

Dean Michael Berris via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 31 15:16:20 PDT 2017


> On 1 Nov 2017, at 08:56, Zachary Turner via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> 
> 
> On Tue, Oct 31, 2017 at 2:45 PM Justin Bogner <mail at justinbogner.com <mailto:mail at justinbogner.com>> wrote:
> Zachary Turner via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> writes:
> >
> > Issue: If we're going to make people bootstrap a compiler, we might as well
> > go all the way to C++17.
> > Comment: I'm not opposed.
> 
> We shouldn't make people bootstrap the compiler without a very good
> reason. I really don't want to be in the situation where you have to get
> clang 3.7 to bootstrap 5.0 to bootstrap 7.0 to bootstrap 9.0 in 2019.
> 
> Why would this many hops ever be necessary?  System Compiler -> {Clang 5 or GCC 7} -> Clang ToT should be sufficient to last until C++23, which we probably wouldn't adopt until 2025-2030 anyway
>  

Can this be fixed by automation though?

I mean, a script can determine what the system compiler is, and determine which minimal versions of the toolchain (frontend, linker, etc.) in which order to be able to build the latest compiler that uses C++17. Seems like a fixable problem.

Ideally you only need to do this once, and normal development will allow you to use the "known good" bootstrap compiler.

> 
> > * Clang 6 supports all of C++20, and it builds with only C++11, so we
> > shouldn't have to worry too much about the problem of needing to "daisy
> > chain" compilers to finally get the latest version of LLVM building.  "GCC
> > 4.8 -> Clang 6 - > Clang ToT" should hold up through C++1z.
> 
> I don't understand how this argument holds. If we change the minimum c++
> standard we build with every time one comes out, we'll definitely have a
> long daisy chain of compilers that need to be built to start working on
> LLVM at all.
> Clang 6 supports all of C++20.  If we started requiring C++14 today, someone can build Clang 6 with the system compiler and then build Clang ToT.
> 
> If 3 months later we started requiring C++17, someone could build clang 6 with the system compiler and then build Clang ToT.
> 
> If 3 months later we started requiring C++20, someone could still build clang 6 with the system compiler and then build Clang ToT.
> 
> Every relaxation of the kind of code we can use in LLVM does not necessitate an extra hop in the bootstrapping process, because existing versions of clang can already compile through C++20.

Not only this, but if we ever needed to do something different later on, automation can take care of adding the correct intermediate steps.

Needless to say, I'm in favour of switching the default to C++17, FWIW.

Cheers

-- Dean

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171101/af3f1768/attachment.html>


More information about the llvm-dev mailing list