[all-commits] [llvm/llvm-project] 223288: [C++20] [Modules] Avoid comparing primary module n...
Chuanqi Xu via All-commits
all-commits at lists.llvm.org
Mon Jun 24 01:55:58 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2232881736f1a7e3e94ee1123dea1b6cd85a9c3a
https://github.com/llvm/llvm-project/commit/2232881736f1a7e3e94ee1123dea1b6cd85a9c3a
Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
Date: 2024-06-24 (Mon, 24 Jun 2024)
Changed paths:
M clang/include/clang/AST/ASTContext.h
M clang/lib/AST/ASTContext.cpp
Log Message:
-----------
[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.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list