summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
Commit message (Collapse)AuthorAgeFilesLines
...
* [modules] Fix Decl's Used invariant.Vassil Vassilev2016-04-274-0/+77
| | | | | | | | | | | | | | | | | | | | The Decl::isUsed has a value for every decl. In non-module builds it is very difficult (but possible) to break this invariant but when we walk up the redecl chain we find the neccessary information. When deserializing the decls from a module it is much more difficult to update correctly this invariant. The patch centralizes the information whether a decl is used in the canonical decl marking the entire entity as being used. Fixes https://llvm.org/bugs/show_bug.cgi?id=27401 Patch by Cristina Cristescu and me. Thanks to Richard Smith who helped to debug and understand the issue! Reviewed by Richard Smith. llvm-svn: 267691
* PR27513: When determining which declaration to put into an exported lookupRichard Smith2016-04-2612-0/+40
| | | | | | | | | | | table for a module / PCH, never map from a normal declaration of a class to an injected-class-name declaration (or vice versa). Those declarations live in distinct lookup tables and should not be confused. We really shouldn't be using a CXXRecordDecl to represent an injected-class-name in the first place; I've filed PR27532 so we don't forget. llvm-svn: 267632
* Module debugging: Also correctly handle typedef'd foward-declared members.Adrian Prantl2016-04-263-5/+21
| | | | | | Thanks again to Richard Smith for pointing this out. llvm-svn: 267630
* Module debugging: Add testcase for member classes of class template ↵Adrian Prantl2016-04-262-1/+18
| | | | | | specializations. llvm-svn: 267612
* Module debugging: Use the definition to determine module-defined types.Adrian Prantl2016-04-261-0/+9
| | | | | | Follow-up to r267464. Thanks to Richard Smith for pointing this out! llvm-svn: 267611
* Module Debugging: Fix the condition for determining whether a templateAdrian Prantl2016-04-253-18/+119
| | | | | | | | | | | | | | | | | | instantiation is in a module. This patch fixes the condition for determining whether the debug info for a template instantiation will exist in an imported clang module by: - checking whether the ClassTemplateSpecializationDecl is complete and - checking that the instantiation was in a module by looking at the first field. I also added a negative check to make sure that a typedef to a forward-declared template (with the definition outside of the module) is handled correctly. http://reviews.llvm.org/D19443 rdar://problem/25553724 llvm-svn: 267464
* DebugInfo: Adapt to loss of DITypeRef in LLVM r267296Duncan P. N. Exon Smith2016-04-232-34/+29
| | | | | | | | | | | | | LLVM stopped using MDString-based type references, and DIBuilder no longer fills 'retainedTypes:' with every DICompositeType that has an 'identifier:' field. There are just minor changes to keep the same behaviour in CFE. Leaving 'retainedTypes:' unfilled has a dramatic impact on the output order of the IR though. There are a huge number of testcase changes, which were unfortunately not really scriptable. llvm-svn: 267297
* Module Debugging: Emit the canonical debug info for Objective-C classesAdrian Prantl2016-04-203-3/+24
| | | | | | | | | | | | | in the compile unit that contains their implementation even if their interface is declared in a module. The private @implementation of an @interface may have additional hidden ivars so we should not defer to the public version of the type that is found in the module. <rdar://problem/25541798> llvm-svn: 266937
* DebugInfo: Make DICompositeTypes distinct most of the timeDuncan P. N. Exon Smith2016-04-173-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Since elements of most kinds of DICompositeType have back references, most are involved in uniquing cycles. Except via the ODR 'identifier:' field, which doesn't care about the storage type (see r266549), they have no hope of being uniqued. Distinct nodes are far more efficient, so use them for most kinds of DICompositeType definitions (i.e., when DIType::isForwardDecl is false). The exceptions: - DW_TAG_array_type, since their elements never have back-references and they never have ODR 'identifier:' fields; - DW_TAG_enumeration_type when there is no ODR 'identifier:' field, since their elements usually don't have back-references. This breaks the last major uniquing cycle I'm aware of in the debug info graph. The impact won't be enormous for C++ because references to ODR-uniqued nodes still use string-based DITypeRefs; but this should prevent a regression in C++ when we drop the string-based references. This wouldn't have been reasonable until r266549, when composite types stopped relying on being uniqued by structural equivalence to prevent blow-ups at LTO time. llvm-svn: 266556
* Update to match LLVM changes for PR27284.Adrian Prantl2016-04-153-27/+25
| | | | | | | | | (Reverse the ownership between DICompileUnit and DISubprogram.) http://reviews.llvm.org/D19034 <rdar://problem/25256815> llvm-svn: 266445
* Fix off-by-one error in worst-case number of offsets needed for an AST record.Richard Smith2016-04-141-0/+5
| | | | llvm-svn: 266353
* [CrashReproducer] Add test to run the reproducer script + modulesBruno Cardoso Lopes2016-04-131-0/+57
| | | | | | | Now that we have basic support in place, make sure the reproducer script works with modules for a simple testcase. llvm-svn: 266235
* [CrashReproducer] Setup 'use-external-names' in YAML files.Bruno Cardoso Lopes2016-04-133-3/+10
| | | | | | | | | | | | | | Hide the real paths when rebuilding from VFS by setting up the crash reproducer to use 'use-external-names' = false. This way we avoid module redifinition errors and consistently use the same paths against all modules. With this change on Darwin we are able to simulate a crash for a simple application using "Foundation/Foundation.h" (which relies on a bunch of different frameworks and headers) and successfully rebuild all the modules by relying solely at the VFS overlay. llvm-svn: 266234
* [modules] Extend r266113 to cope with submodules.Richard Smith2016-04-121-1/+1
| | | | llvm-svn: 266116
* [modules] When an incompatible module file is explicitly provided for a module,Richard Smith2016-04-121-1/+4
| | | | | | | | and we fall back to textual inclusion, don't require the module as a whole to be marked available; it's OK if some other file in the same module is missing, just as it would be if the header were explicitly marked textual. llvm-svn: 266113
* PR25501: Delay loading visible updates for a declaration until after we'veRichard Smith2016-04-087-0/+25
| | | | | | | | | | | processed update records. If an update record adds a definition, we need to merge that with any pre-existing definition to determine which the canonical definition is before we apply the visible update, otherwise we wouldn't know where to apply it. Thanks to Vassil Vassilev for help reducing this and tracking down the problem. llvm-svn: 265848
* [modules] Handle merged fields in designated initializers.Richard Smith2016-04-082-0/+12
| | | | llvm-svn: 265838
* [modules] Add a comment to explain why -E leaves some #includes in the ↵Richard Smith2016-04-081-1/+3
| | | | | | preprocessed output. llvm-svn: 265766
* [modules] Don't write @import in -E output if the current language mode doesn'tRichard Smith2016-04-081-0/+22
| | | | | | support @import; use the form as written instead. llvm-svn: 265756
* Replace Sema-level implementation of -fassume-sane-operator-new with aRichard Smith2016-04-071-0/+3
| | | | | | | | | | | | | | CodeGen-level implementation. Instead of adding an attribute to clang's FunctionDecl, add the IR attribute directly. This means a module built with this flag is now compatible with code built without it and vice versa. This change also results in the 'noalias' attribute no longer being added to calls to operator new in the IR; it's now only added to the declaration. It also fixes a bug where we failed to add the attribute to the 'nothrow' versions (because we didn't implicitly declare them, there was no good time to inject a fake attribute). llvm-svn: 265728
* [modules] Allow differences in flags that only affect preprocessor predefinesRichard Smith2016-04-071-2/+14
| | | | | | | (and __has_feature checks) between explicitly-specified module files and the current compilation. llvm-svn: 265718
* [CrashReproducer] Setup 'case-sensitive' in YAML files.Bruno Cardoso Lopes2016-04-071-0/+2
| | | | | | | | | The crash reproducer was not setting up case sensitivity in the VFS yaml files, which defaults to true. Make the crash reproducer explicitly set that flag based on the case sensitivity of the .cache path where vfs and modules are dumped. llvm-svn: 265622
* Keep -fmodule-implementation-of as an alias of -fmodule-name.Manman Ren2016-04-061-5/+5
| | | | | | | | | This helps us transitioning to -fmodule-name. Once the transitioning is done, we can remove this alias. rdar://24800983 llvm-svn: 265616
* [modules] Add forgotten test case to r265597.Vassil Vassilev2016-04-065-0/+16
| | | | llvm-svn: 265599
* [CrashReproducer] Pass -I, -F and -resource-dir to the reproducer script ↵Bruno Cardoso Lopes2016-04-041-5/+6
| | | | | | | | | | when using modules/vfs The reproducer should use -I/-F/-resource-dir in the same way as the original command. The VFS already collects the right headers but without these flags the reproducer will fail to do the right thing. llvm-svn: 265343
* [CrashReproducer] Add -fmodule-cache-path to reproducer scriptBruno Cardoso Lopes2016-04-015-0/+5
| | | | | | | | The cc1 invocation in the reproducer script should contain a valid path in -fmodule-cache-path; for that reuse "<name>.cache/module" dir we already use to dump the vfs and modules. llvm-svn: 265162
* [CrashReproducer] Add a module map callback for added headersBruno Cardoso Lopes2016-03-301-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current ModuleDependencyCollector has a AST listener to collect header files present in loaded modules, but this isn't enough to collect all headers needed in the crash reproducer. One of the reasons is that the AST writer doesn't write symbolic link header paths in the pcm modules, this makes the listeners on the reader only able to collect the real files. Since the module maps could contain submodules that use headers which are symbolic links, not collecting those forbid the reproducer scripts to regen the modules. For instance: usr/include/module.map: ... module pthread { header "pthread.h" export * module impl { header "pthread_impl.h" export * } } ... usr/include/pthread/pthread_impl.h usr/include/pthread_impl.h -> pthread/pthread_impl.h The AST dump for the module above: <SUBMODULE_HEADER abbrevid=6/> blob data = 'pthread_impl.h' <SUBMODULE_TOPHEADER abbrevid=7/> blob data = '/<path_to_sdk>/usr/include/pthread/pthread_impl.h' Note that we don't have "usr/include/pthread_impl.h" which is requested by the module.map in case we want to reconstruct the module in the reproducer. The reason the original symbolic link path isn't used is because the headers are kept by name and requested through the FileManager, which unique files and returns the real path only. To fix that, add a callback to be invoked everytime a header is added while parsing module maps and hook that up to the module dependecy collector. This callback is only registered when generating the reproducer. Differential Revision: http://reviews.llvm.org/D18585 rdar://problem/24499339 llvm-svn: 264971
* [VFS] Handle empty entries in directory traversalBruno Cardoso Lopes2016-03-305-0/+61
| | | | | | | | | | | | | The VFS YAML files contain empty directory entries to describe that it's returning from a subdirectory before describing new files in the parent. In the future, we should properly sort and write YAML files avoiding such empty dirs and mitigate the extra recurson cost. However, since this is used by previous existing YAMLs, make the traversal work in their presence. rdar://problem/24499339 llvm-svn: 264970
* Add -emit-llvm-only to the regression test for PR21547.Vassil Vassilev2016-03-301-0/+1
| | | | llvm-svn: 264939
* Canonicalize UnaryTransformType types when they don't have a known ↵Vassil Vassilev2016-03-304-0/+39
| | | | | | | | | | underlying type. Fixes https://llvm.org/bugs/show_bug.cgi?id=26014 Reviewed by Richard Smith. llvm-svn: 264937
* [modules] Write out identifiers if the ID is local, too.Vassil Vassilev2016-03-305-0/+14
| | | | | | | | | | | | | | | | | In some cases a slot for an identifier is requested but it gets written to another module, causing an assertion. At the point when we start serializing Rtypes, we have no imported IdentifierID for float_round_style. We start serializing stuff and allocate an ID for it. Then, during the serialization process, we pull in the identifier info for it from TSchemaHelper. Finally, WriteIdentifierTable decides that the identifier has not changed since it was deserialized, so doesn't emit it. Fixes https://llvm.org/bugs/show_bug.cgi?id=27041 Discussed on IRC with Richard Smith. Agreed on post commit review if needed. llvm-svn: 264913
* [modules] Add a regression test for PR21547.Vassil Vassilev2016-03-303-0/+24
| | | | llvm-svn: 264908
* [modules] If both a module file and a module map for the same module areRichard Smith2016-03-281-1/+7
| | | | | | | | | | explicitly provided, and the module map lists a header that does not exist, unmark the module as 'unavailable' when loading its .pcm file. (Use of the module might still fail if the relevant headers aren't embedded, but this behavior is now consistent with how we behave if the module map is not provided, and with the desired behavior for embedding headers in modules.) llvm-svn: 264664
* [modules] Don't invent a module cache path unless implicit module builds are ↵Richard Smith2016-03-211-0/+4
| | | | | | enabled. llvm-svn: 263970
* [VFS] Fix test to use more restrict set of headersBruno Cardoso Lopes2016-03-201-5/+5
| | | | llvm-svn: 263912
* Reapply [2] [VFS] Add 'overlay-relative' field to YAML filesBruno Cardoso Lopes2016-03-203-8/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reapplies r261552 and r263748. Fixed testcase to reapply. The VFS overlay mapping between virtual paths and real paths is done through the 'external-contents' entries in YAML files, which contains hardcoded paths to the real files. When a module compilation crashes, headers are dumped into <name>.cache/vfs directory and are mapped via the <name>.cache/vfs/vfs.yaml. The script generated for reproduction uses -ivfsoverlay pointing to file to gather the mapping between virtual paths and files inside <name>.cache/vfs. Currently, we are only capable of reproducing such crashes in the same machine as they happen, because of the hardcoded paths in 'external-contents'. To be able to reproduce a crash in another machine, this patch introduces a new option in the VFS yaml file called 'overlay-relative'. When it's equal to 'true' it means that the provided path to the YAML file through the -ivfsoverlay option should also be used to prefix the final path for every 'external-contents'. Example, given the invocation snippet "... -ivfsoverlay <name>.cache/vfs/vfs.yaml" and the following entry in the yaml file: "overlay-relative": "true", "roots": [ ... "type": "directory", "name": "/usr/include", "contents": [ { "type": "file", "name": "stdio.h", "external-contents": "/usr/include/stdio.h" }, ... Here, a file manager request for virtual "/usr/include/stdio.h", that will map into real path "/<absolute_path_to>/<name>.cache/vfs/usr/include/stdio.h. This is a useful feature for debugging module crashes in machines other than the one where the error happened. Differential Revision: http://reviews.llvm.org/D17457 rdar://problem/24499339 llvm-svn: 263893
* Revert "Reapply [VFS] Add 'overlay-relative' field to YAML files"Bruno Cardoso Lopes2016-03-173-65/+8
| | | | | | | | | Tests failing on http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/46102 This reverts commit a1683cd6c9e07359c09f86e98a4db6b4e1bc51fc. llvm-svn: 263750
* Reapply [VFS] Add 'overlay-relative' field to YAML filesBruno Cardoso Lopes2016-03-173-8/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reapplies r261552. The VFS overlay mapping between virtual paths and real paths is done through the 'external-contents' entries in YAML files, which contains hardcoded paths to the real files. When a module compilation crashes, headers are dumped into <name>.cache/vfs directory and are mapped via the <name>.cache/vfs/vfs.yaml. The script generated for reproduction uses -ivfsoverlay pointing to file to gather the mapping between virtual paths and files inside <name>.cache/vfs. Currently, we are only capable of reproducing such crashes in the same machine as they happen, because of the hardcoded paths in 'external-contents'. To be able to reproduce a crash in another machine, this patch introduces a new option in the VFS yaml file called 'overlay-relative'. When it's equal to 'true' it means that the provided path to the YAML file through the -ivfsoverlay option should also be used to prefix the final path for every 'external-contents'. Example, given the invocation snippet "... -ivfsoverlay <name>.cache/vfs/vfs.yaml" and the following entry in the yaml file: "overlay-relative": "true", "roots": [ ... "type": "directory", "name": "/usr/include", "contents": [ { "type": "file", "name": "stdio.h", "external-contents": "/usr/include/stdio.h" }, ... Here, a file manager request for virtual "/usr/include/stdio.h", that will map into real path "/<absolute_path_to>/<name>.cache/vfs/usr/include/stdio.h. This is a useful feature for debugging module crashes in machines other than the one where the error happened. Differential Revision: http://reviews.llvm.org/D17457 rdar://problem/24499339 llvm-svn: 263748
* Use a simpler set of mock headers for the vfs+modules crash recovery tests.Benjamin Kramer2016-03-175-6/+17
| | | | | | | | | | The System/ mock is large and too complex for this test. It can cause the tests to fail in mysterious ways as it depends on the resource dir being present, which is not really supported for driver tests (using %clang instead of %clang_cc1). Copy the tree and trim out all the %unnecessary fat. llvm-svn: 263718
* Reapply [2]: [VFS] Add support for handling path traversalsBruno Cardoso Lopes2016-03-172-0/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was applied twice r261551 and 263617 and later reverted because: (1) Windows bot failing on unittests. Change the current behavior to do not handle path traversals on windows. (2) Windows bot failed to include llvm/Config/config.h in order to use HAVE_REALPATH. Use LLVM_ON_UNIX instead, as done in lib/Basic/FileManager.cpp. Handle ".", ".." and "./" with trailing slashes while collecting files to be dumped into the vfs overlay directory. Include the support for symlinks into components. Given the path: /install-dir/bin/../lib/clang/3.8.0/include/altivec.h, if "bin" component is a symlink, it's not safe to use `path::remove_dots` here, and `realpath` is used to get the right answer. Since `realpath` is expensive, we only do it at collecting time (which only happens during the crash reproducer) and cache the base directory for fast lookups. Overall, this makes the input to the VFS YAML file to be canonicalized to never contain traversal components. Differential Revision: http://reviews.llvm.org/D17104 rdar://problem/24499339 llvm-svn: 263686
* Revert r263617, "Reapply: [VFS] Add support for handling path traversals"NAKAMURA Takumi2016-03-162-132/+0
| | | | | | It broke standalone clang build. llvm-svn: 263636
* [modules] Fix adding a templated friend functions to a namespace from ↵Vassil Vassilev2016-03-164-0/+56
| | | | | | | | | | | | | | another module. When clang adds argument dependent lookup candidates, it can perform template instantiation. For example, it can instantiate a templated friend function and register it in the enclosing namespace's lookup table. Fixes https://llvm.org/bugs/show_bug.cgi?id=24954 Reviewed by Richard Smith. llvm-svn: 263634
* Reapply: [VFS] Add support for handling path traversalsBruno Cardoso Lopes2016-03-162-0/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | This is originally r261551, reverted because of windows bots failing on unittests. Change the current behavior to do not handle path traversals on windows. Handle ".", ".." and "./" with trailing slashes while collecting files to be dumped into the vfs overlay directory. Include the support for symlinks into components. Given the path: /install-dir/bin/../lib/clang/3.8.0/include/altivec.h, if "bin" component is a symlink, it's not safe to use `path::remove_dots` here, and `realpath` is used to get the right answer. Since `realpath` is expensive, we only do it at collecting time (which only happens during the crash reproducer) and cache the base directory for fast lookups. Overall, this makes the input to the VFS YAML file to be canonicalized to never contain traversal components. Differential Revision: http://reviews.llvm.org/D17104 rdar://problem/24499339 llvm-svn: 263617
* [modules] Don't diagnose non-modular includes from modular files that areRichard Smith2016-03-142-0/+8
| | | | | | implementation units of modules rather than interface units. llvm-svn: 263449
* Module Debugging: Fix a crash when emitting debug info for nested tag typesAdrian Prantl2016-03-072-0/+18
| | | | | | | | whose DeclContext is not yet complete by deferring their emission. rdar://problem/24918680 llvm-svn: 262851
* [Modules] Don't swallow errors when parsing optional attributes.Davide Italiano2016-03-061-0/+12
| | | | | | Differential Revision: http://reviews.llvm.org/D17787 llvm-svn: 262789
* [modules] Prefer more complete array types.Vassil Vassilev2016-02-283-5/+0
| | | | | | | | | | | | | | If we import a module that has a complete array type and one that has an incomplete array type, the declaration found by name lookup might be the one with the incomplete type, possibly resulting in rejects-valid. Now, the name lookup prefers decls with a complete array types. Also, diagnose cases when the redecl chain has array bound, different from the merge candidate. Reviewed by Richard Smith. llvm-svn: 262189
* Revert "[VFS] Add support for handling path traversals"Bruno Cardoso Lopes2016-02-232-130/+0
| | | | | | | | | | | | | | This reverts commit r261551 due to failing tests in windows bots: http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/10054 Failing Tests (4): Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.CaseInsensitive Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.DirectoryIteration Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.MappedFiles Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.UseExternalName llvm-svn: 261654
* Revert "[VFS] Add 'overlay-relative' field to YAML files" and "[VFS] Fix ↵Bruno Cardoso Lopes2016-02-233-64/+7
| | | | | | | | | | | | | | | call to getVFSFromYAML in unittests" This reverts commit r261552 and r261556 because of failing unittests on windows: Failing Tests (4): Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.CaseInsensitive Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.DirectoryIteration Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.MappedFiles Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.UseExternalName llvm-svn: 261613
* [VFS] Add 'overlay-relative' field to YAML filesBruno Cardoso Lopes2016-02-223-7/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The VFS overlay mapping between virtual paths and real paths is done through the 'external-contents' entries in YAML files, which contains hardcoded paths to the real files. When a module compilation crashes, headers are dumped into <name>.cache/vfs directory and are mapped via the <name>.cache/vfs/vfs.yaml. The script generated for reproduction uses -ivfsoverlay pointing to file to gather the mapping between virtual paths and files inside <name>.cache/vfs. Currently, we are only capable of reproducing such crashes in the same machine as they happen, because of the hardcoded paths in 'external-contents'. To be able to reproduce a crash in another machine, this patch introduces a new option in the VFS yaml file called 'overlay-relative'. When it's equal to 'true' it means that the provided path to the YAML file through the -ivfsoverlay option should also be used to prefix the final path for every 'external-contents'. Example, given the invocation snippet "... -ivfsoverlay <name>.cache/vfs/vfs.yaml" and the following entry in the yaml file: "overlay-relative": "true", "roots": [ ... "type": "directory", "name": "/usr/include", "contents": [ { "type": "file", "name": "stdio.h", "external-contents": "/usr/include/stdio.h" }, ... Here, a file manager request for virtual "/usr/include/stdio.h", that will map into real path "/<absolute_path_to>/<name>.cache/vfs/usr/include/stdio.h. This is a useful feature for debugging module crashes in machines other than the one where the error happened. Differential Revision: http://reviews.llvm.org/D17457 rdar://problem/24499339 llvm-svn: 261552
OpenPOWER on IntegriCloud