[clang] [Clang] [Contracts] Design Doc (PR #229978)
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 27 02:51:08 PDT 2026
ChuanqiXu9 wrote:
For the high level thing I want to mention is the develop style and the intention. My intention is to support the contracts more quickly so that more users can get involved.
Especially C++26 is delayed due to contracts. I wish more people can have a feeling by using instead of reading long and a lot of papers.
I feel better if our implementation can be used by users in the early stage instead of we tried to have a perfect design first and wrote the code. I think the point of design is that we can know what's the big picture and the roadmap. We know what we're going to do.
I feel early optimizations are the root of evil, unless it is obivious. So I accept the suggestion to move the pointer to the contract sequence into `Declarator::ExtInfo` as I feel this is clear and simple. But I didn't accept the idea to use a map to model the contracts between redeclarations. Then the consumer side become complex and error prone. And the optimization may not be worth if the number of contracts are lot enough.
And for ABI, I still think we should follow GCC's existing approach in the first version. So that the users can use clang with libstdc++. If we did something, the current libstdc++ doesn't support. I feel it is not acceptable as many users use clang with libstdc++. **We must support clang to be used with libstdc++.**
And generally we can be conservative first. e.g, whether or not to expose the driver flags, whether or not to allow BMI importing each other with dfiferent evaluation semantics. I think, if we say no right now, we can say yes later. But if we say yes in the first version, it is harder to go back no later. So I prefer a conservative design generally. Code can be changed and we can change them later once we find it workable **in practice**. Many things will be more clear during the practice than we image in the first place.
https://github.com/llvm/llvm-project/pull/229978
More information about the cfe-commits
mailing list