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

Justin Bogner via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 31 15:18:58 PDT 2017


Zachary Turner <zturner at google.com> writes:
> On Tue, Oct 31, 2017 at 2:45 PM Justin Bogner <mail at justinbogner.com> wrote:
>
>> Zachary Turner via llvm-dev <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

There is no compiler today that accepts the "-std=c++20" flag,
regardless of how much of c++20 they (are likely to) support. There are
also presumably some bugs, so I think this claim is a bit disingenuous.

>>
>> > * 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.

C++20 doesn't exist yet. Clang 6 supports something that is very close
to what C++20 will be. Also, Clang 6 *is* Clang ToT right now, so I
think you mean they could build Clang 5 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.

I hate to exaggerate, but this sounds almost like an argument for using
new C++ features the day after we implement them. There obviously has to
be some balance here.


More information about the llvm-dev mailing list