diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-11-01 02:19:14 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-11-01 02:19:14 +0000 |
| commit | 8b1ab400d40b96f4634eb0c29986218c2905fda4 (patch) | |
| tree | 1cc9ea97ad9847d5f1abe27db1ba8a1528e5bb7a /lib/Basic/Module.cpp | |
| parent | 32b5ca012c42d418c9ff0d4175b17f174459e187 (diff) | |
| download | clang-8b1ab400d40b96f4634eb0c29986218c2905fda4.tar.gz clang-8b1ab400d40b96f4634eb0c29986218c2905fda4.tar.bz2 clang-8b1ab400d40b96f4634eb0c29986218c2905fda4.tar.xz | |
Simplify computation of visible module set.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193850 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/Module.cpp')
| -rw-r--r-- | lib/Basic/Module.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/lib/Basic/Module.cpp b/lib/Basic/Module.cpp index ccf7077d6f..4818e8d173 100644 --- a/lib/Basic/Module.cpp +++ b/lib/Basic/Module.cpp @@ -253,22 +253,13 @@ void Module::buildVisibleModulesCache() const { VisibleModulesCache.insert(this); // Every imported module is visible. - // Every module exported by an imported module is visible. - llvm::SmallPtrSet<Module *, 4> Visited; - llvm::SmallVector<Module *, 4> Exports; - SmallVector<Module *, 4> Stack(Imports.begin(), Imports.end()); + SmallVector<Module *, 16> Stack(Imports.begin(), Imports.end()); while (!Stack.empty()) { Module *CurrModule = Stack.pop_back_val(); - VisibleModulesCache.insert(CurrModule); - - CurrModule->getExportedModules(Exports); - for (SmallVectorImpl<Module *>::iterator I = Exports.begin(), - E = Exports.end(); - I != E; ++I) { - Module *Exported = *I; - if (Visited.insert(Exported)) - Stack.push_back(Exported); - } + + // Every module transitively exported by an imported module is visible. + if (VisibleModulesCache.insert(CurrModule).second) + CurrModule->getExportedModules(Stack); } } |
