llvm / llvm/llvm-project

[clang] Requesting a public API for the substituted-without-satisfaction form of a constraint expression

Open
#211,488 5 comments 0 reactions 0 assignees View on GitHub
clang:frontend concepts
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

I'd kindly ask to expose a supported way for obtaining the template-argument-substituted form of a constraint expression.

**Motivation**: MrDocs (a Clang-based C++ documentation generator) computes a stable symbol identity for constrained templates: two templates differing only in their requires-clause must get distinct, stable IDs across redeclarations. We do that by hashing (`ODRHash`) the _substituted_/_normalized_ constraint expression. AFAICS, the only code that currently yields that expression is the `static` `SubstituteConstraintExpressionWithoutSatisfaction`. The public entry point that uses it, `Sema::AreConstraintExpressionsEqual`, just returns a `bool` and doesn't hand back the substituted expression. So, we vendor a copy, which reaches into `Sema` internals and has to be re-synced by hand on every LLVM update.

For our purposes, it would be enough if `SubstituteConstraintExpressionWithoutSatisfaction` were promoted to a public `Sema` function.

**Version**: 77e43ec1.

Contributor guide

Open the contributing guide

Research direction

Start by reading the static SubstituteConstraintExpressionWithoutSatisfaction implementation and the public Sema::AreConstraintExpressionsEqual entry point to understand their current interfaces and constraints. Done means Clang exposes a supported public Sema way to obtain the substituted constraint expression without satisfaction, allowing MrDocs to stop vendoring this logic.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.