summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
Commit message (Collapse)AuthorAgeFilesLines
* Extend -ast-dump for CXXRecordDecl to dump the flags from the DefinitionData.Richard Smith2017-09-221-0/+14
| | | | llvm-svn: 313943
* [Module map] Introduce a private module re-export directive.Douglas Gregor2017-09-142-0/+18
| | | | | | | | | | | | | 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. llvm-svn: 313316
* [modules] Add test for using declaration in classes.Raphael Isemann2017-08-291-0/+34
| | | | | | | | | | | | | | | | | Summary: This adds a test that checks if the using declaration in classes still works as intended with modules. The motivation for this is that we tried to add a shortcut to `removeDecl` that would skip the removal of declarations from the lookup table if they are hidden. This optimization passed the clang test suite but actually broke the using declaration in combination with -fmodules-local-submodule-visibility. In this mode we hide all decls from other modules such as by chance the parent method, in which case don't remove the parent method from the lookup table and get ambiguous lookup errors. After this patch we now correctly see if this behavior is broken by a patch like this in the test suite. Reviewers: v.g.vassilev Reviewed By: v.g.vassilev Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D37180 llvm-svn: 311991
* [ODRHash] Diagnose differing template parameters.Richard Trieu2017-08-231-0/+77
| | | | llvm-svn: 311519
* [clang] Get rid of "%T" expansionsKuba Mracek2017-08-152-4/+5
| | | | | | | | | | The %T lit expansion expands to a common directory shared between all the tests in the same directory, which is unexpected and unintuitive, and more importantly, it's been a source of subtle race conditions and flaky tests. In https://reviews.llvm.org/D35396, it was agreed that it would be best to simply ban %T and only keep %t, which is unique to each test. When a test needs a temporary directory, it can just create one using mkdir %t. This patch removes %T in clang. Differential Revision: https://reviews.llvm.org/D36437 llvm-svn: 310950
* Revert "[Modules] Prevent #import to reenter header if not building a module."Bruno Cardoso Lopes2017-08-122-14/+0
| | | | | | | This reverts commit r310605. Richard pointed out a better way to achieve this, which I'll post a patch for soon. llvm-svn: 310775
* [modules] Set the lexical DC for dummy tag decls that refer to hiddenAlex Lorenz2017-08-113-0/+27
| | | | | | | | | | | | | | declarations that are made visible after the dummy is parsed and ODR verified Prior to this commit the "(getContainingDC(DC) == CurContext && "The next DeclContext should be lexically contained in the current one.")," assertion failure was triggered during semantic analysis of the dummy tag declaration that was declared in another tag declaration because its lexical context did not point to the outer tag decl. rdar://32292196 llvm-svn: 310706
* [Modules] Prevent #import to reenter header if not building a module.Bruno Cardoso Lopes2017-08-102-0/+14
| | | | | | | | | | When non-modular headers are imported while not building a module but in -fmodules mode, be conservative and preserve the default #import semantic: do not reenter headers. rdar://problem/33745031 llvm-svn: 310605
* Fix incorrect use of current directory to find moved paths in ASTReader.Manuel Klimek2017-07-251-0/+70
| | | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 308962
* Debug Info: Avoid completing class types when a definition is in a module.Adrian Prantl2017-07-243-6/+20
| | | | | | | | | | This patch adds an early exit to CGDebugInfo::completeClassData() when compiling with -gmodules and the to-be-completed type is available in a clang module. rdar://problem/23599990 llvm-svn: 308938
* Update for LLVM IR metadata changes (DIImportedEntity now needs a DIFile).Adrian Prantl2017-07-196-5/+37
| | | | | | | | | <rdar://problem/33357889> https://bugs.llvm.org/show_bug.cgi?id=33822 Differential Revision: https://reviews.llvm.org/D35583 llvm-svn: 308399
* Debug Info: Set the MainFileName when generating -gmodules debug info for PCM.Adrian Prantl2017-07-181-2/+4
| | | | | | | Previously it was uninitialized and thus always defaulted to "<stdin>". This is mostly a cosmetic change that helps making the debug info more readable. llvm-svn: 308397
* [ODRHash] Revert r307743 which reverted r307720Richard Trieu2017-07-151-0/+69
| | | | | | | Reapply r307720 to allow processing of constructors and destructors. Reuse the diagnostics for CXXMethodDecl for them. llvm-svn: 308077
* [ODRHash] Avoid taking the types of FunctionDecl'sRichard Trieu2017-07-141-0/+14
| | | | | | | | FunctionDecl already hashes most of the information in the function's type. Add hashing of the return type, and skip hashing the function's type to avoid redundancy and extra work when computing the hash. llvm-svn: 307986
* [ODRHash] Revert r307720 to fix buildbot.Richard Trieu2017-07-121-69/+0
| | | | llvm-svn: 307743
* [ODRHash] Support more method types.Richard Trieu2017-07-111-0/+69
| | | | | | | Hash CXXConstructorDecl and CXXDestructorDecl. Extend the diagnostics from CXXMethodDecl to include constructors and destructors. llvm-svn: 307720
* [ODRHash] Support FriendDeclRichard Trieu2017-07-081-0/+78
| | | | llvm-svn: 307458
* Reject attempts to build a module without -fmodules, rather than silently ↵Richard Smith2017-07-063-11/+16
| | | | | | doing weird things. llvm-svn: 307316
* [ODRHash] Revert r305104 - Skip inline namespaces when hashing.Richard Trieu2017-07-011-0/+18
| | | | | | Test inline namespaces and handle them in the ODR hash again. llvm-svn: 306926
* [Modules] Implement ODR-like semantics for tag types in C/ObjCBruno Cardoso Lopes2017-07-017-13/+86
| | | | | | | | | | | | | | | | | | | | | | Allow ODR for ObjC/C in the sense that we won't keep more that one definition around (merge them). However, ensure the decl pass the structural compatibility check in C11 6.2.7/1, for that, reuse the structural equivalence checks used by the ASTImporter. Few other considerations: - Create error diagnostics for tag types mismatches and thread them into the structural equivalence checks. - Note that by doing this we only support redefinition between types that are considered "compatible types" by C. This is mixed approach of the suggestions discussed in http://lists.llvm.org/pipermail/cfe-dev/2017-March/053257.html Differential Revision: https://reviews.llvm.org/D31778 rdar://problem/31909368 llvm-svn: 306918
* [ODRHash] Support Type TemplateArgumentRichard Trieu2017-06-301-0/+34
| | | | llvm-svn: 306904
* [ODRHash] Improve typedef handling.Richard Trieu2017-06-291-0/+16
| | | | | | | Follow typedef chains to find the root type when processing types, and also keep track of qualifiers. llvm-svn: 306753
* [ASTReader] Add test for previous change r306583 / 145692e.Graydon Hoare2017-06-295-0/+29
| | | | | | | | | | | | | | | | | | | | Summary: Add a test for the change to ASTReader that reproduces the logic for consolidating multiple ObjC interface definitions to the case of multiple ObjC protocol definitions. This test is a modified copy of the test that accompanied the original change to interfaces, in 2ba1979. Reviewers: bruno Reviewed By: bruno Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D34788 llvm-svn: 306732
* Track the set of module maps read while building a .pcm file and reload ↵Richard Smith2017-06-296-0/+23
| | | | | | those when preprocessing from that .pcm file. llvm-svn: 306628
* Fix this test to use a construct that actually forces struct layout to ↵Richard Smith2017-06-271-1/+1
| | | | | | happen when testing -Wpadded. llvm-svn: 306349
* When preprocessing with -frewrite-imports and -fmodule-file=, do not pass allRichard Smith2017-06-265-16/+38
| | | | | | | | | | | modules to preprocessing of nested .pcm files. Making those module files available results in loading more .pcm files than necessary, and potentially in misbehavior if a module makes itself visible during its own compilation (as parts of that module that have not yet been processed would then become visible). llvm-svn: 306320
* Testcase missed from r306075.Richard Smith2017-06-261-0/+29
| | | | llvm-svn: 306270
* PR33002: When we instantiate the definition of a static data member, we mightRichard Smith2017-06-221-0/+30
| | | | | | | have attached an initializer to the in-class declaration. If so, include the initializer in the update record for the instantiation. llvm-svn: 306065
* Support non-identifier module names when preprocessing modules.Richard Smith2017-06-191-0/+4
| | | | llvm-svn: 305758
* [ODRHash] Hash VarDecl members.Richard Trieu2017-06-161-2/+177
| | | | | | | These VarDecl's are static data members of classes. Since the initializers are also hashed, this also provides checking for default arguments to methods. llvm-svn: 305543
* [ODRHash] Hash TemplateArgument::Pack and TemplateTypeParmTypeRichard Trieu2017-06-151-0/+41
| | | | llvm-svn: 305440
* [ODRHash] Hash Template and TemplateExpansion in TemplateArgument.Richard Trieu2017-06-141-0/+18
| | | | llvm-svn: 305361
* [ODRHash] Hash Expr for TemplateArgument::ExpressionRichard Trieu2017-06-141-0/+33
| | | | llvm-svn: 305360
* [ODRHash] Add TemplateArgument kind to hash.Richard Trieu2017-06-131-0/+18
| | | | llvm-svn: 305328
* [ODRHash] Add diagnostic messages for typedef and type alias.Richard Trieu2017-06-121-0/+102
| | | | llvm-svn: 305238
* IR: Replace the "Linker Options" module flag with "llvm.linker.options" ↵Peter Collingbourne2017-06-123-10/+5
| | | | | | | | | | named metadata. The new metadata is easier to manipulate than module flags. Differential Revision: https://reviews.llvm.org/D31349 llvm-svn: 305227
* Revert r305110 to fix buildbotRichard Trieu2017-06-091-18/+0
| | | | llvm-svn: 305130
* Add -frewrite-imports flag.Richard Smith2017-06-091-0/+26
| | | | | | | | If specified, when preprocessing, the contents of imported .pcm files will be included in preprocessed output. The resulting preprocessed file can then be compiled standalone without the module sources or .pcm files. llvm-svn: 305116
* [ODRHash] Add support for TemplateArgument types.Richard Trieu2017-06-091-0/+18
| | | | | | | Recommit r304592 that was reverted in r304618. r305104 should have fixed the issue. llvm-svn: 305110
* Add #pragma clang module build/endbuild pragmas for performing a module buildRichard Smith2017-06-091-0/+35
| | | | | | | | | | | | | | | as part of a compilation. This is intended for two purposes: 1) Writing self-contained test cases for modules: we can now write a single source file test that builds some number of module files on the side and imports them. 2) Debugging / test case reduction. A single-source testcase is much more amenable to reduction, compared to a VFS tarball or .pcm files. llvm-svn: 305101
* Retain header search and preprocessing options from AST file when emittingRichard Smith2017-06-061-0/+8
| | | | | | preprocessed text for an AST file. llvm-svn: 304756
* Fix crash when an 'import a module' TypoCorrection has its CorrectionDeclsRichard Smith2017-06-053-0/+14
| | | | | | | | | | | | replaced by visible decls. Make sure that all paths through checkCorrectionVisibility set the RequiresImport flag appropriately, so we don't end up using a stale value. Patch by Jorge Gorbe! Differential Revision: https://reviews.llvm.org/D30963 llvm-svn: 304745
* Factor out and unify emission of "module is unavailable" diagnostics.Richard Smith2017-06-054-15/+25
| | | | | | Inspired by post-commit review of r304190. llvm-svn: 304728
* Attempt to fix Windows buildbot failure due to mismatching directory ↵Richard Smith2017-06-051-2/+11
| | | | | | separators in preprocessed output. llvm-svn: 304727
* Rather than rejecting attempts to run preprocessor-only actions on AST files,Richard Smith2017-06-051-1/+6
| | | | | | | | | | replay the steps taken to create the AST file with the preprocessor-only action installed to produce preprocessed output. This can be used to produce the preprocessed text for an existing .pch or .pcm file. llvm-svn: 304726
* Revert r304592Richard Trieu2017-06-031-18/+0
| | | | | | | r304592 - [ODRHash] Add support for TemplateArgument types. Possibly causing one of the errors in modules build bot. llvm-svn: 304618
* [ODRHash] Add support for TemplateArgument types.Richard Trieu2017-06-021-0/+18
| | | | llvm-svn: 304592
* ASTPrinter: Objective-C method declarations don't need a space afterAlex Lorenz2017-06-021-2/+2
| | | | | | | | the return type rdar://32332039 llvm-svn: 304553
* Support lazy stat'ing of files referenced by module maps.Richard Smith2017-06-029-3/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for a `header` declaration in a module map to specify certain `stat` information (currently, size and mtime) about that header file. This has two purposes: - It removes the need to eagerly `stat` every file referenced by a module map. Instead, we track a list of unresolved header files with each size / mtime (actually, for simplicity, we track submodules with such headers), and when attempting to look up a header file based on a `FileEntry`, we check if there are any unresolved header directives with that `FileEntry`'s size / mtime and perform deferred `stat`s if so. - It permits a preprocessed module to be compiled without the original files being present on disk. The only reason we used to need those files was to get the `stat` information in order to do header -> module lookups when using the module. If we're provided with the `stat` information in the preprocessed module, we can avoid requiring the files to exist. Unlike most `header` directives, if a `header` directive with `stat` information has no corresponding on-disk file the enclosing module is *not* marked unavailable (so that behavior is consistent regardless of whether we've resolved a header directive, and so that preprocessed modules don't get marked unavailable). We could actually do this for all `header` directives: the only reason we mark the module unavailable if headers are missing is to give a diagnostic slightly earlier (rather than waiting until we actually try to build the module / load and validate its .pcm file). Differential Revision: https://reviews.llvm.org/D33703 llvm-svn: 304515
* [Modules] Handle sanitizer feature mismatches when importing modulesVedant Kumar2017-06-013-0/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes it an error to have a mismatch between the enabled sanitizers in a CU, and in any module being imported into the CU. Only mismatches between non-modular sanitizers are treated as errors. This patch also includes non-modular sanitizers in module hashes, in order to ensure module rebuilds occur when -fsanitize=X is toggled on and off for non-modular sanitizers, and to cut down on module rebuilds when the option is toggled for modular sanitizers. This fixes a longstanding issue with implicit modules and sanitizers, which Duncan originally diagnosed. When building with implicit modules it's possible to hit a scenario where modules are built without -fsanitize=address, and are subsequently imported into CUs with -fsanitize=address enabled. This causes strange failures at runtime. The case Duncan found affects libcxx, since its vector implementation behaves differently when ASan is enabled. Implicit module builds should "just work" when -fsanitize=X is toggled on and off across multiple compiler invocations, which is what this patch does. Differential Revision: https://reviews.llvm.org/D32724 llvm-svn: 304463
OpenPOWER on IntegriCloud