summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules/module-private.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [modules] Simplify and generalize the existing rule for finding hiddenRichard Smith2015-11-121-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | declarations in redeclaration lookup. A declaration is now visible to lookup if: * It is visible (not in a module, or in an imported module), or * We're doing redeclaration lookup and it's externally-visible, or * We're doing typo correction and looking for unimported decls. We now support multiple modules having different internal-linkage or no-linkage definitions of the same name for all entities, not just for functions, variables, and some typedefs. As previously, if multiple such entities are visible, any attempt to use them will result in an ambiguity error. This patch fixes the linkage calculation for a number of entities where we previously didn't need to get it right (using-declarations, namespace aliases, and so on). It also classifies enumerators as always having no linkage, which is a slight deviation from the C++ standard's definition, but not an observable change outside modules (this change is being discussed on the -core reflector currently). This also removes the prior special case for tag lookup, which made some cases of this work, but also led to bizarre, bogus "must use 'struct' to refer to type 'Foo' in this scope" diagnostics in C++. llvm-svn: 252960
* [modules] Simplify -cc1 interface for enabling implicit module maps.Richard Smith2015-06-161-3/+3
| | | | | | | | | | | | | We used to have a flag to enable module maps, and two more flags to enable implicit module maps. This is all redundant; we don't need any flag for enabling module maps in the abstract, and we don't usually have -fno- flags for -cc1. We now have just a single flag, -fimplicit-module-maps, that enables implicitly searching the file system for module map files and loading them. The driver interface is unchanged for now. We should probably rename -fmodule-maps to -fimplicit-module-maps at some point. llvm-svn: 239789
* [modules] Better support for redefinitions of an entity from the same module.Richard Smith2015-06-151-1/+1
| | | | | | | Support this across module save/reload and extend the 'missing import' diagnostics with a list of providing modules. llvm-svn: 239750
* Require a module.map file to load a moduleBen Langmuir2014-01-221-1/+1
| | | | | | | | Removes some old code that allowed a module to be loaded from a pcm file even if the module.map could not be found. Also update a number of tests that relied on the old behavior. llvm-svn: 199852
* Extended VerifyDiagnosticConsumer to also verify source file for diagnostic.Andy Gibbs2013-04-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | VerifyDiagnosticConsumer previously would not check that the diagnostic and its matching directive referenced the same source file. Common practice was to create directives that referenced other files but only by line number, and this led to problems such as when the file containing the directive didn't have enough lines to match the location of the diagnostic in the other file, leading to bizarre file formatting and other oddities. This patch causes VerifyDiagnosticConsumer to match source files as well as line numbers. Therefore, a new syntax is made available for directives, for example: // expected-error@file:line {{diagnostic message}} This extends the @line feature where "file" is the file where the diagnostic is generated. The @line syntax is still available and uses the current file for the diagnostic. "file" can be specified either as a relative or absolute path - although the latter has less usefulness, I think! The #include search paths will be used to locate the file and if it is not found an error will be generated. The new check is not optional: if the directive is in a different file to the diagnostic, the file must be specified. Therefore, a number of test-cases have been updated with regard to this. This closes out PR15613. llvm-svn: 179677
* Rename -fmodule-cache-path <blah> to -fmodules-cache-path=<blah> for ↵Douglas Gregor2013-02-071-3/+3
| | | | | | consistency. llvm-svn: 174645
* Use @import rather than @__experimental_modules_import, since theDouglas Gregor2012-12-111-2/+2
| | | | | | latter is rather a mess to type. llvm-svn: 169919
* When disambiguating an expression-statement from a declaraton-statement, if theRichard Smith2012-08-231-2/+5
| | | | | | | statement starts with an identifier for which name lookup will fail either way, look at later tokens to disambiguate in order to improve error recovery. llvm-svn: 162464
* Change @import to @__experimental_modules_import. We are not ready to ↵Ted Kremenek2012-03-011-2/+2
| | | | | | | | commit to a particular syntax for modules, and don't have time to push it forward in the near future. llvm-svn: 151841
* Eliminate the uglified keyword __import_module__ for importingDouglas Gregor2012-01-031-5/+6
| | | | | | | | | | | | | modules. This leaves us without an explicit syntax for importing modules in C/C++, because such a syntax needs to be discussed first. In Objective-C/Objective-C++, the @import syntax is used to import modules. Note that, under -fmodules, C/C++ programs can import modules via the #include mechanism when a module map is in place for that header. This allows us to work with modules in C/C++ without committing to a syntax. llvm-svn: 147467
* When performing name lookup for a redeclaration, ignore moduleDouglas Gregor2011-12-201-12/+12
| | | | | | | | | | | | | | | | | | | | | visibility restrictions. This ensures that all declarations of the same entity end up in the same redeclaration chain, even if some of those declarations aren't visible. While this may seem unfortunate to some---why can't two C modules have different functions named 'f'?---it's an acknowedgment that a module does not introduce a new "namespace" of names. As part of this, stop merging the 'module-private' bit from previous declarations to later declarations, because we want each declaration in a module to stand on its own because this can effect, for example, submodule visibility. Note that this notion of names that are invisible to normal name lookup but are available for redeclaration lookups is how we should implement friend declarations and extern declarations within local function scopes. I'm not tackling that problem now. llvm-svn: 146980
* Eliminate the -emit-module option, which emitted a module by parsing aDouglas Gregor2011-11-291-2/+2
| | | | | | | source file (e.g., a header). Immediately steal this useful option name for building modules from a module map file. llvm-svn: 145444
* Migrate a few more modules tests over to -emit-module-from-map.Douglas Gregor2011-11-161-51/+6
| | | | llvm-svn: 144779
* For modules, use a hash of the compiler version, language options, andDouglas Gregor2011-09-131-1/+1
| | | | | | | | | target triple to separate modules built under different conditions. The hash is used to create a subdirectory in the module cache path where other invocations of the compiler (with the same version, language options, etc.) can find the precompiled modules. llvm-svn: 139662
* Add a struct-size check for modules when dealing with module-private fieldsDouglas Gregor2011-09-131-1/+9
| | | | llvm-svn: 139597
* Introduce a cc1-level option to provide the path to the module cache,Douglas Gregor2011-09-121-1/+1
| | | | | | | | where the compiler will look for module files. Eliminates the egregious hack where we looked into the header search paths for modules. llvm-svn: 139538
* Diagnose attempt to mark function-local declarations as __module_private__.Douglas Gregor2011-09-121-0/+10
| | | | llvm-svn: 139519
* Allow __module_private__ on fieldsDouglas Gregor2011-09-121-0/+10
| | | | llvm-svn: 139499
* Remove the restriction on module-private friends. Since the friendDouglas Gregor2011-09-121-2/+2
| | | | | | | declaration may be the first declaration, we want the ability to that declaration to be marked module-private. llvm-svn: 139497
* Friends cannot be declared module-privateDouglas Gregor2011-09-091-0/+3
| | | | llvm-svn: 139411
* Specializations cannot be module-hidden. Diagnose attempts to do so.Douglas Gregor2011-09-091-0/+17
| | | | llvm-svn: 139406
* __module_private__ is inherited by redeclarations of an entity, andDouglas Gregor2011-09-091-0/+26
| | | | | | must also be present of the first declaration of that entity. llvm-svn: 139384
* Propagate __module_private__ from previous declarations to laterDouglas Gregor2011-09-091-2/+12
| | | | | | declarations. llvm-svn: 139380
* Modules: introduce the __module_private__ declaration specifier, whichDouglas Gregor2011-09-091-0/+56
indicates that a declaration is only visible within the module it is declared in. llvm-svn: 139348
OpenPOWER on IntegriCloud