aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Modules
AgeCommit message (Collapse)AuthorFilesLines
2017-07-06Reject attempts to build a module without -fmodules, rather than silently ↵Richard Smith3-11/+16
doing weird things. llvm-svn: 307316
2017-07-01[ODRHash] Revert r305104 - Skip inline namespaces when hashing.Richard Trieu1-0/+18
Test inline namespaces and handle them in the ODR hash again. llvm-svn: 306926
2017-07-01[Modules] Implement ODR-like semantics for tag types in C/ObjCBruno Cardoso Lopes7-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
2017-06-30[ODRHash] Support Type TemplateArgumentRichard Trieu1-0/+34
llvm-svn: 306904
2017-06-29[ODRHash] Improve typedef handling.Richard Trieu1-0/+16
Follow typedef chains to find the root type when processing types, and also keep track of qualifiers. llvm-svn: 306753
2017-06-29[ASTReader] Add test for previous change r306583 / 145692e.Graydon Hoare5-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
2017-06-29Track the set of module maps read while building a .pcm file and reload ↵Richard Smith6-0/+23
those when preprocessing from that .pcm file. llvm-svn: 306628
2017-06-27Fix this test to use a construct that actually forces struct layout to ↵Richard Smith1-1/+1
happen when testing -Wpadded. llvm-svn: 306349
2017-06-26When preprocessing with -frewrite-imports and -fmodule-file=, do not pass allRichard Smith5-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
2017-06-26Testcase missed from r306075.Richard Smith1-0/+29
llvm-svn: 306270
2017-06-22PR33002: When we instantiate the definition of a static data member, we mightRichard Smith1-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
2017-06-19Support non-identifier module names when preprocessing modules.Richard Smith1-0/+4
llvm-svn: 305758
2017-06-16[ODRHash] Hash VarDecl members.Richard Trieu1-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
2017-06-15[ODRHash] Hash TemplateArgument::Pack and TemplateTypeParmTypeRichard Trieu1-0/+41
llvm-svn: 305440
2017-06-14[ODRHash] Hash Template and TemplateExpansion in TemplateArgument.Richard Trieu1-0/+18
llvm-svn: 305361
2017-06-14[ODRHash] Hash Expr for TemplateArgument::ExpressionRichard Trieu1-0/+33
llvm-svn: 305360
2017-06-13[ODRHash] Add TemplateArgument kind to hash.Richard Trieu1-0/+18
llvm-svn: 305328
2017-06-12[ODRHash] Add diagnostic messages for typedef and type alias.Richard Trieu1-0/+102
llvm-svn: 305238
2017-06-12IR: Replace the "Linker Options" module flag with "llvm.linker.options" ↵Peter Collingbourne3-10/+5
named metadata. The new metadata is easier to manipulate than module flags. Differential Revision: https://reviews.llvm.org/D31349 llvm-svn: 305227
2017-06-09Revert r305110 to fix buildbotRichard Trieu1-18/+0
llvm-svn: 305130
2017-06-09Add -frewrite-imports flag.Richard Smith1-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
2017-06-09[ODRHash] Add support for TemplateArgument types.Richard Trieu1-0/+18
Recommit r304592 that was reverted in r304618. r305104 should have fixed the issue. llvm-svn: 305110
2017-06-09Add #pragma clang module build/endbuild pragmas for performing a module buildRichard Smith1-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
2017-06-06Retain header search and preprocessing options from AST file when emittingRichard Smith1-0/+8
preprocessed text for an AST file. llvm-svn: 304756
2017-06-05Fix crash when an 'import a module' TypoCorrection has its CorrectionDeclsRichard Smith3-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
2017-06-05Factor out and unify emission of "module is unavailable" diagnostics.Richard Smith4-15/+25
Inspired by post-commit review of r304190. llvm-svn: 304728
2017-06-05Attempt to fix Windows buildbot failure due to mismatching directory ↵Richard Smith1-2/+11
separators in preprocessed output. llvm-svn: 304727
2017-06-05Rather than rejecting attempts to run preprocessor-only actions on AST files,Richard Smith1-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
2017-06-03Revert r304592Richard Trieu1-18/+0
r304592 - [ODRHash] Add support for TemplateArgument types. Possibly causing one of the errors in modules build bot. llvm-svn: 304618
2017-06-02[ODRHash] Add support for TemplateArgument types.Richard Trieu1-0/+18
llvm-svn: 304592
2017-06-02ASTPrinter: Objective-C method declarations don't need a space afterAlex Lorenz1-2/+2
the return type rdar://32332039 llvm-svn: 304553
2017-06-02Support lazy stat'ing of files referenced by module maps.Richard Smith9-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
2017-06-01[Modules] Handle sanitizer feature mismatches when importing modulesVedant Kumar3-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
2017-05-31[modules] When compiling a preprocessed module map, look for headers relativeRichard Smith2-5/+7
to the original module map. Also use the path and name of the original module map when emitting that information into the .pcm file. The upshot of this is that the produced .pcm file will track information for headers in their original locations (where the module was preprocessed), not relative to whatever directory the preprocessed module map was in when it was built. llvm-svn: 304346
2017-05-31[ODRHash] Support TemplateSpecializationTypeRichard Trieu1-0/+34
llvm-svn: 304261
2017-05-30Add an explicit -std= to test to unbreak on PS4 targets.Richard Smith1-1/+1
llvm-svn: 304237
2017-05-30Diagnose attempts to build a preprocessed module that defines an unavailable ↵Richard Smith1-0/+12
submodule. The errors we would otherwise get are incomprehensible, as we would enter the module but not make its contents visible to itself. llvm-svn: 304190
2017-05-30[modules] When we #include a local submodule header that we've already built,Richard Smith5-0/+72
and it has an include guard, produce callbacks for a module import, not for a skipped non-modular header. Fixes -E output when preprocessing a module to list these cases as a module import, rather than suppressing the #include and losing the import side effect. llvm-svn: 304183
2017-05-28[coroutines] Support "coroutines" feature in module map requires clauseEric Fiselier4-1/+26
Summary: In order for libc++ to add `<experimental/coroutine>` to its module map, there has to be a feature that can be used to detect if coroutines support is enabled in Clang. Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33538 llvm-svn: 304107
2017-05-27Revert "[coroutines] Support "coroutines" feature in module map requires clause"Eric Fiselier4-26/+1
This reverts commit r304054. llvm-svn: 304057
2017-05-27[coroutines] Support "coroutines" feature in module map requires clauseEric Fiselier4-1/+26
Summary: In order for libc++ to add `<experimental/coroutine>` to its module map, there has to be a feature that can be used to detect if coroutines support is enabled in Clang. Reviewers: rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33538 llvm-svn: 304054
2017-05-23[Modules] Fix overly conservative assertion for import diagnosticBruno Cardoso Lopes3-0/+25
We currenltly assert when want to diagnose a missing import and the decl in question is already visible. It turns out that the decl in question might be visible because another decl from the same module actually made the module visible in a previous error diagnostic. Remove the assertion and avoid re-exporting the module if it's already visible. rdar://problem/27975402 Differential Revision: https://reviews.llvm.org/D32828 llvm-svn: 303705
2017-05-19[modules] Simplify module macro handling in non-local-submodule-visibility mode.Richard Smith1-0/+27
When reaching the end of a module, we used to convert its macros to ModuleMacros but also leave them in the MacroDirective chain for the identifier. This meant that every lookup of such a macro would find two (identical) definitions. It also made it difficult to determine the correct owner for a macro when reaching the end of a module: the most recent MacroDirective in the chain could be from an #included submodule rather than the current module. Simplify this: whenever we convert a MacroDirective to a ModuleMacro when leaving a module, clear out the MacroDirective chain for that identifier, and just rely on the ModuleMacro to provide the macro definition information. (We don't want to do this for local submodule visibility mode, because in that mode we maintain a distinct MacroDirective chain for each submodule, and we need to keep around the prior MacroDirective in case we re-enter the submodule -- for instance, if its header is #included more than once in a module build, we need the include guard directive to stick around. But the problem doesn't arise in this case for the same reason: each submodule has its own MacroDirective chain, so the macros don't leak out of submodules in the first place.) This reinstates r302932, reverted in r302947, with a fix for a bug that resulted in us sometimes losing macro definitions due to failing to clear out the overridden module macro list when promoting a directive to a module macro. llvm-svn: 303468
2017-05-19[ODRHash] Revert r303450 to fix buildbotRichard Trieu1-102/+0
r303450 [ODRHash] Support TemplateName and TemplateArgument llvm-svn: 303459
2017-05-19[ODRHash] Support TemplateName and TemplateArgumentRichard Trieu1-0/+102
llvm-svn: 303450
2017-05-18When we enter a module within a linkage specification, switch the linkageRichard Smith1-0/+25
specification and the TU to the new module. This is necessary to get the module ownership correct for entities that we temporarily hang off the TranslationUnitDecl, such as template parameters and function parameters. llvm-svn: 303373
2017-05-18[modules] Switch from inferring owning modules based on source location toRichard Smith1-6/+8
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. llvm-svn: 303322
2017-05-17[Lexer] Ensure that the token is not an annotation token whenAlex Lorenz3-0/+14
retrieving the identifer info for an Objective-C keyword This commit fixes an assertion that's triggered in getIdentifier when the token is an annotation token. rdar://32225463 llvm-svn: 303246
2017-05-17[ODRHash] Support NestedNameSpecifierRichard Trieu1-0/+159
llvm-svn: 303233
2017-05-17[ODRHash] Support more types in the ODR checker.Richard Trieu1-0/+72
Added support for TagType, TypeWithKeyword, and all children types. llvm-svn: 303231