summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
Commit message (Collapse)AuthorAgeFilesLines
* [modules] Properly look up the owning module for an instantiation of a ↵Richard Smith2017-04-213-0/+37
| | | | | | | | | | | | | | | merged template. When looking for the template instantiation pattern of a templated entity, consistently select the definition of the pattern if there is one. This means we'll pick the same owning module when we start instantiating a template that we'll later pick when determining which modules are visible during that instantiation. This reinstates r300650, reverted in r300659, with a fix for a regression reported by Chandler after commit. llvm-svn: 300938
* [ODRHash] clean up test and add new examples. NFCRichard Trieu2017-04-201-124/+67
| | | | | | | | | Use a macro to generate the struct with all decls. Previously, four identical changes would be needed to update this test. This macro reduces that to one location. Added two other tests for issues that triggered false positives during testing. llvm-svn: 300814
* Revert r300653 and r300650. The underlying commit fixes one issue withChandler Carruth2017-04-192-23/+0
| | | | | | | | | | modules but exposes much more widespread issues. Example and more information is on the review thread for r300650. Original commit summary: [modules] Properly look up the owning module for an instantiation of a merged template. llvm-svn: 300659
* [modules] Properly look up the owning module for an instantiation of a ↵Richard Smith2017-04-192-0/+23
| | | | | | | | | | | | merged template. When looking for the template instantiation pattern of a templated entity, consistently select the definition of the pattern if there is one. This means we'll pick the same owning module when we start instantiating a template that we'll later pick when determining which modules are visible during that instantiation. llvm-svn: 300650
* PR30508: Downgrade error to warning if the umbrella folder doesn't exist.Vassil Vassilev2017-04-181-0/+8
| | | | | | Patch by Yuka Takahashi (D32119)! llvm-svn: 300594
* Modules: Do not serialize #pragma pack stateDuncan P. N. Exon Smith2017-04-155-59/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The modules side of r299226, which serializes #pragma pack state, doesn't work well. The main purpose was to make -include and -include-pch match semantics (the PCH side). We also started serializing #pragma pack in PCMs, in the hopes of making modules and non-modules builds more consistent. But consider: $ cat a.h $ cat b.h #pragma pack(push, 2) $ cat module.modulemap module M { module a { header "a.h" } module b { header "b.h" } } $ cat t.cpp #include "a.h" #pragma pack(show) As of r299226, the #pragma pack(show) gives "2", even though we've only included "a.h". - With -fmodules-local-submodule-visibility, this is clearly wrong. We should get the default state (8 on x86_64). - Without -fmodules-local-submodule-visibility, this kind of matches how other things work (as if include-the-whole-module), but it's still really terrible, and it doesn't actually make modules and non-modules builds more consistent. This commit disables the serialization for modules, essentially a partial revert of r299226. Going forward: 1. Having this #pragma pack stuff escape is terrible design (or, more often, a horrible bug). We should prioritize adding warnings (maybe -Werror by default?). 2. If we eventually reintroduce this for modules, it should only apply to -fmodules-local-submodule-visibility, and it should be tracked on a per-submodule basis. llvm-svn: 300380
* Removing a redundant, but harmless, %s; NFC.Aaron Ballman2017-04-141-1/+1
| | | | llvm-svn: 300347
* PR32185: Revert r291512 and add a testcase for PR32185.Richard Smith2017-04-131-2/+8
| | | | | | | | | | | | | | | This reverts an attempt to check that types match when matching a dependently-typed non-type template parameter. (This comes up when matching the parameters of a template template parameter against the parameters of a template template argument.) The matching rules here are murky at best. Our behavior after this revert is definitely wrong for certain C++17 features (for 'auto' template parameter types within the parameter list of a template template argument in particular), but our behavior before this revert is wrong for some pre-existing testcases, so reverting to our prior behavior seems like our best option. llvm-svn: 300262
* [Modules] Enable local submodule visibility for ObjC/CBruno Cardoso Lopes2017-04-121-0/+8
| | | | | | | | | | Remove the restriction where this is only valid with C++ rdar://problem/29055656 Differential Revision: https://reviews.llvm.org/D31781 llvm-svn: 300108
* Modular Codegen: Include testing for inline asm as well as some commentary ↵David Blaikie2017-04-122-0/+16
| | | | | | on the implementaiton choice. llvm-svn: 300106
* Fix up test to handle the now split -fmodules-codegen and ↵David Blaikie2017-04-121-2/+2
| | | | | | -fmodules-debuginfo flags llvm-svn: 300105
* Modular Codegen: Separate flags for function and debug info supportDavid Blaikie2017-04-125-1/+36
| | | | | | | | | | This allows using and testing these two features separately. (noteably, debug info is, so far as I know, always a win (basically). But function modular codegen is currently a loss for highly optimized code - where most of the linkonce_odr definitions are optimized away, so providing weak_odr definitions is only overhead) llvm-svn: 300104
* Revert r300001 "Revert r298824 & r298816, recommit r298742 & r298754"Hans Wennborg2017-04-121-170/+109
| | | | | | It caused PR32640. llvm-svn: 300074
* [Modules] Remove darwin specific code to check for SystemVersion.plistBruno Cardoso Lopes2017-04-121-31/+0
| | | | | | | | | | This isn't need anymore and modules options -fbuild-session-file and -fmodules-validate-once-per-build-session already provide a sane mechanism to validate the system headers. rdar://problem/19767523 llvm-svn: 300027
* Serialization: Simulate -Werror settings in implicit modulesDuncan P. N. Exon Smith2017-04-123-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r293123 started serializing diagnostic pragma state for modules. This makes the serialization work properly for implicit modules. An implicit module build (using Clang's internal build system) uses the same PCM file location for different `-Werror` levels. E.g., if a TU has `-Werror=format` and tries to load a PCM built without `-Werror=format`, a new PCM will be built in its place (and the new PCM should have the same signature, since r297655). In the other direction, if a TU does not have `-Werror=format` and tries to load a PCM built with `-Werror=format`, it should "just work". The idea is to evolve the PCM toward the strictest -Werror flags that anyone tries. r293123 started serializing the diagnostic pragma state for each PCM. Since this encodes the -Werror settings at module-build time, it breaks the implicit build model. This commit filters the diagnostic state in order to simulate the current compilation's diagnostic settings. Firstly, it ignores the module's serialized first diagnostic state, replacing it with the state from this compilation's command-line. Secondly, if a pragma warning was upgraded to error/fatal when generating the PCM (e.g., due to `-Werror` on the command-line), it checks whether it should still be upgraded in its current context. llvm-svn: 300025
* Revert r298824 & r298816, recommit r298742 & r298754Richard Trieu2017-04-111-109/+170
| | | | | | | | | | | | | r299989 fixes the underlying issue by waiting long enough to late parsed arguments to be processed before doing an calculating the hash. r298742 [ODRHash] Add error messages for mismatched parameters in methods. r298754 [ODRHash] Add support for array and decayed types. llvm-svn: 300001
* Modular Codegen: Support homing debug info for types in modular objectsDavid Blaikie2017-04-113-7/+21
| | | | | | | | | 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). llvm-svn: 299987
* Modular Codegen: Add/use a bit in serialized function definitions to track ↵David Blaikie2017-04-116-4/+74
| | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 299982
* Modules/builtins.m requires shell.Galina Kistanova2017-04-041-0/+1
| | | | llvm-svn: 299410
* [Modules][PCH] Serialize #pragma packAlex Lorenz2017-03-315-0/+64
| | | | | | | | | | | 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 llvm-svn: 299226
* Revert r298742 "[ODRHash] Add error messages for mismatched parameters in ↵Vassil Vassilev2017-03-261-85/+1
| | | | | | | | methods." I failed to revert this in r298816. llvm-svn: 298824
* Revert 298754 and 298742.Vassil Vassilev2017-03-261-81/+120
| | | | | | They broke llvm modules builds and our internal modules infrastructure. llvm-svn: 298816
* [ODRHash] Add support for array and decayed types.Richard Trieu2017-03-251-120/+81
| | | | llvm-svn: 298754
* [ODRHash] Add error messages for mismatched parameters in methods.Richard Trieu2017-03-241-1/+85
| | | | llvm-svn: 298742
* Fix a test so that it actually checks the output.Peter Collingbourne2017-03-241-1/+1
| | | | llvm-svn: 298728
* [Modules] Find PrivateHeaders when looking into subframeworksBruno Cardoso Lopes2017-03-2111-0/+35
| | | | | | | | | Fix the current parsing of subframeworks in modulemaps to lookup for headers based on whether they are frameworks. rdar://problem/30563982 llvm-svn: 298391
* Avoid these headers looking like the same file on a content-addressed file ↵Richard Smith2017-03-202-0/+2
| | | | | | system. llvm-svn: 298300
* Reapply "Modules: Cache PCMs in memory and avoid a use-after-free"Duncan P. N. Exon Smith2017-03-2010-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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! llvm-svn: 298278
* Revert "Modules: Cache PCMs in memory and avoid a use-after-free"Renato Golin2017-03-1810-70/+0
| | | | | | This reverts commit r298165, as it broke the ARM builds. llvm-svn: 298185
* Modules: Cache PCMs in memory and avoid a use-after-freeDuncan P. N. Exon Smith2017-03-1710-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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! llvm-svn: 298165
* Fix test on Windows. Only a single backslash was required, not a double.Douglas Yung2017-03-151-1/+1
| | | | llvm-svn: 297799
* Make a blind attempt to fix this testcase on Windows.Adrian Prantl2017-03-141-1/+1
| | | | llvm-svn: 297791
* Canonicalize the path provided by -fmodules-cache-path.Adrian Prantl2017-03-147-0/+64
| | | | | | | | | | | This fixes lookup mismatches that could happen when the module cache path contained a '/./' component. <rdar://problem/30413458> Differential Revision: https://reviews.llvm.org/D30915 llvm-svn: 297790
* Modules: Use hash of PCM content for SIGNATUREDuncan P. N. Exon Smith2017-03-133-10/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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! llvm-svn: 297655
* Attempt to fix Windows buildbot.Galina Kistanova2017-03-102-0/+4
| | | | llvm-svn: 297497
* Print nested name specifiers for typedefs and type aliasesAlex Lorenz2017-03-101-3/+3
| | | | | | | | | | | | Printing typedefs or type aliases using clang_getTypeSpelling() is missing the namespace they are defined in. This is in contrast to other types that always yield the full typename including namespaces. Patch by Michael Reiher! Differential Revision: https://reviews.llvm.org/D29944 llvm-svn: 297465
* Fix handling of -fmodule-map-file=X where X has no directory component.Richard Smith2017-03-091-0/+9
| | | | llvm-svn: 297349
* Take into account C++17's noexcept function types during merging -- it shouldRichard Smith2017-03-083-0/+15
| | | | | | | be possible to merge a declaration with an unresolved function type against one with a resolved function type. llvm-svn: 297316
* [ODRHash] Hash typedefs and usings statements in classes.Richard Trieu2017-03-081-0/+105
| | | | llvm-svn: 297246
* [modules] Add missing test from r297030.Vassil Vassilev2017-03-063-0/+17
| | | | llvm-svn: 297037
* [ODRHash] Try again to fix build bot.Richard Trieu2017-03-041-3/+3
| | | | llvm-svn: 296958
* [ODRHash] Change test to try to appease buildbot.Richard Trieu2017-03-041-0/+2
| | | | llvm-svn: 296953
* [ODRHash] Add support for detecting different method properties.Richard Trieu2017-03-041-2/+119
| | | | | | | | Now print diagnostics for static, virtual, inline, volatile, and const differences in methods. Also use DeclarationName instead of IdentifierInfo for additional robustness in diagnostic printing. llvm-svn: 296932
* [Test] NFC: Fixed typo in commentsCharles Li2017-03-012-5/+5
| | | | | | Changed "declerations" to "declarations" llvm-svn: 296648
* [ODRHash] Add basic support for CXXRecordDeclRichard Trieu2017-02-281-0/+41
| | | | llvm-svn: 296521
* [modules] For -module-file-info, print out the resource dir path, since it ↵Argyrios Kyrtzidis2017-02-251-0/+1
| | | | | | is included in the module hash. llvm-svn: 296261
* [ODRHash] Finish FieldDecl support by handling mutable and initializers.Richard Trieu2017-02-241-0/+50
| | | | | | https://reviews.llvm.org/rL296170 llvm-svn: 296198
* [Test] Make Lit tests C++11 compatible #10Charles Li2017-02-242-0/+19
| | | | | | Differential Revision: https://reviews.llvm.org/D21626 llvm-svn: 296193
* [ODRHash] Add handling of bitfieldsRichard Trieu2017-02-241-0/+53
| | | | | | Differential Revision: https://reviews.llvm.org/D21675 llvm-svn: 296170
* [ODRHash] Add handling of TypedefType and DeclarationNameRichard Trieu2017-02-241-0/+42
| | | | | | Differential Revision: https://reviews.llvm.org/D21675 llvm-svn: 296078
OpenPOWER on IntegriCloud