This is an archive of the discontinued LLVM Phabricator instance.

[include-mapping] Better #includes support for std input/output symbols
ClosedPublic

Authored by hokein on Feb 3 2023, 9:16 AM.

Diff Detail

Event Timeline

hokein created this revision.Feb 3 2023, 9:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 3 2023, 9:16 AM
hokein requested review of this revision.Feb 3 2023, 9:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 3 2023, 9:16 AM
kadircet added inline comments.Feb 6 2023, 1:37 AM
clang/tools/include-mapping/gen_std.py
162

i think putting iostream before iosfwd in the alternative list makes more sense. WDYT?

218–221

what about changing this to:

symbol.headers.extend(AdditionalHeadersForIOSymbols(symbol))
for header in symbol.headers:
  ....

(and also changing AdditionalHeadersForIOSymbols to only return additional headers and an empty list if there's none)

that way it'll be easier to augment symbol headers later on.

hokein updated this revision to Diff 495047.Feb 6 2023, 2:34 AM
hokein marked 2 inline comments as done.

address review comments.

clang/tools/include-mapping/gen_std.py
162

sounds good.

kadircet accepted this revision.Feb 6 2023, 5:11 AM

thanks, lgtm! as discussed offline, let's first move the raw header mappings to a private location first though and make sure all users are going through stdlib apis to ensure we don't see weird behaviour after such changes (since we're breaking the invariant of a qualified symbol name occurring only once)

This revision is now accepted and ready to land.Feb 6 2023, 5:11 AM
hokein updated this revision to Diff 495479.Feb 7 2023, 5:01 AM

add a unittest

This revision was landed with ongoing or failed builds.Feb 7 2023, 5:26 AM
This revision was automatically updated to reflect the committed changes.