[PATCH] D118598: [C++20][Modules][7/8] Find the primary interface name for a module.
Iain Sandoe via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 16 08:52:43 PST 2022
iains added inline comments.
================
Comment at: clang/include/clang/Basic/Module.h:523-524
+ std::string getPrimaryModuleInterfaceName() const {
+ std::string::size_type pos = Name.find(':');
+ if (pos == std::string::npos)
+ return Name;
----------------
urnathan wrote:
> haven't you added an IsPartition flag to Module? can't you test that before searching? Also, Almost Always Auto?
1) The case we are dealing with is
we're building `A{,:B}`
we encounter `:Part`
So we do not have a module for the importer ('cos we didn't build it yet) but we need to know the primary module name for the imported partition (even to be able to find it).
So it's a wee bit icky, but we are reduced to manipulating text (none of the content of Module.h is available - we are looking at parser tokens).
2) auto and StringRefs - yes probably I could do better.
The consolation is that this is not an action we'd reasonably expect to be carried out many times c.f. other parser jobs - of course, I'll be proven wrong and someone will import 10^6 partitions ....
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D118598/new/
https://reviews.llvm.org/D118598
More information about the cfe-commits
mailing list