[libcxx-commits] [PATCH] D139270: [libc++] Rename __tuple to __tuple_dir to avoid file collision

Michał Górny via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 21 08:07:51 PST 2022


mgorny marked 3 inline comments as done.
mgorny added inline comments.


================
Comment at: libcxx/utils/generate_iwyu_mapping.py:34
     for i in detail_directories:
-        result.append(f'{generate(f"@<{i}/.*>", i[2:])},')
+        result.append(f'{generate(f"@<{i}/.*>", i[2:].rstrip("2"))},')
 
----------------
ldionne wrote:
> mgorny wrote:
> > ldionne wrote:
> > > tahonermann wrote:
> > > > This is a change I would object to on the basis that it is fragile.
> > > I actually don't quite understand why this change is needed, can you explain? Sorry if that's simple.
> > Without this change:
> > 
> > ```
> > diff --git a/libcxx/include/libcxx.imp b/libcxx/include/libcxx.imp
> > index 2c591b71737b..2ed026d76e4a 100644
> > --- a/libcxx/include/libcxx.imp
> > +++ b/libcxx/include/libcxx.imp
> > @@ -39,7 +39,7 @@
> >    { include: [ "@<__string/.*>", "private", "<string>", "public" ] },
> >    { include: [ "@<__support/.*>", "private", "<support>", "public" ] },
> >    { include: [ "@<__thread/.*>", "private", "<thread>", "public" ] },
> > -  { include: [ "@<__tuple_dir/.*>", "private", "<tuple>", "public" ] },
> > +  { include: [ "@<__tuple_dir/.*>", "private", "<tuple_dir>", "public" ] },
> >    { include: [ "@<__type_traits/.*>", "private", "<type_traits>", "public" ] },
> >    { include: [ "@<__utility/.*>", "private", "<utility>", "public" ] },
> >    { include: [ "@<__variant/.*>", "private", "<variant>", "public" ] },
> > ```
> Oh, thanks. I suggest we do this instead:
> 
> ```
> temporary_mappings = {'__tuple_dir': 'tuple'}
> for dir in detail_directories:
>     public_header = temporary_mappings.get(dir, dir.lstrip('_'))
>     result.append(f'{generate(f"@<{dir}/.*>", public_header)},')
> ```
> 
> That way we'll find this when we grep for `__tuple_dir` in the future.
Thanks. I've done that, except that I've left `i` as the loop var since `dir` is a built-in function in Python.


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

https://reviews.llvm.org/D139270



More information about the libcxx-commits mailing list