summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
Commit message (Collapse)AuthorAgeFilesLines
...
* Verify all the module map files for a pcm are the same on loadBen Langmuir2014-08-124-0/+32
| | | | | | | | | | We already verified the primary module map file (either the one that defines the top-level module, or the one that allows inferring it if it is an inferred framework module). Now we also verify any other module map files that define submodules, such as when there is a module.private.modulemap file. llvm-svn: 215455
* Modify behavior of -ast-dump-lookups: if -ast-dump is not also provided, dumpRichard Smith2014-08-111-2/+2
| | | | | | | | anyway. If -ast-dump *is* also provided, then dump the AST declarations as well as the lookup results. This is invaluable for cross-correlating the lookup information with the declarations actually found. llvm-svn: 215393
* [modules] When considering merging a newly-declared typedef into an importedRichard Smith2014-08-106-0/+41
| | | | | | | | | one, perform the import if the types match even if the imported declaration is hidden. Otherwise, NamedDecl::declarationReplaces will drop one of the name lookup entries, making the typedef effectively inaccessible from one of the modules that declared it. llvm-svn: 215306
* [modules] Weaken an out-of-date assertion: an #undef can have no location if weRichard Smith2014-08-095-0/+15
| | | | | | | imported it from a module when performing finalization before writing out an AST file. llvm-svn: 215272
* [modules] When emitting an update record containing the body of a destructor,Richard Smith2014-08-073-0/+21
| | | | | | | | | also emit the updated 'operator delete' looked up for that destructor. Switch from UpdateDecl to an actual update record when this happens due to implicitly defining a special member function and unify this code path and the one for instantiating a function definition. llvm-svn: 215132
* test/Modules: Use FileCheck's -allow-empty instead of "count 0"Justin Bogner2014-08-071-2/+5
| | | | | | | | | | Piping stderr into "count 0" in tests doesn't work - things like guard malloc write to stderr and mess up the count. This comes up all the time, so I've added a feature to FileCheck to fix it this time. Fixes test failures caused by r215046 under guard malloc. llvm-svn: 215129
* Use -Rblah, not -Wblah, to control remark diagnostics. This was always theRichard Smith2014-08-073-7/+19
| | | | | | | | | | | | | | | | | | | | | | intent when we added remark support, but was never implemented in the general case, because the first -R flags didn't need it. (-Rpass= had special handling to accomodate its argument.) -Rno-foo, -Reverything, and -Rno-everything can be used to turn off a remark, or to turn on or off all remarks. Per discussion on cfe-commits, -Weverything does not affect remarks, and -Reverything does not affect warnings or errors. The only "real" -R flag we have right now is -Rmodule-build; that flag is effectively renamed from -Wmodule-build to -Rmodule-build by this change. -Wpass and -Wno-pass (and their friends) are also renamed to -Rpass and -Rno-pass by this change; it's not completely clear whether we intended to have a -Rpass (with no =pattern), but that is unchanged by this commit, other than the flag name. The default pattern is effectively one which matches no passes. In future, we may want to make the default pattern be .*, so that -Reverything works for -Rpass properly. llvm-svn: 215046
* [modules] Remove IRGen special case for emitting implicit special members ifRichard Smith2014-08-011-1/+1
| | | | | | | | | | | they're somehow missing a body. Looks like this was left behind when the loop was generalized, and it's not been problematic before because without modules, a used, implicit special member function declaration must be a definition. This was resulting in us trying to emit a constructor declaration rather than a definition, and producing a constructor missing its member initializers. llvm-svn: 214473
* [modules] Maintain an AST invariant across module load/save: if any declarationRichard Smith2014-07-314-1/+66
| | | | | | | | | | | | | | | of a function has a resolved exception specification, then all declarations of the function do. We should probably improve the AST representation to make this implicit (perhaps only store the exception specification on the canonical declaration), but this fixes things for now. The testcase for this (which used to assert) also exposes the actual bug I was trying to reduce here: we sometimes fail to emit the body of an imported special member function definition. Fix for that to follow. llvm-svn: 214458
* [modules] Add testcase for a bug reduced from a selfhost issue. This bug wasRichard Smith2014-07-293-0/+9
| | | | | | | never present in Clang trunk, but was present in some of my development work, and it seems like a useful test to have. llvm-svn: 214154
* Revert accidentally-committed files in r214151.Richard Smith2014-07-293-9/+0
| | | | llvm-svn: 214152
* [modules] Add missing #include, found by modules build. We need a classRichard Smith2014-07-293-0/+9
| | | | | | definition in order to apply isa<...>. llvm-svn: 214151
* [modules] PR20475: merging support for alias template declarations.Richard Smith2014-07-282-0/+4
| | | | llvm-svn: 214124
* [modules] Substantially improve handling of #undef:Richard Smith2014-07-257-4/+41
| | | | | | | | | | * Track override set across module load and save * Track originating module to allow proper re-export of #undef * Make override set properly transitive when it picks up a #undef This fixes nearly all of the remaining macro issues with self-host. llvm-svn: 213922
* Add stopgap option -fmodule-implementation-of <name>Ben Langmuir2014-07-231-0/+29
| | | | | | | | | | | | | | | | | | This flag specifies that we are building an implementation file of the module <name>, preventing importing <name> as a module. This does not consider this to be the 'current module' for the purposes of doing modular checks like decluse or non-modular-include warnings, unlike -fmodule-name. This is needed as a stopgap until: 1) we can resolve relative includes to a VFS-mapped module (or can safely import a header textually and as part of a module) and ideally 2) we can safely do incremental rebuilding when implementation files import submodules. llvm-svn: 213767
* [modules] Fix some of the confusion when computing the override set for a macroRichard Smith2014-07-2113-1/+54
| | | | | | | introduced by finalization. This is still not entirely correct; more fixes to follow. llvm-svn: 213498
* Reinstate r213348, reverted in r213395, with an additional bug fix and moreRichard Smith2014-07-188-0/+115
| | | | | | | | | | | | | | | | | | | | thorough tests. Original commit message: [modules] Fix macro hiding bug exposed if: * A submodule of module A is imported into module B * Another submodule of module A that is not imported into B exports a macro * Some submodule of module B also exports a definition of the macro, and happens to be the first submodule of B that imports module A. In this case, we would incorrectly determine that A's macro redefines B's macro, and so we don't need to re-export B's macro at all. This happens with the 'assert' macro in an LLVM self-host. =( llvm-svn: 213416
* Revert "[modules] Fix macro hiding bug exposed if:"Ben Langmuir2014-07-187-22/+0
| | | | | | | | | | This is breaking the system modules on Darwin, because something that was defined and re-exported no longer is. Might be this patch, or might just be a really poor interaction with an existing visibility bug. This reverts commit r213348. llvm-svn: 213395
* Mark C++ reference parameters as dereferenceableHal Finkel2014-07-181-2/+2
| | | | | | | | | | | | | | Because references must be initialized using some evaluated expression, they must point to something, and a callee can assume the reference parameter is dereferenceable. Taking advantage of a new attribute just added to LLVM, mark them as such. Because dereferenceability in addrspace(0) implies nonnull in the backend, we don't need both attributes. However, we need to know the size of the object to use the dereferenceable attribute, so for incomplete types we still emit only nonnull. llvm-svn: 213386
* [modules] Fix macro hiding bug exposed if:Richard Smith2014-07-187-0/+22
| | | | | | | | | | | | | | * A submodule of module A is imported into module B * Another submodule of module A that is not imported into B exports a macro * Some submodule of module B also exports a definition of the macro, and happens to be the first submodule of B that imports module A. In this case, we would incorrectly determine that A's macro redefines B's macro, and so we don't need to re-export B's macro at all. This happens with the 'assert' macro in an LLVM self-host. =( llvm-svn: 213348
* Try harder to supress the test from r212975 on WindowsBen Langmuir2014-07-141-2/+2
| | | | | | | | The attempt in r212980 was broken because we might not fail if LLVM_ON_UNIX is enabled for cross compiling to Windows, and it didn't consider mingw either. llvm-svn: 212989
* XFAIL test that doesn't work on Windows yetBen Langmuir2014-07-141-0/+2
| | | | llvm-svn: 212980
* Fix case-sensitivity of inferred framework modulesBen Langmuir2014-07-141-0/+5
| | | | | | | Just because we can open a directory named "COcoa.framework" doesn't mean we should provide a "COcoa" module on a case-insensitive filesystem. llvm-svn: 212975
* [modules] When merging a class template, also merge the definition of its ↵Richard Smith2014-07-113-0/+15
| | | | | | pattern. llvm-svn: 212836
* [modules] Don't try to merge template specializations by performing name lookupRichard Smith2014-07-114-2/+13
| | | | | | | | | into their container; we won't find them there. These things are already being merged when they're added to their primary template's folding set, so this merging is redundant (and causes us to reject-valid because we think we've found an odr violation). llvm-svn: 212788
* Remove REQUIRES lines from portable testsAlp Toker2014-06-251-1/+0
| | | | | | These tests are target-independent and shouldn't ever be suppressed. llvm-svn: 211738
* Disable Modules/dependency-dump-dependent-module.m on win32 for now.NAKAMURA Takumi2014-06-201-0/+6
| | | | | | | | FIXME: This fails on win32 due to ERROR_FILENAME_EXCED_RANGE if the working directory is too deep. We should make Win32/Path.inc capable of long pathnames with '\\?\'. llvm-svn: 211363
* test: Just check the VFS when testing module-dependency-dumpJustin Bogner2014-06-192-21/+0
| | | | | | | Checking the filesystem seems to be a bit unreliable. Limit the tests to the VFS map for now. llvm-svn: 211310
* Frontend: Add a CC1 flag to dump module dependencies to a directoryJustin Bogner2014-06-192-0/+52
| | | | | | | | | | | | | | | | | | This adds the -module-dependency-dir to clang -cc1, which specifies a directory to copy all of a module's dependencies into in a form suitable to be used as a VFS using -ivfsoverlay with the generated vfs.yaml. This is useful for crashdumps that involve modules, so that the module dependencies will be intact when a crash report script is used to reproduce a problem on another machine. We currently encode the absolute path to the dump directory, due to limitations in the VFS system. Until we can handle relative paths in the VFS, users of the VFS map may need to run a simple search and replace in the file. llvm-svn: 211303
* Improve robustness of tests for module flags metadataOliver Stannard2014-06-191-2/+2
| | | | | | | Fix clang tests to not break if the ID numbers of module flags metadata nodes change. llvm-svn: 211276
* [modules] When we merge redecl chains or mark a decl used with an updateRichard Smith2014-06-164-0/+16
| | | | | | | record, mark all subsequent decls as 'used' too, to maintain the AST invariant that getPreviousDecl()->Used implies this->Used. llvm-svn: 211050
* allow optional signext attributeWill Schmidt2014-06-021-1/+1
| | | | | | | Allow the tests to succeed with tne signext (or other) attribute is present. The attributes show up for Power, but not for x86*, so need to be appropriately wildcarded. llvm-svn: 210050
* When merging functions across modules (and in particular, instantiations ofRichard Smith2014-05-294-0/+31
| | | | | | | member functions), ensure that the redecl chain never transitions from 'inline' to 'not inline', since that violates an AST invariant. llvm-svn: 209794
* Add 'nonnull' parameter or return attribute when producing an llvm pointer ↵Nick Lewycky2014-05-281-2/+2
| | | | | | type in a function type where the C++ type is a reference. Update the tests. llvm-svn: 209723
* Add a test that we don't store stale modtime in modulesBen Langmuir2014-05-271-0/+37
| | | | | | | | | | | The change from r209195 turned out to be important to avoid saving stale modification time/expected size information in a module file when there are 3 or more modules in a dependency chain and the bottom one is rebuilt. So add a test for that. rdar://problem/17038180 llvm-svn: 209682
* [modules] If a referenced-but-not-instantiated class template specializationRichard Smith2014-05-233-0/+11
| | | | | | | | | | gets explicitly specialized, don't reuse the previous class template specialization declaration as a new declaration. The benefit here is fairly marginal, it harms source fidelity, and this is horrible to model if the specialization was imported from another module (without this change, it asserts or worse). llvm-svn: 209552
* If a class template specialization from one module has its definitionRichard Smith2014-05-223-0/+11
| | | | | | | | | instantiated in another module, and the instantiation uses a partial specialization, include the partial specialization and its template arguments in the update record. We'll need them if someone imports the second module and tries to instantiate a member of the template. llvm-svn: 209472
* If two sibling modules declare the same entity, and we indirectly pull aRichard Smith2014-05-194-3/+46
| | | | | | | | declaration of that entity in from one of those modules, keep track of the fact that we've not completed the redeclaration chain yet so that we can pull the remaining declarations in from the other module if they're needed. llvm-svn: 209161
* Fix use-after-free and spurious error during module loadBen Langmuir2014-05-191-0/+25
| | | | | | | | | | | | | | FileManager::invalidateCache is not safe to call when there may be existing references to the file. What module load failure needs is to refresh so stale stat() info isn't stored. This may be the last user of invalidateCache; I'll take a look and remove it if possible in a future commit. This caused a use-after-free error as well as a spurious error message that a module was "found in both 'X.pcm' and 'X.pcm'" in some cases. llvm-svn: 209138
* Add missed file from r209046.Richard Smith2014-05-161-0/+5
| | | | llvm-svn: 209047
* If a declaration is loaded, and then a module import adds a redeclaration, thenRichard Smith2014-05-164-13/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ensure that querying the first declaration for its most recent declaration checks for redeclarations from the imported module. This works as follows: * The 'most recent' pointer on a canonical declaration grows a pointer to the external AST source and a generation number (space- and time-optimized for the case where there is no external source). * Each time the 'most recent' pointer is queried, if it has an external source, we check whether it's up to date, and update it if not. * The ancillary data stored on the canonical declaration is allocated lazily to avoid filling it in for declarations that end up being non-canonical. We'll still perform a redundant (ASTContext) allocation if someone asks for the most recent declaration from a decl before setPreviousDecl is called, but such cases are probably all bugs, and are now easy to find. Some finessing is still in order here -- in particular, we use a very general mechanism for handling the DefinitionData pointer on CXXRecordData, and a more targeted approach would be more compact. Also, the MayHaveOutOfDateDef mechanism should now be expunged, since it was addressing only a corner of the full problem space here. That's not covered by this patch. Early performance benchmarks show that this makes no measurable difference to Clang performance without modules enabled (and fixes a major correctness issue with modules enabled). I'll revert if a full performance comparison shows any problems. llvm-svn: 209046
* Push implicitly-declared allocation functions into the IdResolver. Otherwise,Richard Smith2014-05-162-0/+6
| | | | | | | declaration merging in modules is unable to find them and we get bogus errors and even crashes. llvm-svn: 208944
* Switch Wmodule-build to a remarkBen Langmuir2014-05-081-2/+2
| | | | | | | | | On reflection, this is better despite the missing command-line handling bits for remarks. Making this a remark makes it much clearer that this is purely informational and avoids the negative connotations of a 'warning'. llvm-svn: 208367
* Remove -Wnon-modular-includeBen Langmuir2014-05-081-12/+0
| | | | | | | | | | But keep -Wnon-modular-include-in-[framework-]module This warning is too noisy and doesn't really indicate a problem for most people. Even though it would only really affect people using -Weverything, that seems bad so remove it. llvm-svn: 208345
* If an instantiation of a template is required to be a complete type, checkRichard Smith2014-05-074-26/+31
| | | | | | | whether the definition of the template is visible rather than checking whether the instantiated definition happens to be in an imported module. llvm-svn: 208150
* Add -Wnon-modular-include* optionsBen Langmuir2014-05-0529-0/+155
| | | | | | | | | | | | Warn on non-modular includes in various contexts. -Wnon-modular-include -Wnon-modular-include-in-module -Wnon-modular-include-in-framework-module Where each group is a subgroup of those above it. llvm-svn: 208004
* Add -Wmodule-build to make it easy to see when modules are (re)builtBen Langmuir2014-05-051-0/+22
| | | | | | Warning is default ignore, and not in -Wall. llvm-svn: 207975
* Make module self-import an errorBen Langmuir2014-05-052-6/+11
| | | | | | | | Ideally, importing Foo.a from Foo.b would "do the right thing", but until it does, this patch makes it an error rather than allow it to silently be ignored. llvm-svn: 207948
* Defer loading any pending update records until we've finished deserializing.Richard Smith2014-04-303-0/+9
| | | | | | | This fixes a bug where an update record causes us to load an entity that refers to an entity we've not finished loading yet, resulting in badness. llvm-svn: 207603
* [PCH/Modules] Don't tie TargetOptions::LinkerVersion to a module/PCH, it's a ↵Argyrios Kyrtzidis2014-04-291-1/+0
| | | | | | | | driver only thing and doesn't affect any language/preprocessor/etc. semantics. rdar://16714526 llvm-svn: 207570
OpenPOWER on IntegriCloud