aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Modules/module-private.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-11-12[modules] Simplify and generalize the existing rule for finding hiddenRichard Smith1-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
2015-06-16[modules] Simplify -cc1 interface for enabling implicit module maps.Richard Smith1-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
2015-06-15[modules] Better support for redefinitions of an entity from the same module.Richard Smith1-1/+1
Support this across module save/reload and extend the 'missing import' diagnostics with a list of providing modules. llvm-svn: 239750
2014-01-22Require a module.map file to load a moduleBen Langmuir1-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
2013-04-17Extended VerifyDiagnosticConsumer to also verify source file for diagnostic.Andy Gibbs1-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
2013-02-07Rename -fmodule-cache-path <blah> to -fmodules-cache-path=<blah> for ↵Douglas Gregor1-3/+3
consistency. llvm-svn: 174645
2012-12-11Use @import rather than @__experimental_modules_import, since theDouglas Gregor1-2/+2
latter is rather a mess to type. llvm-svn: 169919
2012-08-23When disambiguating an expression-statement from a declaraton-statement, if theRichard Smith1-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
2012-03-01Change @import to @__experimental_modules_import. We are not ready to ↵Ted Kremenek1-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
2012-01-03Eliminate the uglified keyword __import_module__ for importingDouglas Gregor1-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
2011-12-20When performing name lookup for a redeclaration, ignore moduleDouglas Gregor1-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
2011-11-29Eliminate the -emit-module option, which emitted a module by parsing aDouglas Gregor1-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
2011-11-16Migrate a few more modules tests over to -emit-module-from-map.Douglas Gregor1-51/+6
llvm-svn: 144779
2011-09-13For modules, use a hash of the compiler version, language options, andDouglas Gregor1-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
2011-09-13Add a struct-size check for modules when dealing with module-private fieldsDouglas Gregor1-1/+9
llvm-svn: 139597
2011-09-12Introduce a cc1-level option to provide the path to the module cache,Douglas Gregor1-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
2011-09-12Diagnose attempt to mark function-local declarations as __module_private__.Douglas Gregor1-0/+10
llvm-svn: 139519
2011-09-12Allow __module_private__ on fieldsDouglas Gregor1-0/+10
llvm-svn: 139499
2011-09-12Remove the restriction on module-private friends. Since the friendDouglas Gregor1-2/+2
declaration may be the first declaration, we want the ability to that declaration to be marked module-private. llvm-svn: 139497
2011-09-09Friends cannot be declared module-privateDouglas Gregor1-0/+3
llvm-svn: 139411
2011-09-09Specializations cannot be module-hidden. Diagnose attempts to do so.Douglas Gregor1-0/+17
llvm-svn: 139406
2011-09-09__module_private__ is inherited by redeclarations of an entity, andDouglas Gregor1-0/+26
must also be present of the first declaration of that entity. llvm-svn: 139384
2011-09-09Propagate __module_private__ from previous declarations to laterDouglas Gregor1-2/+12
declarations. llvm-svn: 139380
2011-09-09Modules: introduce the __module_private__ declaration specifier, whichDouglas Gregor1-0/+56
indicates that a declaration is only visible within the module it is declared in. llvm-svn: 139348