- Dec 13, 2013
-
-
Manuel Klimek authored
Needed to change rename.m to set the right include path so we don't import a broken module due to recursive module checking. llvm-svn: 197222
-
- Dec 11, 2013
-
-
Daniel Jasper authored
llvm-svn: 197035
-
Daniel Jasper authored
Specifically, we want to warn only for direct layering violations for the modules we are calling clang on. This temporarily unblocks http://llvm-reviews.chandlerc.com/D2374 Once that is in, we'll also want to investigate whether to check the layering in the build step of modules that we build transitively. llvm-svn: 197021
-
- Dec 06, 2013
-
-
Daniel Jasper authored
In order to make the migration to modules easier, it seems to be helpful to allow a 1:1 mapping between target names of a current build system and the corresponding C++ modules. As such targets commonly contain characters like "-". ":" and "/", allowing arbitrary quote-escaped strings seems to be a straightforward option. After several offline discussions, the precise mechanisms for C++ module names especially regarding submodules and import statements has yet to be determined. Thus, this patch only enables string literals as names inside the module map files which can be used by automatic module import (through #include). Also improve the error message on missing use-declarations. llvm-svn: 196573
-
- Dec 03, 2013
-
-
Daniel Jasper authored
Before, there SourceManager would not return a FileEntry for a SourceLocation of a macro expansion (if the header name itself is defined in a macro). We'd then fallback to assume that the module currently being built is the including module. However, in this case we are actually interested in the spelling location of the filename loc in order to derive the including module. llvm-svn: 196311
-
- Nov 23, 2013
-
-
Richard Smith authored
llvm-svn: 195545
-
Richard Smith authored
module. Use the marker to diagnose cases where we try to transition between submodules when not at the top level (most likely because a closing brace was missing at the end of a header file, but is also possible if submodule headers attempt to do something fundamentally non-modular, like our .def files). llvm-svn: 195543
-
- Nov 04, 2013
-
-
Dmitri Gribenko authored
This change fixes Richard's testcase for r193815. Now we include non-explicit submodules into the list of exports. The test failed previously because: - recursive_visibility_a1.inner is not imported (only recursive_visibility_a1 is), - thus the 'inner' submodule is not showing up in any of the import lists, - and because of this getExportedModules() is not returning the correct module set -- it only considers modules that are imported. The fix is to make Module::getExportedModules() include non-explicit submodules into the list of exports. llvm-svn: 194018
-
- Oct 28, 2013
-
-
Richard Smith authored
requires ! feature The purpose of this is to allow (for instance) the module map for /usr/include to exclude <tgmath.h> and <complex.h> when building in C++ (these headers are instead provided by the C++ standard library in this case, and the glibc C <tgmath.h> header would otherwise try to include <complex.h>, resulting in a module cycle). llvm-svn: 193549
-
- Oct 24, 2013
-
-
Manuel Klimek authored
This allows using virtual file mappings on the original SourceManager to map in virtual module.map files. Without this patch, the ModuleMap search will find a module.map file (as the FileEntry exists in the FileManager), but will be unable to get the content from the SourceManager (as ModuleMap previously created its own SourceManager). Two problems needed to be fixed which this patch exposed: 1. Storing the inferred module map When writing out a module, the ASTWriter stores the names of the files in the main source manager; when loading the AST again, the ASTReader errs out if such a file is found missing, unless it is overridden. Previously CompilerInstance's compileModule method would store the inferred module map to a temporary file; the problem with this approach is that now that the module map is handled by the main source manager, the ASTWriter stores the name of the temporary module map as source to the compilation; later, when the module is loaded, the temporary file has already been deleted, which leads to a compilation error. This patch changes the inferred module map to instead inject a virtual file into the source manager. This both saves some disk IO, and works with how the ASTWriter/ASTReader handle overridden source files. 2. Changing test input in test/Modules/Inputs/* Now that the module map file is handled by the main source manager, the VerifyDiagnosticConsumer will not ignore diagnostics created while parsing the module map file. The module test test/Modules/renamed.m uses -I test/Modules/Inputs and triggers recursive loading of all module maps in test/Modules/Inputs, some of which had conflicting names, thus leading errors while parsing the module maps. Those diagnostics already occur on trunk, but before this patch they would not break the test, as they were ignored by the VerifyDiagnosticConsumer. This patch thus changes the module maps that have been recently introduced which broke the invariant of compatible modules maps in test/Modules/Inputs. llvm-svn: 193314
-
- Oct 23, 2013
-
-
Richard Smith authored
modules. With this fixed, I no longer see any test regressions in the libc++ test suite when enabling a single-module module.map for libc++ (other than issues with my system headers). llvm-svn: 193219
-
- Oct 22, 2013
-
-
Daniel Jasper authored
This patch changes two things: a) Allow a header to be part of multiple modules. The reasoning is that in existing codebases that have a module-like build system, the same headers might be used in several build targets. Simple reasons might be that they defined different classes that are declared in the same header. Supporting a header as a part of multiple modules will make the transistion easier for those cases. A later step in clang can then determine whether the two modules are actually compatible and can be merged and error out appropriately. The later check is similar to what needs to be done for template specializations anyway. b) Allow modules to be stored in a directory tree separate from the headers they describe. Review: http://llvm-reviews.chandlerc.com/D1951 llvm-svn: 193151
-
- Oct 19, 2013
-
-
Richard Smith authored
test also adds FIXMEs for a number of places where imports and includes of submodules don't work very well. llvm-svn: 193005
-
- Oct 18, 2013
-
-
Richard Smith authored
llvm-svn: 192951
-
Richard Smith authored
If we have multiple definitions of the same entity from different modules, we nominate the first definition which we see as being the canonical definition. If we load a declaration from a different definition and we can't find a corresponding declaration in the canonical definition, issue a diagnostic. This is insufficient to prevent things from going horribly wrong in all cases -- we might be in the middle of emitting IR for a function when we trigger some deserialization and discover that it refers to an incoherent piece of the AST, by which point it's probably too late to bail out -- but we'll at least produce a diagnostic. llvm-svn: 192950
-
- Oct 16, 2013
-
-
Richard Smith authored
merged declarations of a class template. llvm-svn: 192746
-
Richard Smith authored
(eg through template instantiations in multiple modules). llvm-svn: 192740
-
- Oct 14, 2013
-
-
Richard Smith authored
llvm-svn: 192560
-
- Oct 07, 2013
-
-
Richard Smith authored
This change doesn't go all the way to making fields redeclarable; instead, it makes them 'mergeable', which means we can find the canonical declaration, but not much else (and for a declaration that's not from a module, the canonical declaration is always that declaration). llvm-svn: 192092
-
- Sep 24, 2013
-
-
Daniel Jasper authored
With this option, arbitrarily named module map files can be specified to be loaded as required for headers in the respective (sub)directories. This, together with the extern module declaration allows for specifying module maps in a modular fashion without the need for files called "module.map". Among other things, this allows a directory to contain two modules that are completely independent of one another. Review: http://llvm-reviews.chandlerc.com/D1697. llvm-svn: 191284
-
Daniel Jasper authored
Review: http://llvm-reviews.chandlerc.com/D1546. I have picked up this patch form Lawrence (http://llvm-reviews.chandlerc.com/D1063) and did a few changes. From the original change description (updated as appropriate): This patch adds a check that ensures that modules only use modules they have so declared. To this end, it adds a statement on intended module use to the module.map grammar: use module-id A module can then only use headers from other modules if it 'uses' them. This enforcement is off by default, but may be turned on with the new option -fmodules-decluse. When enforcing the module semantics, we also need to consider a source file part of a module. This is achieved with a compiler option -fmodule-name=<module-id>. The compiler at present only applies restrictions to the module directly being built. llvm-svn: 191283
-
- Sep 11, 2013
-
-
Daniel Jasper authored
This patch is the first step to make module-map-files modular (instead of requiring a single "module.map"-file per include directory). This step adds a new "extern module" declaration that enables module-map-files to reference one another along with a very basic implementation. The next steps are: * Combine this with the use-declaration (from http://llvm-reviews.chandlerc.com/D1546) in order to only load module map files required for a specific compilation. * Add an additional flag to start with a specific module-map-file (instead of requiring there to be at least one "module.map"). Review: http://llvm-reviews.chandlerc.com/D1637 llvm-svn: 190497
-
- Sep 09, 2013
-
-
Richard Smith authored
it is an implicit instantiation of a class template specialization), pick the first-loaded definition to be the canonical definition, and merge all other definitions into it. This is still rather incomplete -- we need to extend every form of declaration that can appear within a CXXRecordDecl to be redeclarable if it came from an AST file (this includes fields, enumerators, ...). llvm-svn: 190315
-
Richard Smith authored
name lookup from lazily deserializing the other declarations with the same name, by tracking a bit to indicate whether a name in a DeclContext might have additional external results. This also allows lazier reconciling of the lookup table if a module import adds decls to a pre-existing DC. However, this exposes a pre-existing bug, which causes a regression in test/Modules/decldef.mm: if we have a reference to a declaration, and a later-imported module adds a redeclaration, nothing causes us to load that redeclaration when we use or emit the reference (which can manifest as a reference to an undefined inline function, a use of an incomplete type, and so on). decldef.mm has been extended with an additional testcase which fails with or without this change. llvm-svn: 190293
-
- Sep 05, 2013
-
-
Eli Friedman authored
When an AST file is built based on another AST file, it can use a decl from the fist file, and therefore mark the "isUsed" bit. We need to note this in the AST file so that the bit is set correctly when the second AST file is loaded. This patch introduces the distinction between setIsUsed() and markUsed() so that we don't call into the ASTMutationListener callback when it wouldn't be appropriate. Fixes PR16635. llvm-svn: 190016
-
- Aug 30, 2013
-
-
Richard Smith authored
llvm-svn: 189629
-
- Aug 02, 2013
-
-
Richard Smith authored
in one module but is only declared as a friend in another module, keep it visible in the result of the merge. This is incomplete on two axes: 1) Our handling of local extern declarations is basically broken (we put them in the wrong decl context, and don't find them in redeclaration lookup, unless they've previously been declared), and this results in them making friends visible after a merge. 2) Eventually we'll need to mark that this has happened, and more carefully check whether a declaration should be visible if it was only visible in some of the modules in which it was declared. Fortunately it's rare for the identifier namespace of a declaration to change along its redeclaration chain. llvm-svn: 187639
-
- Aug 01, 2013
-
-
Richard Smith authored
module. llvm-svn: 187556
-
- Jul 26, 2013
-
-
Richard Smith authored
sufficient to only consider names visible at the point of instantiation, because that may not include names that were visible when the template was defined. More generally, if the instantiation backtrace goes through a module M, then every declaration visible within M should be available to the instantiation. Any of those declarations might be part of the interface that M intended to export to a template that it instantiates. The fix here has two parts: 1) If we find a non-visible declaration during name lookup during template instantiation, check whether the declaration was visible from the defining module of all entities on the active template instantiation stack. The defining module is not the owning module in all cases: we look at the module in which a template was defined, not the module in which it was first instantiated. 2) Perform pending instantiations at the end of a module, not at the end of the translation unit. This is general goodness, since it significantly cuts down the amount of redundant work that is performed in every TU importing a module, and also implicitly adds the module containing the point of instantiation to the set of modules checked for declarations in a lookup within a template instantiation. There's a known issue here with template instantiations performed while building a module, if additional imports are added later on. I'll fix that in a subsequent commit. llvm-svn: 187167
-
- Jul 14, 2013
-
-
Richard Smith authored
global allocation or deallocation function, that should not cause that global allocation or deallocation function to become unavailable. llvm-svn: 186270
-
- Jun 25, 2013
-
-
Richard Smith authored
numbers as we deserialize class template partial specializations. We can't assume that the old sequence numbers will work. The sequence numbers are still deterministic, but are now a lot less predictable for class template partial specializations in modules/PCH. llvm-svn: 184811
-
Richard Smith authored
llvm-svn: 184791
-
- Jun 24, 2013
-
-
Richard Smith authored
llvm-svn: 184689
-
- Jun 21, 2013
-
-
Douglas Gregor authored
This prevents -pedantic from causing warnings in the system headers used to create modules. Fixes <rdar://problem/14201171>. llvm-svn: 184560
-
Douglas Gregor authored
llvm-svn: 184505
-
Douglas Gregor authored
As an optimization, we only kept declared methods with distinct signatures in the global method pool, to keep the method lists small. Under modules, however, one could have two different methods with the same signature that occur in different (sub)modules. If only the later submodule is important, message sends to 'id' with that selector would fail because the first method (the only one that got into the method pool) was hidden. When building a module, keep *all* of the declared methods. I did a quick check of both module build time and uses of modules, and found no performance regression despite this causing us to keep more methods in the global method pool. Fixes <rdar://problem/14148896>. llvm-svn: 184504
-
- Jun 20, 2013
-
-
Lawrence Crowl authored
llvm-svn: 184472
-
- May 20, 2013
-
-
Douglas Gregor authored
Add -Wincomplete-module, which detects when a header is included from a module but isn't itself part of a module. llvm-svn: 182263
-
- May 04, 2013
-
-
Douglas Gregor authored
Previously, we would clone the current diagnostic consumer to produce a new diagnostic consumer to use when building a module. The problem here is that we end up losing diagnostics for important diagnostic consumers, such as serialized diagnostics (where we'd end up with two diagnostic consumers writing the same output file). With forwarding, the diagnostics from all of the different modules being built get forwarded to the one serialized-diagnostic consumer and are emitted in a sane way. Fixes <rdar://problem/13663996>. llvm-svn: 181067
-
- May 02, 2013
-
-
Douglas Gregor authored
When looking for the module associated with one of our magical builtin headers, speculatively load module maps. The "magical" builtin headers are the headers we provide as part of the C standard library, which typically comes from /usr/include. We essentially merge our headers into that location (due to cyclic dependencies). This change makes sure that, when header search finds one of our builtin headers, we figure out which module it actually lives in. This case is fairly rare; one ends up having to include one of the few built-in C headers we provide before including anything from /usr/include to trigger it. Fixes <rdar://problem/13787184>. llvm-svn: 180934
-