summaryrefslogtreecommitdiffstats
path: root/clang/lib/Serialization/GlobalModuleIndex.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* There is no std::errc:success, remove the llvm one.Rafael Espindola2014-05-311-2/+1
| | | | llvm-svn: 209959
* [C++11] Use 'nullptr'. Serialization edition.Craig Topper2014-05-221-3/+3
| | | | llvm-svn: 209392
* Fix leak of GlobalModuleIndex::IdentifierIndex, found by LSan.Nico Weber2014-04-251-1/+3
| | | | llvm-svn: 207262
* Teach users of OnDiskHashTable to define hash_value and offset typesJustin Bogner2014-04-181-2/+6
| | | | | | | | This paves the way to making OnDiskHashTable work with hashes that are not 32 bits wide and to making OnDiskHashTable work very large hash tables. The LLVM change to use these types is upcoming. llvm-svn: 206640
* Remove OnDiskHashTable.h, since it's been moved to llvmJustin Bogner2014-04-181-6/+5
| | | | llvm-svn: 206637
* Revised per Dmitri's comments. My first exposure to range-based for loops, ↵John Thompson2014-04-171-1/+1
| | | | | | thanks! llvm-svn: 206483
* Revised per Dmitri's comments. My first exposure to range-based for loops, ↵John Thompson2014-04-171-10/+8
| | | | | | thanks! llvm-svn: 206474
* Added dump method for global module index.John Thompson2014-04-161-0/+15
| | | | llvm-svn: 206418
* Allow multiple modules with the same name to coexist in the module cacheBen Langmuir2014-04-141-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To differentiate between two modules with the same name, we will consider the path the module map file that they are defined by* part of the ‘key’ for looking up the precompiled module (pcm file). Specifically, this patch renames the precompiled module (pcm) files from cache-path/<module hash>/Foo.pcm to cache-path/<module hash>/Foo-<hash of module map path>.pcm In addition, I’ve taught the ASTReader to re-resolve the names of imported modules during module loading so that if the header search context changes between when a module was originally built and when it is loaded we can rebuild it if necessary. For example, if module A imports module B first time: clang -I /path/to/A -I /path/to/B ... second time: clang -I /path/to/A -I /different/path/to/B ... will now rebuild A as expected. * in the case of inferred modules, we use the module map file that allowed the inference, not the __inferred_module.map file, since the inferred file path is the same for every inferred module. llvm-svn: 206201
* OnDiskHashTable: Make the iterable version separate.Justin Bogner2014-04-141-6/+9
| | | | | | | | | | | | | | | Currently the on disk hash table's key_iterator and data_iterator make the assumption that the table data starts exactly four bytes after the base of the table. This happens to be true for all of the tables we currently iterate over, but not for all of the OnDiskHashTables we currently use. For example, key_ and data_iterator would iterate over meaningless data if they were used on the hash tables in PTHLexer. We make the API safer by breaking this into two types. One doesn't have the iterators, and the other must be told where the payload starts. llvm-svn: 206189
* Reapply "OnDiskHashTable: Use Endian.h to read little endian ostreams"Justin Bogner2014-03-281-7/+7
| | | | | | | | | | | | | Committed this by accident before it was done last time. Original message: Rather than rolling our own functions to read little endian data from a buffer, we can use the support in llvm's Endian.h. No functional change. llvm-svn: 205062
* Reapply "OnDiskHashTable: Use EndianStream.h to write little endian ostreams"Justin Bogner2014-03-281-4/+8
| | | | | | | | | | | | | Committed this by accident before it was done last time. Original message: Rather than rolling our own functions to write little endian data to an ostream, we can use the support in llvm's EndianStream.h. No functional change. llvm-svn: 205061
* Revert "OnDiskHashTable: Use Endian.h to read little endian ostreams"Justin Bogner2014-03-281-7/+7
| | | | | | This reverts commit r205045. llvm-svn: 205048
* Revert "OnDiskHashTable: Use EndianStream.h to write little endian ostreams"Justin Bogner2014-03-281-8/+4
| | | | | | This reverts commit r205044. llvm-svn: 205047
* OnDiskHashTable: Use Endian.h to read little endian ostreamsJustin Bogner2014-03-281-7/+7
| | | | | | | | | Rather than rolling our own functions to read little endian data from a buffer, we can use the support in llvm's Endian.h. No functional change. llvm-svn: 205045
* OnDiskHashTable: Use EndianStream.h to write little endian ostreamsJustin Bogner2014-03-281-4/+8
| | | | | | | | | Rather than rolling our own functions to write little endian data to an ostream, we can use the support in llvm's EndianStream.h. No functional change. llvm-svn: 205044
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-131-1/+1
| | | | | | class. llvm-svn: 203746
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-6/+6
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
* Change OwningPtr::take() to OwningPtr::release().Ahmed Charles2014-03-071-2/+3
| | | | | | This is a precursor to moving to std::unique_ptr. llvm-svn: 203275
* Use the simpler version of llvm::sys::fs::remove when possible.Rafael Espindola2014-01-101-3/+2
| | | | llvm-svn: 198957
* I am about to change llvm::MemoryBuffer::getFile take take a Twine. ChangeRafael Espindola2013-10-251-1/+2
| | | | | | clang first so that the build still works. llvm-svn: 193428
* Use llvm::sys::fs::createUniqueFile.Rafael Espindola2013-07-051-1/+2
| | | | | | | Include a test that clang now produces output files with permissions matching the umask. llvm-svn: 185727
* Include Path.h instead of PathV2.h.Rafael Espindola2013-06-111-1/+1
| | | | | | I am about to move PathV2.h to Path.h. llvm-svn: 183795
* [Modules] Use global index to improve typo correction performanceArgyrios Kyrtzidis2013-04-171-0/+31
| | | | | | | | | Typo correction for an unqualified name needs to walk through all of the identifier tables of all modules. When we have a global index, just walk its identifier table only. rdar://13425732 llvm-svn: 179730
* <rdar://problem/13479539> Simplify ModuleManager/GlobalModuleIndex ↵Douglas Gregor2013-03-221-65/+31
| | | | | | | | | | | | | | interaction to eliminate a pile of extraneous stats(). The refactoring in r177367 introduced a serious performance bug where the "lazy" resolution of module file names in the global module index to actual module file entries in the module manager would perform repeated negative stats(). The new interaction requires the module manager to inform the global module index when a module file has been loaded, eliminating the extraneous stat()s and a bunch of bookkeeping on both sides. llvm-svn: 177750
* <rdar://problem/13363214> Eliminate race condition between module rebuild ↵Douglas Gregor2013-03-191-133/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | and the global module index. The global module index was querying the file manager for each of the module files it knows about at load time, to prune out any out-of-date information. The file manager would then cache the results of the stat() falls used to find that module file. Later, the same translation unit could end up trying to import one of the module files that had previously been ignored by the module cache, but after some other Clang instance rebuilt the module file to bring it up-to-date. The stale stat() results in the file manager would trigger a second rebuild of the already-up-to-date module, causing failures down the line. The global module index now lazily resolves its module file references to actual AST reader module files only after the module file has been loaded, eliminating the stat-caching race. Moreover, the AST reader can communicate to its caller that a module file is missing (rather than simply being out-of-date), allowing us to simplify the module-loading logic and allowing the compiler to recover if a dependent module file ends up getting deleted. llvm-svn: 177367
* Never cache the result of a module file lookup.Douglas Gregor2013-02-081-2/+5
| | | | llvm-svn: 174744
* Eliminate a race condition with the global module index.Douglas Gregor2013-02-061-1/+2
| | | | | | | | Essentially, a module file on disk could change size between the time we stat() it and the time we open it, and we need to be robust against such a problem. llvm-svn: 174529
* ASTReader and profiling statistics indicate that implementing a methodDouglas Gregor2013-01-281-4/+0
| | | | | | | pool in the global module index is not worthwhile. Update comments to limit the scope of the global module index to identifiers. llvm-svn: 173705
* Improve coordination between the module manager and the global moduleDouglas Gregor2013-01-251-26/+5
| | | | | | | | | index, optimizing the operation that skips lookup in modules where we know the identifier will not be found. This makes the global module index optimization actually useful, providing an 8.5% speedup over modules without the global module index for -fsyntax-only. llvm-svn: 173529
* Serialization/GlobalModuleIndex.cpp: Fixup r173405, <cstdio>NAKAMURA Takumi2013-01-251-0/+1
| | | | llvm-svn: 173408
* Implement the reader of the global module index and wire it into theDouglas Gregor2013-01-251-17/+387
| | | | | | | | | | | | | | | | | | | | | | | AST reader. The global module index tracks all of the identifiers known to a set of module files. Lookup of those identifiers looks first in the global module index, which returns the set of module files in which that identifier can be found. The AST reader only needs to look into those module files and any module files not known to the global index (e.g., because they were (re)built after the global index), reducing the number of on-disk hash tables to visit. For an example source I'm looking at, we go from 237844 total identifier lookups into on-disk hash tables down to 126817. Unfortunately, this does not translate into a performance advantage. At best, it's a wash once the global module index has been built, but that's ignore the cost of building the global module index (which is itself fairly large). Profiles show that the global module index code is far less efficient than it should be; optimizing it might give enough of an advantage to justify its continued inclusion. llvm-svn: 173405
* clang/GlobalModuleIndex: Don't open the same file twice. Use ↵NAKAMURA Takumi2013-01-241-3/+1
| | | | | | | raw_fd_ostream(fd, ...) instead. FIXME: PathV2::unique_file() is assumed to open the file with binary mode on win32. llvm-svn: 173330
* Fix for case-sensitive file systems. UghDouglas Gregor2013-01-231-1/+1
| | | | llvm-svn: 173303
* Implement the writer side of the global module index. Douglas Gregor2013-01-231-0/+535
The global module index is a "global" index for all of the module files within a particular subdirectory in the module cache, which keeps track of all of the "interesting" identifiers and selectors known in each of the module files. One can perform a fast lookup in the index to determine which module files will have more information about entities with a particular name/selector. This information can help eliminate redundant lookups into module files (a serious performance problem) and help with creating auto-import/auto-include Fix-Its. The global module index is created or updated at the end of a translation unit that has triggered a (re)build of a module by scraping all of the .pcm files out of the module cache subdirectory, so it catches everything. As with module rebuilds, we use the file system's atomicity to synchronize. llvm-svn: 173301
OpenPOWER on IntegriCloud