[PATCH] D118311: [Clang][ModuleMap] Add conditional parsing via requires block declaration

Ian Anderson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 27 15:27:12 PST 2022


iana added inline comments.


================
Comment at: clang/docs/Modules.rst:651
+
+    requires cplusplus {
+      header "vector"
----------------
Bigcheese wrote:
> iana wrote:
> > Is there any kind of `else` syntax here? Or do you just use `!whatever` for the else? Is something like this valid?
> > 
> > ```
> > requires cplusplus11 {
> >   ...
> > }
> > requires cplusplus && !cplusplus11 {
> >   ...
> > }
> > ```
> > Or would you nest the `requires`? If you wanted OR, would you just have to duplicate the requires block body?
> There's currently no `else` syntax, although I don't think it would be hard to add. Nesting is allowed. The syntax in your example would be:
> 
> ```
> requires cplusplus11 {
>   ...
> }
> requires cplusplus, !cplusplus11 {
>   ...
> }
> ```
> 
> OR currently requires duplication. The idea is that the feature list expressions just aren't that complex in practice.
Seems like you don't strictly need `else` then, probably fine without it as long as there are enough examples in the documentation?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118311/new/

https://reviews.llvm.org/D118311



More information about the cfe-commits mailing list