llvm / llvm/llvm-project

feature: Optional version of Clang module map `requires` declaration

Open
#163,965 5 comments 0 reactions 0 assignees View on GitHub
clang:modules
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

As described in https://discourse.llvm.org/t/module-map-requires-as-non-hard-requirement/88589 we're looking for a way to provide Clang module maps for Qt for use with Swift, in a way that guarantees these module maps are _not_ accidentally picked up when building C++/Objective-C code (to avoid #158249 and other possible issues).

I initially thought `requires` would solve this, where Clang would ignore the module if the compilation unit doesn't match the required environment, but I now understand it's a hard error.

It would be nice if there was a syntax to declare a module map as having non-fatal requirements, that effectively hides the module (or submodule) if those are not met.

Thanks! 🙂

Contributor guide

Open the contributing guide

Research direction

Start with the linked Discourse discussion and Clang's existing module-map `requires` behavior. Trace how hard requirements are handled for modules and submodules, then define the syntax and semantics for non-fatal requirements. Done means unmet requirements hide the module or submodule without producing a hard error, while existing hard requirements remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, objective-c, swift
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.