summaryrefslogtreecommitdiffstats
path: root/include/clang/Serialization
Commit message (Collapse)AuthorAgeFilesLines
...
* Add missing include to ContinuousRangeMap.hEric Fiselier2018-04-011-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328924 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang] Change std::sort to llvm::sort in response to r327219Mandeep Singh Grang2018-03-271-1/+1
| | | | | | | | | | | r327219 added wrappers to std::sort which randomly shuffle the container before sorting. This will help in uncovering non-determinism caused due to undefined sorting order of objects having the same key. To make use of that infrastructure we need to invoke llvm::sort instead of std::sort. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@328636 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Fix some Clang-tidy modernize and Include What You Use warnings; ↵Eugene Zelenko2018-02-221-19/+14
| | | | | | other minor fixes (NFC). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325834 91177308-0d34-0410-b5e6-96231b3b80d8
* [PCH] Serialize skipped preprocessor rangesCameron Desrochers2018-01-153-0/+38
| | | | | | | | The skipped preprocessor ranges are now serialized in the AST PCH file. This fixes, for example, libclang's clang_getSkippedRanges() returning zero ranges after reparsing a translation unit. Differential Revision: https://reviews.llvm.org/D20124 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322503 91177308-0d34-0410-b5e6-96231b3b80d8
* [ODRHash] Support ODR violation detection in functions.Richard Trieu2017-12-231-0/+4
| | | | | | | | Extend the hashing to functions, which allows detection of function definition mismatches across modules. This is a re-commit of r320230. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321395 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r320230 to fix buildbots.Richard Trieu2017-12-091-4/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320239 91177308-0d34-0410-b5e6-96231b3b80d8
* [ODRHash] Support ODR violation detection in functions.Richard Trieu2017-12-091-0/+4
| | | | | | | | Extend the hashing to functions, which allows detection of function definition mismatches across modules. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@320230 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize "static data member instantiated" notification to cover variable ↵Richard Smith2017-12-051-2/+3
| | | | | | | | | | templates too. While here, split the "point of instantiation changed" notification out from it; these two really are orthogonal changes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319727 91177308-0d34-0410-b5e6-96231b3b80d8
* [Serialization] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2017-11-112-65/+109
| | | | | | warnings; other minor fixes (NFC). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317953 91177308-0d34-0410-b5e6-96231b3b80d8
* [Serialization] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2017-11-081-136/+184
| | | | | | warnings; other minor fixes (NFC). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317648 91177308-0d34-0410-b5e6-96231b3b80d8
* [Serialization] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2017-11-022-62/+383
| | | | | | warnings; other minor fixes (NFC). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317273 91177308-0d34-0410-b5e6-96231b3b80d8
* Support for destroying operator delete, per C++2a proposal P0722.Richard Smith2017-10-131-1/+2
| | | | | | | | | | | This feature is not (yet) approved by the C++ committee, so this is liable to be reverted or significantly modified based on committee feedback. No functionality change intended for existing code (a new type must be defined in namespace std to take advantage of this feature). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315662 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r314955: "Remove PendingBody mechanism for function and ObjC method ↵Daniel Jasper2017-10-111-4/+20
| | | | | | | | | | | deserialization." This is breaking a build of https://github.com/abseil/abseil-cpp and so likely not really NFC. Also reverted subsequent r314956/7. I'll forward reproduction instructions to Richard. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315439 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove PendingBody mechanism for function and ObjC method deserialization.Richard Smith2017-10-051-20/+4
| | | | | | | | | | | | | In its place, track on the canonical function declaration whether there is a declaration with a body (and if so, which one). This brings function definition handling in line with what we do in all other contexts, and is necessary to allow us to merge declarations within multiple definitions of the same function (eg, PR33924). No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314955 91177308-0d34-0410-b5e6-96231b3b80d8
* Dependent Address Space SupportAndrew Gozillon2017-10-021-1/+3
| | | | | | | | | | | | | | | | This patch relates to: https://reviews.llvm.org/D33666 This adds support for template parameters to be passed to the address_space attribute. The main goal is to add further flexibility to the attribute and allow for it to be used easily with templates. The main additions are a new type (DependentAddressSpaceType) alongside its TypeLoc and its mangling. As well as the logic required to support dependent address spaces which mainly resides in TreeTransform.h and SemaType.cpp. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314649 91177308-0d34-0410-b5e6-96231b3b80d8
* [ODRHash] Add base classes to hashing CXXRecordDecl.Richard Trieu2017-09-301-1/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314581 91177308-0d34-0410-b5e6-96231b3b80d8
* [Module map] Introduce a private module re-export directive.Douglas Gregor2017-09-141-0/+3
| | | | | | | | | | | | | Introduce a new "export_as" directive for top-level modules, which indicates that the current module is a "private" module whose symbols will eventually be exported through the named "public" module. This is in support of a common pattern in the Darwin ecosystem where a single public framework is constructed of several private frameworks, with (currently) header duplication and some support from the linker. Addresses rdar://problem/34438420. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313316 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit "Add _Float16 as a C/C++ source language type"Sjoerd Meijer2017-09-081-0/+2
| | | | | | | | | This is a recommit of r312781; in some build configurations variable names are omitted, so changed the new regression test accordingly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312794 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Add _Float16 as a C/C++ source language type"Sjoerd Meijer2017-09-081-2/+0
| | | | | | | | The clang-with-lto-ubuntu bot didn't like the new regression test, revert while I investigate the issue. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312784 91177308-0d34-0410-b5e6-96231b3b80d8
* Add _Float16 as a C/C++ source language typeSjoerd Meijer2017-09-081-0/+2
| | | | | | | | | | | | This adds _Float16 as a source language type, which is a 16-bit floating point type defined in C11 extension ISO/IEC TS 18661-3. In follow up patches documentation and more tests will be added. Differential Revision: https://reviews.llvm.org/D33719 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312781 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules ts] Emit global variables in a module interface unit as part of ↵Richard Smith2017-09-061-1/+1
| | | | | | that unit, not in importers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312665 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Add ability to specify module name to module file mapping (reapply)Boris Kolpackov2017-08-312-3/+21
| | | | | | | | | | | | | | | | | | | | | | Extend the -fmodule-file option to support the [<name>=]<file> value format. If the name is omitted, then the old semantics is preserved (the module file is loaded whether needed or not). If the name is specified, then the mapping is treated as just another prebuilt module search mechanism, similar to -fprebuilt-module-path, and the module file is only loaded if actually used (e.g., via import). With one exception: this mapping also overrides module file references embedded in other modules (which can be useful if module files are moved/renamed as often happens during remote compilation). This override semantics requires some extra work: we now store the module name in addition to the file name in the serialized AST representation. Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D35020 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312220 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r312105 [modules] Add ability to specify module name to module file ↵Victor Leschuk2017-08-302-21/+3
| | | | | | | | | mapping Looks like it breaks win10 builder. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312112 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Add ability to specify module name to module file mappingBoris Kolpackov2017-08-302-3/+21
| | | | | | | | | | | | | | | | | | | | | | Extend the -fmodule-file option to support the [<name>=]<file> value format. If the name is omitted, then the old semantics is preserved (the module file is loaded whether needed or not). If the name is specified, then the mapping is treated as just another prebuilt module search mechanism, similar to -fprebuilt-module-path, and the module file is only loaded if actually used (e.g., via import). With one exception: this mapping also overrides module file references embedded in other modules (which can be useful if module files are moved/renamed as often happens during remote compilation). This override semantics requires some extra work: we now store the module name in addition to the file name in the serialized AST representation. Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D35020 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@312105 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit r308327 3rd time: Add a warning for missingAlex Lorenz2017-07-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | '#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files The second recommit (r309106) was reverted because the "non-default #pragma pack value chages the alignment of struct or union members in the included file" warning proved to be too aggressive for external projects like Chromium (https://bugs.chromium.org/p/chromium/issues/detail?id=749197). This recommit makes the problematic warning a non-default one, and gives it the -Wpragma-pack-suspicious-include warning option. The first recommit (r308441) caused a "non-default #pragma pack value might change the alignment of struct or union members in the included file" warning in LLVM itself. This recommit tweaks the added warning to avoid warnings for #includes that don't have any records that are affected by the non-default alignment. This tweak avoids the previously emitted warning in LLVM. Original message: This commit adds a new -Wpragma-pack warning. It warns in the following cases: - When a translation unit is missing terminating #pragma pack (pop) directives. - When entering an included file if the current alignment value as determined by '#pragma pack' directives is different from the default alignment value. - When leaving an included file that changed the state of the current alignment value. rdar://10184173 Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309386 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r309106 "Recommit r308327 2nd time: Add a warning for missing"Hans Wennborg2017-07-261-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The warning fires on non-suspicious code in Chromium. Reverting until a solution is figured out. > Recommit r308327 2nd time: Add a warning for missing > '#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files > > The first recommit (r308441) caused a "non-default #pragma pack value might > change the alignment of struct or union members in the included file" warning > in LLVM itself. This recommit tweaks the added warning to avoid warnings for > #includes that don't have any records that are affected by the non-default > alignment. This tweak avoids the previously emitted warning in LLVM. > > Original message: > > This commit adds a new -Wpragma-pack warning. It warns in the following cases: > > - When a translation unit is missing terminating #pragma pack (pop) directives. > - When entering an included file if the current alignment value as determined > by '#pragma pack' directives is different from the default alignment value. > - When leaving an included file that changed the state of the current alignment > value. > > rdar://10184173 > > Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309186 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit r308327 2nd time: Add a warning for missingAlex Lorenz2017-07-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | '#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files The first recommit (r308441) caused a "non-default #pragma pack value might change the alignment of struct or union members in the included file" warning in LLVM itself. This recommit tweaks the added warning to avoid warnings for #includes that don't have any records that are affected by the non-default alignment. This tweak avoids the previously emitted warning in LLVM. Original message: This commit adds a new -Wpragma-pack warning. It warns in the following cases: - When a translation unit is missing terminating #pragma pack (pop) directives. - When entering an included file if the current alignment value as determined by '#pragma pack' directives is different from the default alignment value. - When leaving an included file that changed the state of the current alignment value. rdar://10184173 Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309106 91177308-0d34-0410-b5e6-96231b3b80d8
* [coroutines] Add serialization/deserialization of coroutinesGor Nishanov2017-07-251-2/+7
| | | | | | | | | | | | Reviewers: rsmith Reviewed By: rsmith Subscribers: EricWF, cfe-commits Differential Revision: https://reviews.llvm.org/D35383 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308996 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix incorrect use of current directory to find moved paths in ASTReader.Manuel Klimek2017-07-251-3/+0
| | | | | | | | | | | | | | | | | | | | | CurrentDir was set as the path of the current module, but that can change as part of a chain of loaded modules. When we try to locate a file mentioned in a module that does not exist, we use a heuristic to look at the relative path between the original location of the module and the file we look for, and use that relatively to the CurrentDir. This only works if CurrentDir is the same as the (current) path of the module file the file was mentioned in; if it is not, we look at the path relatively to the wrong directory, and can end up reading random unrelated files that happen to have the same name. This patch fixes this by using the BaseDirectory of the module file the file we look for was mentioned in instead of the CurrentDir heuristic. Differential Revision: https://reviews.llvm.org/D35828 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308962 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r308441 "Recommit r308327: Add a warning for missing '#pragma pack ↵Hans Wennborg2017-07-191-1/+0
| | | | | | | | | | | | | | | | | | | | | (pop)' and suspicious uses of '#pragma pack' in included files" This seems to have broken the sanitizer-x86_64-linux buildbot. Reverting until it's fixed, especially since this landed just before the 5.0 branch. > This commit adds a new -Wpragma-pack warning. It warns in the following cases: > > - When a translation unit is missing terminating #pragma pack (pop) directives. > - When entering an included file if the current alignment value as determined > by '#pragma pack' directives is different from the default alignment value. > - When leaving an included file that changed the state of the current alignment > value. > > rdar://10184173 > > Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308455 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit r308327: Add a warning for missing '#pragma pack (pop)'Alex Lorenz2017-07-191-0/+1
| | | | | | | | | | | | | | | | | | | and suspicious uses of '#pragma pack' in included files This commit adds a new -Wpragma-pack warning. It warns in the following cases: - When a translation unit is missing terminating #pragma pack (pop) directives. - When entering an included file if the current alignment value as determined by '#pragma pack' directives is different from the default alignment value. - When leaving an included file that changed the state of the current alignment value. rdar://10184173 Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308441 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r308327Alex Lorenz2017-07-181-1/+0
| | | | | | | I forgot to test clang-tools-extra which is now failing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308328 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a warning for missing '#pragma pack (pop)' and suspicious usesAlex Lorenz2017-07-181-0/+1
| | | | | | | | | | | | | | | | | | | of '#pragma pack' in included files This commit adds a new -Wpragma-pack warning. It warns in the following cases: - When a translation unit is missing terminating #pragma pack (pop) directives. - When entering an included file if the current alignment value as determined by '#pragma pack' directives is different from the default alignment value. - When leaving an included file that changed the state of the current alignment value. rdar://10184173 Differential Revision: https://reviews.llvm.org/D35484 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308327 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach ASTReader how to read only the Preprocessor state from an AST file, ↵Richard Smith2017-06-291-4/+7
| | | | | | | | | | not the ASTContext state. We use this when running a preprocessor-only action on an AST file in order to avoid paying the runtime cost of loading the extra information. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306760 91177308-0d34-0410-b5e6-96231b3b80d8
* Track the set of module maps read while building a .pcm file and reload ↵Richard Smith2017-06-291-0/+7
| | | | | | those when preprocessing from that .pcm file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@306628 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow for unfinished #if blocks in preamblesErik Verbruggen2017-05-301-0/+3
| | | | | | | | | | | | | | | | | | | | | Previously, a preamble only included #if blocks (and friends like ifdef) if there was a corresponding #endif before any declaration or definition. The problem is that any header file that uses include guards will not have a preamble generated, which can make code-completion very slow. To prevent errors about unbalanced preprocessor conditionals in the preamble, and unbalanced preprocessor conditionals after a preamble containing unfinished conditionals, the conditional stack is stored in the pch file. This fixes PR26045. Differential Revision: http://reviews.llvm.org/D15994 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304207 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Further delay calling DeclMustBeEmitted until it's safe.Vassil Vassilev2017-05-191-3/+11
| | | | | | | | | | | | | | | As discussed in D30793, we have some unsafe calls to isConsumerInterestedIn(). This patch implements Richard's suggestion (from the inline comment) that we should track if we just deserialized an declaration. If we just deserialized, we can skip the unsafe call because we know it's interesting. If we didn't just deserialize the declaration, calling isConsumerInterestedIn() should be safe. We tried to create a test case for this but we were not successful. Patch by Raphael Isemann (D32499)! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303432 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Switch from inferring owning modules based on source location toRichard Smith2017-05-181-4/+0
| | | | | | | | | | | | | | | | inferring based on the current module at the point of creation. This should result in no functional change except when building a preprocessed module (or more generally when using #pragma clang module begin/end to switch module in the middle of a file), in which case it allows us to correctly track the owning module for declarations. We can't map from FileID to module in the preprocessed module case, since all modules would have the same FileID. There are still a couple of remaining places that try to infer a module from a source location; I'll clean those up in follow-up changes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@303322 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Delay calling DeclMustBeEmitted until it's safe.Vassil Vassilev2017-04-121-3/+15
| | | | | | | | | | | | | | This patch implements the suggestion in D29753 that calling DeclMustBeEmitted in the middle of deserialization should be avoided and that the actual check should be deferred until it's safe to do so. This patch fixes a crash when accessing the invalid redecl chains while trying to evaluate the value of a const VarDecl that contains a function call. Patch by Raphael Isemann (D30793)! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@300110 91177308-0d34-0410-b5e6-96231b3b80d8
* Modular Codegen: Support homing debug info for types in modular objectsDavid Blaikie2017-04-111-2/+2
| | | | | | | | | Matching the function-homing support for modular codegen. Any type implicitly (implicit template specializations) or explicitly defined in a module is attached to that module's object file and omitted elsewhere (only a declaration used if necessary for references). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299987 91177308-0d34-0410-b5e6-96231b3b80d8
* Modular Codegen: Add/use a bit in serialized function definitions to track ↵David Blaikie2017-04-111-1/+3
| | | | | | | | | | | | | | | | | | | | | whether they are the subject of modular codegen Some decls are created not where they are written, but in other module files/users (implicit special members and function template implicit specializations). To correctly identify them, use a bit next to the definition to track the modular codegen property. Discussed whether the module file bit could be omitted in favor of reconstituting from the modular codegen decls list - best guess today is that the efficiency improvement of not having to deserialize the whole list whenever any function is queried by a module user is worth it for the small size increase of this redundant (list + bit-on-def) representation. Reviewers: rsmith Differential Revision: https://reviews.llvm.org/D29901 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299982 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules][PCH] Serialize #pragma packAlex Lorenz2017-03-313-0/+15
| | | | | | | | | | | | This patch serializes the state of #pragma pack. It preserves the state of the pragma from a PCH/from modules in a file that uses that PCH/those modules. rdar://21359084 Differential Revision: https://reviews.llvm.org/D31241 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299226 91177308-0d34-0410-b5e6-96231b3b80d8
* Spelling mistakes in comments. NFCI. (PR27635)Simon Pilgrim2017-03-301-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299083 91177308-0d34-0410-b5e6-96231b3b80d8
* [Serialization] Serialize DependentSizedExtVectorTypeAlex Lorenz2017-03-221-1/+3
| | | | | | | | | rdar://30659700 Differential Revision: https://reviews.llvm.org/D31134 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298493 91177308-0d34-0410-b5e6-96231b3b80d8
* Apply clang-tidy's performance-unnecessary-value-param to parts of clang.Benjamin Kramer2017-03-211-1/+1
| | | | | | No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298443 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply "Modules: Cache PCMs in memory and avoid a use-after-free"Duncan P. N. Exon Smith2017-03-204-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit r298185, effectively reapplying r298165, after fixing the new unit tests (PR32338). The memory buffer generator doesn't null-terminate the MemoryBuffer it creates; this version of the commit informs getMemBuffer about that to avoid the assert. Original commit message follows: ---- Clang's internal build system for implicit modules uses lock files to ensure that after a process writes a PCM it will read the same one back in (without contention from other -cc1 commands). Since PCMs are read from disk repeatedly while invalidating, building, and importing, the lock is not released quickly. Furthermore, the LockFileManager is not robust in every environment. Other -cc1 commands can stall until timeout (after about eight minutes). This commit changes the lock file from being necessary for correctness to a (possibly dubious) performance hack. The remaining benefit is to reduce duplicate work in competing -cc1 commands which depend on the same module. Follow-up commits will change the internal build system to continue after a timeout, and reduce the timeout. Perhaps we should reconsider blocking at all. This also fixes a use-after-free, when one part of a compilation validates a PCM and starts using it, and another tries to swap out the PCM for something new. The PCMCache is a new type called MemoryBufferCache, which saves memory buffers based on their filename. Its ownership is shared by the CompilerInstance and ModuleManager. - The ModuleManager stores PCMs there that it loads from disk, never touching the disk if the cache is hot. - When modules fail to validate, they're removed from the cache. - When a CompilerInstance is spawned to build a new module, each already-loaded PCM is assumed to be valid, and is frozen to avoid the use-after-free. - Any newly-built module is written directly to the cache to avoid the round-trip to the filesystem, making lock files unnecessary for correctness. Original patch by Manman Ren; most testcases by Adrian Prantl! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298278 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Modules: Cache PCMs in memory and avoid a use-after-free"Renato Golin2017-03-184-18/+4
| | | | | | This reverts commit r298165, as it broke the ARM builds. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298185 91177308-0d34-0410-b5e6-96231b3b80d8
* Modules: Cache PCMs in memory and avoid a use-after-freeDuncan P. N. Exon Smith2017-03-174-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clang's internal build system for implicit modules uses lock files to ensure that after a process writes a PCM it will read the same one back in (without contention from other -cc1 commands). Since PCMs are read from disk repeatedly while invalidating, building, and importing, the lock is not released quickly. Furthermore, the LockFileManager is not robust in every environment. Other -cc1 commands can stall until timeout (after about eight minutes). This commit changes the lock file from being necessary for correctness to a (possibly dubious) performance hack. The remaining benefit is to reduce duplicate work in competing -cc1 commands which depend on the same module. Follow-up commits will change the internal build system to continue after a timeout, and reduce the timeout. Perhaps we should reconsider blocking at all. This also fixes a use-after-free, when one part of a compilation validates a PCM and starts using it, and another tries to swap out the PCM for something new. The PCMCache is a new type called MemoryBufferCache, which saves memory buffers based on their filename. Its ownership is shared by the CompilerInstance and ModuleManager. - The ModuleManager stores PCMs there that it loads from disk, never touching the disk if the cache is hot. - When modules fail to validate, they're removed from the cache. - When a CompilerInstance is spawned to build a new module, each already-loaded PCM is assumed to be valid, and is frozen to avoid the use-after-free. - Any newly-built module is written directly to the cache to avoid the round-trip to the filesystem, making lock files unnecessary for correctness. Original patch by Manman Ren; most testcases by Adrian Prantl! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298165 91177308-0d34-0410-b5e6-96231b3b80d8
* Modules: Use hash of PCM content for SIGNATUREDuncan P. N. Exon Smith2017-03-134-24/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Change ASTFileSignature from a random 32-bit number to the hash of the PCM content. - Move definition ASTFileSignature to Basic/Module.h so Module and ASTSourceDescriptor can use it. - Change the signature from uint64_t to std::array<uint32_t,5>. - Stop using (saving/reading) the size and modification time of PCM files when there is a valid SIGNATURE. - Add UNHASHED_CONTROL_BLOCK, and use it to store the SIGNATURE record and other records that shouldn't affect the hash. Because implicit modules reuses the same file for multiple levels of -Werror, this includes DIAGNOSTIC_OPTIONS and DIAG_PRAGMA_MAPPINGS. This helps to solve a PCH + implicit Modules dependency issue: PCH files are handled by the external build system, whereas implicit modules are handled by internal compiler build system. This prevents invalidating a PCH when the compiler overwrites a PCM file with the same content (modulo the diagnostic differences). Design and original patch by Manman Ren! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297655 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused variableDavid Blaikie2017-02-271-2/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296386 91177308-0d34-0410-b5e6-96231b3b80d8