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

Michael Spencer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 27 15:24:41 PST 2022


Bigcheese added inline comments.


================
Comment at: clang/docs/Modules.rst:651
+
+    requires cplusplus {
+      header "vector"
----------------
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.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118311



More information about the llvm-commits mailing list