aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Serialization/GlobalModuleIndex.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-06-22Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko1-6/+6
llvm-svn: 240353
2015-06-22Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko1-6/+6
The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. llvm-svn: 240270
2015-06-20Introduce a PCHContainerOperations interface (NFC).Adrian Prantl1-6/+11
A PCHContainerOperations abstract interface provides operations for creating and unwrapping containers for serialized ASTs (precompiled headers and clang modules). The default implementation is RawPCHContainerOperations, which uses a flat file for the output. The main application for this interface will be an ObjectFilePCHContainerOperations implementation that uses LLVM to wrap the module in an ELF/Mach-O/COFF container to store debug info alongside the AST. rdar://problem/20091852 llvm-svn: 240225
2015-03-18Remove many superfluous SmallString::str() calls.Yaron Keren1-4/+4
Now that SmallString is a first-class citizen, most SmallString::str() calls are not required. This patch removes a whole bunch of them, yet there are lots more. There are two use cases where str() is really needed: 1) To use one of StringRef member functions which is not available in SmallString. 2) To convert to std::string, as StringRef implicitly converts while SmallString do not. We may wish to change this, but it may introduce ambiguity. llvm-svn: 232622
2015-02-25Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl1-3/+2
llvm-svn: 230454
2015-02-25Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl1-2/+3
This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. This reapplies r230044 with a fixed configure+make build and updated dependencies and testcase requirements. Over the last iteration this version adds - missing target requirements for testcases that specify an x86 triple, - a missing clangCodeGen.a dependency to libClang.a in the make build. rdar://problem/19104245 llvm-svn: 230423
2015-02-24Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl1-3/+2
This reverts commit r230305. Off to fix another round of missing dependencies on various platforms. llvm-svn: 230309
2015-02-24Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl1-2/+3
This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. rdar://problem/19104245 This reapplies r230044 with a fixed configure+make build and updated dependencies. Take 3. llvm-svn: 230305
2015-02-21Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl1-3/+2
This reverts commit 230099. The Linux configure+make build variant still needs some work. llvm-svn: 230103
2015-02-20Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl1-2/+3
This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. rdar://problem/19104245 This reapplies r230044 with a fixed configure+make build and updated dependencies. Take 2. llvm-svn: 230089
2015-02-20Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl1-3/+2
This reverts commit r230067. Investigating another batch of problems found by the bots. llvm-svn: 230073
2015-02-20Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl1-2/+3
This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. rdar://problem/19104245 This reapplies r230044 with a fixed configure+make build and updated dependencies. llvm-svn: 230067
2015-02-20Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."Adrian Prantl1-3/+2
This reverts commit r230044 while dealing with buildbot breakage. Conflicts: test/Modules/module_container.m llvm-svn: 230052
2015-02-20Wrap clang module files in a Mach-O, ELF, or COFF container.Adrian Prantl1-2/+3
This is a necessary prerequisite for debugging with modules. The .pcm files become containers that hold the serialized AST which allows us to store debug information in the module file that can be shared by all object files that were built importing the module. rdar://problem/19104245 llvm-svn: 230044
2014-11-12Simplify code a bit by passing StreamFile to the BitstreamCursor constructor.Rafael Espindola1-2/+1
llvm-svn: 221784
2014-10-26Make VFS and FileManager match the current MemoryBuffer API.Benjamin Kramer1-5/+3
This eliminates converting back and forth between the 3 formats and gives us a more homogeneous interface. llvm-svn: 220657
2014-10-23Add a "signature" to AST files to verify that they haven't changedBen Langmuir1-0/+4
Since the order of the IDs in the AST file (e.g. DeclIDs, SelectorIDs) is not stable, it is not safe to load an AST file that depends on another AST file that has been rebuilt since the importer was built, even if "nothing changed". We previously used size and modtime to check this, but I've seen cases where a module rebuilt quickly enough to foil this check and caused very hard to debug build errors. To save cycles when we're loading the AST, we just generate a random nonce value and check that it hasn't changed when we load an imported module, rather than actually hash the whole file. This is slightly complicated by the fact that we need to verify the signature inside addModule, since we might otherwise consider that a mdoule is "OutOfDate" when really it is the importer that is out of date. I didn't see any regressions in module load time after this change. llvm-svn: 220493
2014-08-26Return a std::unique_ptr from getBufferForFile. NFC.Rafael Espindola1-2/+3
llvm-svn: 216476
2014-08-11unique_ptr-ify the MemoryBuffer parameter of GlobalModuleIndexDavid Blaikie1-5/+4
llvm-svn: 215376
2014-07-06Update for llvm api change.Rafael Espindola1-2/+4
llvm-svn: 212408
2014-06-12Replace llvm::error_code with std::error_code.Rafael Espindola1-1/+1
llvm-svn: 210780
2014-05-31There is no std::errc:success, remove the llvm one.Rafael Espindola1-2/+1
llvm-svn: 209959
2014-05-22[C++11] Use 'nullptr'. Serialization edition.Craig Topper1-3/+3
llvm-svn: 209392
2014-04-25Fix leak of GlobalModuleIndex::IdentifierIndex, found by LSan.Nico Weber1-1/+3
llvm-svn: 207262
2014-04-18Teach users of OnDiskHashTable to define hash_value and offset typesJustin Bogner1-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
2014-04-18Remove OnDiskHashTable.h, since it's been moved to llvmJustin Bogner1-6/+5
llvm-svn: 206637
2014-04-17Revised per Dmitri's comments. My first exposure to range-based for loops, ↵John Thompson1-1/+1
thanks! llvm-svn: 206483
2014-04-17Revised per Dmitri's comments. My first exposure to range-based for loops, ↵John Thompson1-10/+8
thanks! llvm-svn: 206474
2014-04-16Added dump method for global module index.John Thompson1-0/+15
llvm-svn: 206418
2014-04-14Allow multiple modules with the same name to coexist in the module cacheBen Langmuir1-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
2014-04-14OnDiskHashTable: Make the iterable version separate.Justin Bogner1-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
2014-03-28Reapply "OnDiskHashTable: Use Endian.h to read little endian ostreams"Justin Bogner1-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
2014-03-28Reapply "OnDiskHashTable: Use EndianStream.h to write little endian ostreams"Justin Bogner1-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
2014-03-28Revert "OnDiskHashTable: Use Endian.h to read little endian ostreams"Justin Bogner1-7/+7
This reverts commit r205045. llvm-svn: 205048
2014-03-28Revert "OnDiskHashTable: Use EndianStream.h to write little endian ostreams"Justin Bogner1-8/+4
This reverts commit r205044. llvm-svn: 205047
2014-03-28OnDiskHashTable: Use Endian.h to read little endian ostreamsJustin Bogner1-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
2014-03-28OnDiskHashTable: Use EndianStream.h to write little endian ostreamsJustin Bogner1-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
2014-03-13[C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper1-1/+1
class. llvm-svn: 203746
2014-03-07Replace OwningPtr with std::unique_ptr.Ahmed Charles1-6/+6
This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
2014-03-07Change OwningPtr::take() to OwningPtr::release().Ahmed Charles1-2/+3
This is a precursor to moving to std::unique_ptr. llvm-svn: 203275
2014-01-10Use the simpler version of llvm::sys::fs::remove when possible.Rafael Espindola1-3/+2
llvm-svn: 198957
2013-10-25I am about to change llvm::MemoryBuffer::getFile take take a Twine. ChangeRafael Espindola1-1/+2
clang first so that the build still works. llvm-svn: 193428
2013-07-05Use llvm::sys::fs::createUniqueFile.Rafael Espindola1-1/+2
Include a test that clang now produces output files with permissions matching the umask. llvm-svn: 185727
2013-06-11Include Path.h instead of PathV2.h.Rafael Espindola1-1/+1
I am about to move PathV2.h to Path.h. llvm-svn: 183795
2013-04-17[Modules] Use global index to improve typo correction performanceArgyrios Kyrtzidis1-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
2013-03-22<rdar://problem/13479539> Simplify ModuleManager/GlobalModuleIndex ↵Douglas Gregor1-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
2013-03-19<rdar://problem/13363214> Eliminate race condition between module rebuild ↵Douglas Gregor1-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
2013-02-08Never cache the result of a module file lookup.Douglas Gregor1-2/+5
llvm-svn: 174744
2013-02-06Eliminate a race condition with the global module index.Douglas Gregor1-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
2013-01-28ASTReader and profiling statistics indicate that implementing a methodDouglas Gregor1-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