summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Module.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Module [extern_c] attribute: inherit to submodules, don't write 'extern "C"'Richard Smith2014-03-081-0/+2
| | | | | | blocks when building in C mode, and serialize and deserialize the attribute. llvm-svn: 203317
* Add [extern_c] attribute for modules, allowing a C module to be imported ↵Richard Smith2014-03-021-4/+3
| | | | | | within an extern "C" block in C++ code. llvm-svn: 202615
* Modules: Don't warn upon missing headers while reading the module map.Daniel Jasper2013-12-171-1/+5
| | | | | | | | | | | | | | | Instead, mark the module as unavailable so that clang errors as soon as someone tries to build this module. This works towards the long-term goal of not stat'ing the header files at all while reading the module map and instead read them only when the module is being built (there is a corresponding FIXME in parseHeaderDecl()). However, it seems non-trivial to get there and this unblock us and moves us into the right direction. Also changed the implementation to reuse the same DiagnosticsEngine. llvm-svn: 197485
* Include non-explicit submodules in exported module listDmitri Gribenko2013-11-041-0/+10
| | | | | | | | | | | | | | | | 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
* Simplify computation of visible module set.Richard Smith2013-11-011-14/+5
| | | | llvm-svn: 193850
* Clang modules: collect exports recursivelyDmitri Gribenko2013-10-311-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change makes Module::buildVisibleModulesCache() collect exported modules recursively. While computing a set of exports, getExportedModules() iterates over the set of imported modules and filters it. But it does not consider the set of exports of those modules -- it is the responsibility of the caller to do this. Here is a certain instance of this issue. Module::isModuleVisible says that CoreFoundation.CFArray submodule is not visible from Cocoa. Why? - Cocoa imports Foundation. - Foundation has an export restriction: "export *". - Foundation imports CoreFoundation. (Just the top-level module.) - CoreFoundation exports CoreFoundation.CFArray. To decide which modules are visible from Cocoa, we collect all exported modules from immediate imports in Cocoa: > visibleModulesFro(Cocoa) = exported(Foundation) + exported(CoreData) + exported(AppKit) To find out which modules are exported, we filter imports according to restrictions: > exported(Foundation) = filterByModuleMapRestrictions(imports(Foundation)) Because Foundation imports CoreFoundation (not CoreFoundation.CFArray), the CFArray submodule is considered not exported from Foundation, and is not visible from Cocoa (according to Module::isModuleVisible). llvm-svn: 193815
* Allow a new syntax in a module requires-declaration:Richard Smith2013-10-281-11/+17
| | | | | | | | | | | | 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
* Module use declarations (II)Daniel Jasper2013-09-241-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* When we perform dependent name lookup during template instantiation, it's notRichard Smith2013-07-251-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Use SmallVectorImpl::reverse_iterator instead of SmallVector to avoid ↵Craig Topper2013-07-081-2/+2
| | | | | | specifying the vector size. llvm-svn: 185784
* This patch adds new private headers to the module map. PrivateLawrence Crowl2013-06-201-2/+9
| | | | | | | headers may be included from within the module, but not from outside the module. llvm-svn: 184471
* <rdar://problem/12368093> Extend module maps with a 'conflict' declaration, ↵Douglas Gregor2013-03-201-0/+18
| | | | | | and warn when a newly-imported module conflicts with an already-imported module. llvm-svn: 177577
* Make sure that Module::ConfigMacrosExhaustive gets initialized and ↵Douglas Gregor2013-03-201-3/+4
| | | | | | | | | deserialized correctly. This fixes regressions introduced in r177466 that caused several module tests to fail sporadically. llvm-svn: 177481
* <rdar://problem/10796651> Introduce configuration macros into module maps.Douglas Gregor2013-03-201-1/+13
| | | | | | | | | | | | | | | | | | | | | | Configuration macros are macros that are intended to alter how a module works, such that we need to build different module variants for different values of these macros. A module can declare its configuration macros, in which case we will complain if the definition of a configation macro on the command line (or lack thereof) differs from the current preprocessor state at the point where the module is imported. This should eliminate some surprises when enabling modules, because "#define CONFIG_MACRO ..." followed by "#include <module/header.h>" would silently ignore the CONFIG_MACRO setting. At least it will no longer be silent about it. Configuration macros are eventually intended to help reduce the number of module variants that need to be built. When the list of configuration macros for a module is exhaustive, we only need to consider the settings for those macros when building/finding the module, which can help isolate modules for various project-specific -D flags that should never affect how modules are build (but currently do). llvm-svn: 177466
* [Modules] Resolve top-headers of modules lazily.Argyrios Kyrtzidis2013-03-131-0/+14
| | | | | | | | | | | This allows resolving top-header filenames of modules to FileEntries when we need them, not eagerly. Note that that this breaks ABI for libclang functions clang_Module_getTopLevelHeader / clang_Module_getNumTopLevelHeaders but this is fine because they are experimental and not widely used yet. llvm-svn: 176975
* [modules] Refactor code from ASTReader::makeModuleVisible() into a new function,Argyrios Kyrtzidis2013-02-191-0/+53
| | | | | | Module::getExportedModules() so it can be reused. llvm-svn: 175548
* Implement parsing, AST, (de-)serialization, and placeholder globalDouglas Gregor2013-01-141-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | metadata for linking against the libraries/frameworks for imported modules. The module map language is extended with a new "link" directive that specifies what library or framework to link against when a module is imported, e.g., link "clangAST" or link framework "MyFramework" Importing the corresponding module (or any of its submodules) will eventually link against the named library/framework. For now, I've added some placeholder global metadata that encodes the imported libraries/frameworks, so that we can test that this information gets through to the IR. The format of the data is still under discussion. llvm-svn: 172437
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-6/+6
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* s/CPlusPlus0x/CPlusPlus11/gRichard Smith2013-01-021-1/+1
| | | | llvm-svn: 171367
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-3/+3
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Introduce the notion of excluded headers into the module mapDouglas Gregor2012-10-151-0/+7
| | | | | | | | description. Previously, one could emulate this behavior by placing the header in an always-unavailable submodule, but Argyrios guilted me into expressing this idea properly. llvm-svn: 165921
* In the Module class, add a reference to the corresponding AST file.Argyrios Kyrtzidis2012-09-291-2/+2
| | | | llvm-svn: 164873
* Back out my heinous hack that tricked the module generation mechanismDouglas Gregor2012-02-021-0/+2
| | | | | | | | | | | | | | | | | | | | into using non-absolute system includes (<foo>)... ... and introduce another hack that is simultaneously more heineous and more effective. We whitelist Clang-supplied headers that augment or override system headers (such as float.h, stdarg.h, and tgmath.h). For these headers, Clang does not provide a module mapping. Instead, a system-supplied module map can refer to these headers in a system module, and Clang will look both in its own include directory and wherever the system-supplied module map suggests, then adds either or both headers. The end result is that Clang-supplied headers get merged into the system-supplied module for the C standard library. As a drive-by, fix up a few dependencies in the _Builtin_instrinsics module. llvm-svn: 149611
* Introduce TargetInfo::hasFeature() to query various feature names inDouglas Gregor2012-01-301-1/+5
| | | | | | | | | | | | | | each of the targets. Use this for module requirements, so that we can pin the availability of certain modules to certain target features, e.g., provide a module for xmmintrin.h only when SSE support is available. Use these feature names to provide a nearly-complete module map for Clang's built-in headers. Only mm_alloc.h and unwind.h are missing, and those two are fairly specialized at the moment. Finishes <rdar://problem/10710060>. llvm-svn: 149227
* Thread a TargetInfo through to the module map; we'll need it forDouglas Gregor2012-01-301-5/+8
| | | | | | target-specific module requirements. llvm-svn: 149224
* Introduce module attributes into the module map grammar, along with aDouglas Gregor2012-01-271-4/+11
| | | | | | | | | | | | | single attribute ("system") that allows us to mark a module as being a "system" module. Each of the headers that makes up a system module is considered to be a system header, so that we (for example) suppress warnings there. If a module is being inferred for a framework, and that framework directory is within a system frameworks directory, infer it as a system framework. llvm-svn: 149143
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-171-1/+0
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* Store the submodules of a module in source order, as they are storedDouglas Gregor2012-01-041-10/+33
| | | | | | | | in the module map. This provides a bit more predictability for the user, as well as eliminating the need to sort the submodules when serializing them. llvm-svn: 147564
* Implement support for module requirements, which indicate the languageDouglas Gregor2011-12-311-0/+74
| | | | | | | | | features needed for a particular module to be available. This allows mixed-language modules, where certain headers only work under some language variants (e.g., in C++, std.tuple might only be available in C++11 mode). llvm-svn: 147387
* Tweak the syntax of umbrella headers, so that "umbrella" is treated asDouglas Gregor2011-12-081-1/+6
| | | | | | | | | | | a modifier for a header declarartion, e.g., umbrella header "headername" Collapse the umbrella-handling code in the parser into the header-handling code, so we don't duplicate the header-search logic. llvm-svn: 146159
* Within the module representation, generalize the notion of an umbrellaDouglas Gregor2011-12-081-1/+8
| | | | | | | | | | header to also support umbrella directories. The umbrella directory for an umbrella header is the directory in which the umbrella header resides. No functionality change yet, but it's coming. llvm-svn: 146158
* Parse inferred submodules in module maps, track their contents inDouglas Gregor2011-12-051-9/+22
| | | | | | | Module, and (de-)serialize this information. Semantics of inferred submodules to follow. llvm-svn: 145864
* Fix printing of wildcard exports.Douglas Gregor2011-12-051-5/+14
| | | | llvm-svn: 145812
* Implement support for wildcard exports in modules, allowing a moduleDouglas Gregor2011-12-051-0/+12
| | | | | | | | to re-export anything that it imports. This opt-in feature makes a module behave more like a header, because it can be used to re-export the transitive closure of a (sub)module's dependencies. llvm-svn: 145811
* Implement (de-)serialization of the set of exported modules in aDouglas Gregor2011-12-021-0/+25
| | | | | | module map. llvm-svn: 145695
* Promote ModuleMap::Module to a namespace-scope class in the BasicDouglas Gregor2011-11-301-0/+91
library, since modules cut across all of the libraries. Rename serialization::Module to serialization::ModuleFile to side-step the annoying naming conflict. Prune a bunch of ModuleMap.h includes that are no longer needed (most files only needed the Module type). llvm-svn: 145538
OpenPOWER on IntegriCloud