[libcxx-commits] [PATCH] D105932: [libcxx][modules] protects users from relying on libc++ detail headers (1/n)

Christopher Di Bella via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 15 09:49:19 PDT 2021


cjdb added inline comments.


================
Comment at: libcxx/utils/generate_private_header_tests.py:40-50
+    paths = sorted(
+        filter(
+            lambda path: '__support' not in path,
+            filter(
+                lambda path: path not in still_public,
+                map(
+                    lambda path: path.as_posix()[len('include/'):],
----------------
Quuxplusone wrote:
> FWIW, I'd find this easier to read as
> ```
> def is_still_public(p):
>     return p.startswith('__support/') or p in [
>         ...
>     ]
> 
> paths = [p[10:] for p in Path('include').rglob('*') if p.as_posix().startswith('include/__') and not p.is_dir()]
> private_paths = [p for p in paths if not is_still_public(p)]
> ```
Yes, very much so. I was extremely disappointed when I found out I couldn't do this
```
Path("include").rglob('*')
               .filter(...)
               .map(...)
               .filter(...)
```
I guess list comprehensions are the Pythonic way of achieving this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105932



More information about the libcxx-commits mailing list