diff options
author | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2024-06-24 16:25:22 +0800 |
---|---|---|
committer | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2024-06-24 16:55:17 +0800 |
commit | 2232881736f1a7e3e94ee1123dea1b6cd85a9c3a (patch) | |
tree | 29b37d5120184c518d9af1bb23a6af0021277b4e /clang/lib/Basic/SourceManager.cpp | |
parent | 090e0c4f50ec39df2beafd98d0556f23e82f4bcd (diff) | |
download | llvm-2232881736f1a7e3e94ee1123dea1b6cd85a9c3a.zip llvm-2232881736f1a7e3e94ee1123dea1b6cd85a9c3a.tar.gz llvm-2232881736f1a7e3e94ee1123dea1b6cd85a9c3a.tar.bz2 |
[C++20] [Modules] Avoid comparing primary module name to decide isInSameModule all the time
Previously, we decide if two module units are in the same module by
comparing name of the primary module interface. But it looks not
efficiency if we always compare the strings. It should be good to
avoid the expensive string operations if possible.
In this patch, we introduced a `llvm::StringMap` to map primary module
name to a Module* and a `llvm::DenseMap<Module*, Module*>` to map a
Module* to a representative Module *. The representative Module* is one
of the Module units belonging to a certain module. The module units have the
same representative Module* should belong to the same module.
We choose the representative Module* by the first module lookup for a
certain primary module name. So the following module units have the same
primary module name would get the same representative modules. So that
for every modules, there will be only one hash process for the primary
module name.
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
0 files changed, 0 insertions, 0 deletions