[libcxx-commits] [PATCH] D132787: [libc++] Avoids self references in transitive include test.

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 31 09:30:47 PDT 2022


ldionne accepted this revision.
ldionne added a comment.
This revision is now accepted and ready to land.

Thanks, this LGTM and it is an oversight in the original implementation. I have a suggestion for simplifying this, but it's non-blocking.



================
Comment at: libcxx/test/libcxx/transitive_includes.sanitize.py:39
 import re
 import sys
 
----------------
Instead, perhaps it would be cleaner to figure out the top level header separately (pseudo-code, will need some changes):

```
lines = sys.stdin.readlines()

get_top_level = lambda line: re.match(r'. .*(?:/|\\\\)include(?:/|\\\\)c\+\+(?:/|\\\\)v[0-9]+(?:/|\\\\)(.+)', line)
top_level_header = next(get_top_level_header(line) for line in lines if <matches>)

# Then do the rest exactly as it was
...

# Finally, simply remove the top-level header from the set of all headers
sorted(set(headers) - set(top_level_header))
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132787



More information about the libcxx-commits mailing list