summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
Commit message (Collapse)AuthorAgeFilesLines
...
* Introduce TargetInfo::hasFeature() to query various feature names inDouglas Gregor2012-01-301-0/+8
| | | | | | | | | | | | | | 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
* Just disable the compiler-builtins module test on MSVC for nowDouglas Gregor2012-01-291-0/+3
| | | | llvm-svn: 149214
* Teach tgmath.h to only include <complex.h> if it's available.Douglas Gregor2012-01-291-2/+2
| | | | llvm-svn: 149213
* Try to get useful diagnostics out of the failing MSVC buildersDouglas Gregor2012-01-291-2/+2
| | | | llvm-svn: 149212
* Alternate fix to the modules failures that doesn't require us to tweak tgmath.hDouglas Gregor2012-01-291-1/+1
| | | | llvm-svn: 149210
* If there's no math.h, then tgmath.h should just be emptyDouglas Gregor2012-01-291-3/+2
| | | | llvm-svn: 149209
* Temporary disable the -verify on this test in the hope of getting some ↵Douglas Gregor2012-01-291-2/+3
| | | | | | useful output from the buildbots llvm-svn: 149208
* Introduce a module map for (some of) the compiler-suppliedDouglas Gregor2012-01-291-0/+12
| | | | | | | | headers. The remaining headers require more sophisticated requirements; they'll be handled separately. Part of <rdar://problem/10710060>. llvm-svn: 149206
* Test module lookup within a subdirectory of a normal include directory.Douglas Gregor2012-01-293-3/+10
| | | | llvm-svn: 149196
* Introduce module attributes into the module map grammar, along with aDouglas Gregor2012-01-272-1/+8
| | | | | | | | | | | | | 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
* Reimplement (de-)serialization of Objective-C categories to eliminateDouglas Gregor2012-01-274-0/+28
| | | | | | | | | | | | | | the direct serialization of the linked-list structure. Instead, use a scheme similar to how we handle redeclarations, with redeclaration lists on the side. This addresses several issues: - In cases involving mixing and matching of many categories across many modules, the linked-list structure would not be consistent across different modules, and categories would get lost. - If a module is loaded after the class definition and its other categories have already been loaded, we wouldn't see any categories in the newly-loaded module. llvm-svn: 149112
* Whenever Sema attempts to look in the global method pool, try to loadDouglas Gregor2012-01-254-0/+57
| | | | | | | | | additional data from the external Sema source. This properly copes with modules that are imported after we have already searched in the global method pool for a given selector. For PCH, it's a slight pessimization to be fixed soon. llvm-svn: 148891
* When deserializing the definition of a C++ class/ObjC class/ObjCDouglas Gregor2012-01-153-0/+13
| | | | | | | | | | | | | | | protocol, record the definition pointer in the canonical declaration for that entity, and then propagate that definition pointer from the canonical declaration to all other deserialized declarations. This approach works well even when deserializing declarations that didn't know about the original definition, which can occur with modules. A nice bonus from this definition-deserialization approach is that we no longer need update records when a definition is added, because the redeclaration chains ensure that the if any declaration is loaded, the definition will also get loaded. llvm-svn: 148223
* (Implicit) parameters deserialized as part of a function type must notDouglas Gregor2012-01-132-0/+8
| | | | | | | get added to the identifier chains as part of deserialization, because they should not be visible to name lookup. llvm-svn: 148159
* When inferring a module for a framework, first determine whether thatDouglas Gregor2012-01-131-2/+2
| | | | | | | | | | | | | framework is actually a subframework within a top-level framework. If so, only infer a module for the top-level framework and then dig out the appropriate submodule. This helps us cope with an amusing subframeworks anti-pattern, where one uses -F <framework>/Frameworks to get direct include access to the subframeworks of a framework (which otherwise would not be permitted). llvm-svn: 148148
* Don't infer a submodule for a framework's private header, at least for now.Douglas Gregor2012-01-131-1/+1
| | | | llvm-svn: 148117
* When deserializing an anonymous namespace from a module, do not attachDouglas Gregor2012-01-094-0/+48
| | | | | | | | the anonymous namespace to its parent. Semantically, this means that the anonymous namespaces defined in one module are distinct from the anonymous namespaces defined in another module. llvm-svn: 147782
* Implement merging of namespace-scope declarations across modules, soDouglas Gregor2012-01-093-0/+37
| | | | | | | | | | that we can merge, for example, two occurrences of namespace N { void f(); } in two disjoint modules. llvm-svn: 147780
* Implement redeclaration merging for namespaces defined in distinctDouglas Gregor2012-01-093-0/+48
| | | | | | | | | modules. Teach name lookup into namespaces to search in each of the merged DeclContexts as well as the (now-primary) DeclContext. This supports the common case where two different modules put something into the same namespace. llvm-svn: 147778
* Always allow redefinition of typedefs when modules are enabled. ThisDouglas Gregor2012-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | is important because it's fairly common for headers (especially system headers) to want to provide only those typedefs needed for that particular header, based on some guard macro, e.g., #ifndef _SIZE_T #define _SIZE_T typedef long size_t; #endif which is repeated in a number of headers. The guard macro protects against duplicate definitions. However, this means that only the first occurrence of this pattern actually defines size_t, so the submodule corresponding to this header has the only visible definition. If a user then imports a different submodule from the same module, size_t will be known but not visible, and therefore cannot be used. By allowing redefinition of typedefs, each header that wants to define size_t can do so independently, so it will be available in the corresponding submodules. llvm-svn: 147775
* Switch NamespaceDecl from its own hand-rolled redeclaration chain overDouglas Gregor2012-01-075-0/+67
| | | | | | | | | | | | to Redeclarable<NamespaceDecl>, so that we benefit from the improveed redeclaration deserialization and merging logic provided by Redeclarable<T>. Otherwise, no functionality change. As a drive-by fix, collapse the "inline" bit into the low bit of the original namespace/anonymous namespace, saving 8 bytes per NamespaceDecl on x86_64. llvm-svn: 147729
* When inferring a submodule ID during module creation, look up theDouglas Gregor2012-01-062-4/+14
| | | | | | | | | | include stack to find the first file that is known to be part of the module. This copes with situations where the module map doesn't completely specify all of the headers that are involved in the module, which can come up when there are very strange #include_next chains (e.g., with weird compiler/stdlib headers like stdarg.h or float.h). llvm-svn: 147662
* When we're performing name lookup for a tag, we still allow ourselvesDouglas Gregor2012-01-052-2/+4
| | | | | | | | | | | | | | | | | | to see hidden declarations because every tag lookup is effectively a redeclaration lookup. For example, image that struct foo; is declared in a submodule that is known but hasn't been imported. If someone later writes struct foo *foo_p; then "struct foo" is either a reference or a redeclaration. To keep the redeclaration chains sound, we treat it like a redeclaration for name-lookup purposes. llvm-svn: 147588
* When generating includes for all of the headers we found in anDouglas Gregor2012-01-052-1/+7
| | | | | | | umbrella directory, skip includes for any headers that are part of an unavailable module. llvm-svn: 147572
* Implement declaration merging for variables in disjoint modules.Douglas Gregor2012-01-043-0/+32
| | | | llvm-svn: 147535
* Implement declaration merging for non-template functions fromDouglas Gregor2012-01-043-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | different modules. This implementation is a first approximation of what we want, using only the function type to determine equivalence. Later, we'll want to deal with some of the more subtle issues, including: - C allows a prototyped declaration and a non-prototyped declaration to be merged, which we should support - We may want to ignore the return type when merging, then complain if the return types differ. Or, we may want to leave it as it us, so that we only complain if overload resolution eventually fails. - C++ non-static member functions need to consider cv-qualifiers and ref-qualifiers. - Function templates need to consider the template parameters and return type. - Function template specializations will have special rules. - We can now (accidentally!) end up overloading in C, even without the "overloadable" attribute, and will need to detect this at some point. The actual detection of "is this an overload?" is implemented by Sema::IsOverload(), which will need to be moved into the AST library for re-use here. That will be a future refactor. llvm-svn: 147534
* Don't treat 'import' as a contextual keyword when we're in a caching lexer, ↵Douglas Gregor2012-01-041-0/+6
| | | | | | or when modules are disabled. llvm-svn: 147524
* Test "merging" of typedef types across distinct modules. At present,Douglas Gregor2012-01-033-0/+15
| | | | | | | | | | | | the AST reader doesn't actually perform a merge, because name lookup knows how to merge identical typedefs together. As part of this, teach C/Objective-C name lookup to return multiple results in all cases, rather than first digging through the attributes to see if the value is overloadable. This way, we'll catch ambiguous lookups in C/Objective-C. llvm-svn: 147498
* Implement cross-module declaration merging for tag declarations, soDouglas Gregor2012-01-035-0/+59
| | | | | | | | | | | | that if two modules A and B both contain a declaration of a tag such as struct X; and those two modules are unrelated, the two declarations of X will be merged into a single redeclaration chain. llvm-svn: 147488
* Re-uglify #public and #private to #__public_macro and #__private_macro.Douglas Gregor2012-01-035-7/+7
| | | | llvm-svn: 147469
* Eliminate the uglified keyword __import_module__ for importingDouglas Gregor2012-01-0320-72/+83
| | | | | | | | | | | | | 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
* Under -fmodules, accept #public <macroname> and #private <macroname>Douglas Gregor2012-01-0313-30/+30
| | | | | | | to make a macro public (the default for headers) or private, respectively. llvm-svn: 147455
* Introduce a non-uglified syntax for module imports in Objective-C:Douglas Gregor2012-01-0320-32/+32
| | | | | | @import identifier [. identifier]* ; llvm-svn: 147452
* Don't attempt to merge a deserialized declaration with existingDouglas Gregor2012-01-031-2/+2
| | | | | | | declarations in the AST unless modules are enabled. This case doesn't come up with precompiled headers, and it isn't cheap. llvm-svn: 147451
* Rename the command-line option for mapping #include/#import over toDouglas Gregor2012-01-039-10/+10
| | | | | | | | module imports from -fauto-module-import to -fmodules. The new name will eventually be used to enable modules, and the #include/#import mapping is a crucial part of the feature. llvm-svn: 147447
* Diagnose cases where the definition of a particular type is required,Douglas Gregor2012-01-022-3/+23
| | | | | | | is known (to Clang), but is not visible because the module has not yet been imported. llvm-svn: 147436
* Implement declaration merging for Objective-C protocols acrossDouglas Gregor2012-01-014-0/+20
| | | | | | | multiple, disjoint modules. There is far too much duplicating with the ObjCInterfaceDecl case here, which I'll eliminate shortly. llvm-svn: 147417
* Wire up redeclaration chains for Objective-C protocols, so that bothDouglas Gregor2012-01-015-0/+29
| | | | | | | forward declarations and definitions of an Objective-C protocol are represented within a single chain of ObjCProtocolDecls. llvm-svn: 147412
* Implement support for module requirements, which indicate the languageDouglas Gregor2011-12-314-0/+21
| | | | | | | | | 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
* When building a module with an umbrella header, warn about any headersDouglas Gregor2011-12-232-3/+7
| | | | | | | | found within that umbrella directory that were not actually included by the umbrella header. They should either be referenced in the module map or included by the umbrella header. llvm-svn: 147207
* Serialize the AST reader's mapping from canonical declarations to theDouglas Gregor2011-12-223-1/+10
| | | | | | | | | | | | | | | | set of (previously-canonical) declaration IDs to the module file, so that future AST reader instances that load the module know which declarations are merged. This is important in the fairly tricky case where a declaration of an entity, e.g., @class X; occurs before the import of a module that also declares that entity. We merge the declarations, and record the fact that the declaration of X loaded from the module was merged into the (now canonical) declaration of X that we parsed. llvm-svn: 147181
* If we end up merging an Objective-C class with an existing Objective-CDouglas Gregor2011-12-225-0/+26
| | | | | | | class that comes from a different module file, make sure that we load all of the pending declarations for the original declaration. llvm-svn: 147168
* When deserializing an Objective-C class, check whether we have anotherDouglas Gregor2011-12-223-0/+45
| | | | | | | | | | | | | | | | declaration of that same class that either came from some other module or occurred in the translation unit loading the module. In this case, we need to merge the two redeclaration chains immediately so that all such declarations have the same canonical declaration in the resulting AST (even though they don't in the module files we've imported). Focusing on Objective-C classes until I'm happy with the design, then I'll both (1) extend this notion to other kinds of declarations, and (2) optimize away this extra checking when we're not dealing with modules. For now, doing this checking for PCH files/preambles gives us better testing coverage. llvm-svn: 147123
* When we make a previously-deserialized module definition visible,Douglas Gregor2011-12-202-0/+6
| | | | | | | notify the AST deserialization listener so that the AST writer knows that it can write the macro definition. llvm-svn: 146994
* When performing name lookup for a redeclaration, ignore moduleDouglas Gregor2011-12-208-18/+48
| | | | | | | | | | | | | | | | | | | | | 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
* Detect when mapping a #include/#import over to a submodule ends upDouglas Gregor2011-12-202-0/+10
| | | | | | | | | | | | | hitting a submodule that was never actually created, e.g., because that header wasn't parsed. In such cases, complain (because the module's umbrella headers don't cover everything) and fall back to including the header. Later, we'll add a warning at module-build time to catch all such cases. However, this fallback is important to eliminate assertions in the ASTWriter when this happens. llvm-svn: 146933
* Once we have fully deserialized a redeclaration chain for somethingDouglas Gregor2011-12-191-2/+2
| | | | | | | | | | | with a definition pointer (e.g., C++ and Objective-C classes), zip through the redeclaration chain to make sure that all of the declarations point to the definition data. As part of this, realized again why the first redeclaration of an entity in a file is important, and brought back that idea. llvm-svn: 146886
* Re-implement (de-)serialization of redeclaration chains forDouglas Gregor2011-12-195-0/+30
| | | | | | | | | | | | | | | | redeclaration templates (RedeclarableTemplateDecl), similarly to the way (de-)serialization is implemented for Redeclarable<T>. In the process, found a simpler formulation for handling redeclaration chains and implemented that in both places. The new test establishes that we're building the redeclaration chains properly. However, the FIXME indicates where we're tickling a different bug that has to do with us not setting the DefinitionData pointer properly in redeclarations that we detected after the definition itself was deserialized. The (separable) fix for that bug is forthcoming. llvm-svn: 146883
* The submodule offset map can introduce "empty" remapping entries forDouglas Gregor2011-12-192-0/+6
| | | | | | | | | | imported modules that don't introduce any new entities of a particular kind. Allow these entries to be replaced with entries for another loaded module. In the included test case, selectors exhibit this behavior. llvm-svn: 146870
* Optimize serialized representation of redeclarable declarations forDouglas Gregor2011-12-195-0/+16
| | | | | | | | | | | which there are no redeclarations. This reduced by size of the PCH file for Cocoa.h by ~650k: ~536k of that was in the new LOCAL_REDECLARATIONS table, which went from a ridiculous 540k down to an acceptable 3.5k, while the rest was due to the more compact abbreviated representation of redeclarable declaration kinds (which no longer need to store the 'first' declaration ID). llvm-svn: 146869
OpenPOWER on IntegriCloud