summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules/Inputs
Commit message (Collapse)AuthorAgeFilesLines
...
* Use @import rather than @__experimental_modules_import, since theDouglas Gregor2012-12-1122-28/+28
| | | | | | latter is rather a mess to type. llvm-svn: 169919
* If an excluded header does not exist, just ignore itDouglas Gregor2012-11-151-0/+1
| | | | llvm-svn: 168077
* When loading a module fails because it is out of date, rebuild thatDouglas Gregor2012-11-073-0/+5
| | | | | | module in place. <rdar://problem/10138913> llvm-svn: 167539
* Introduce inferred framework modules into the module map file,Douglas Gregor2012-11-062-0/+6
| | | | | | | | | | | | | | allowing a module map to be placed one level above the '.framework' directories to specify that all .frameworks within that directory can be inferred as framework modules. One can also specifically exclude frameworks known not to work. This makes explicit (and more restricted) behavior modules have had "forever", where *any* .framework was assumed to be able to be built as a module. That's not necessarily true, so we white-list directories (with exclusions) when those directories have been audited. llvm-svn: 167482
* Have the parser initialize Sema before it consumes the firstDouglas Gregor2012-11-051-0/+2
| | | | | | | | token. This is important because the first token could actually be after an #include that triggers a module import, which might use either Sema or the AST consumer before it would have been initialized. llvm-svn: 167423
* Prior to adding the new "expected-no-diagnostics" directive to ↵Andy Gibbs2012-10-191-0/+1
| | | | | | VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive. llvm-svn: 166280
* Introduce the notion of excluded headers into the module mapDouglas Gregor2012-10-151-4/+1
| | | | | | | | 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
* Add missing header from 165821Douglas Gregor2012-10-121-0/+2
| | | | llvm-svn: 165822
* Sanitize the names of modules determined based on the names of headersDouglas Gregor2012-10-122-0/+2
| | | | | | | or directories, to make sure that they are identifiers that are not keywords in any dialect. Fixes <rdar://problem/12489495>. llvm-svn: 165821
* Track which particular submodule #undef's a macro, so that the actualDouglas Gregor2012-10-125-2/+9
| | | | | | #undef only occurs if that submodule is imported. llvm-svn: 165773
* Diagnose the expansion of ambiguous macro definitions. This can happenDouglas Gregor2012-10-113-3/+15
| | | | | | | only with modules, when two disjoint modules #define the same identifier to different token sequences. llvm-svn: 165746
* Deserialize macro history when we deserialize an identifier that hasDouglas Gregor2012-10-113-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | macro history. When deserializing macro history, we arrange history such that the macros that have definitions (that haven't been #undef'd) and are visible come at the beginning of the list, which is what the preprocessor and other clients of Preprocessor::getMacroInfo() expect. If additional macro definitions become visible later, they'll be moved toward the front of the list. Note that it's possible to have ambiguities, but we don't diagnose them yet. There is a partially-implemented design decision here that, if a particular identifier has been defined or #undef'd within the translation unit, that definition (or #undef) hides any macro definitions that come from imported modules. There's still a little work to do to ensure that the right #undef'ing happens. Additionally, we'll need to scope the update records for #undefs, so they only kick in when the submodule containing that update record becomes visible. llvm-svn: 165682
* Rework the (de-)serialization of macros, as stored inDouglas Gregor2012-10-094-0/+17
| | | | | | | | | | | | | | | | MacroInfo*. Instead of simply dumping an offset into the current file, give each macro definition a proper ID with all of the standard modules-remapping facilities. Additionally, when a macro is modified in a subsequent AST file (e.g., #undef'ing a macro loaded from another module or from a precompiled header), provide a macro update record rather than rewriting the entire macro definition. This gives us greater consistency with the way we handle declarations, and ties together macro definitions much more cleanly. Note that we're still not actually deserializing macro history (we never were), but it's far easy to do properly now. llvm-svn: 165560
* When we load a function or method body from an AST file, we checkDouglas Gregor2012-10-093-2/+4
| | | | | | | | | | whether that function/method already has a body (loaded from some other AST file), as introduced in r165137. Delay this check until after the redeclaration chains have been wired up. While I'm here, make the loading of method bodies lazy. llvm-svn: 165513
* Add redecls into their lexical DeclContext: this is what they assert on, and ↵Axel Naumann2012-10-021-0/+11
| | | | | | | | the merging should have set it correctly. This is especially relevant for templatedDecls that might be injected (and thus have their DeclContext set to) somewhere completely different. llvm-svn: 165005
* Only those InterestingDecls that got added to the AST should be passed to ↵Axel Naumann2012-10-022-5/+9
| | | | | | the ASTConsumer. llvm-svn: 165001
* Merge pending instantiations instead of overwriting existing ones.Axel Naumann2012-10-028-58/+70
| | | | | | | | | | | Check whether a pending instantiation needs to be instantiated (or whether an instantiation already exists). Verify the size of the PendingInstantiations record (was only checking size of existing PendingInstantiations). Migrate Obj-C++ part of redecl-merge into separate test, now that this is growing. templates.mm: test that CodeGen has seen exactly one definition of template instantiations. redecl-merge.m: use "@" specifier for expected-diagnostics. llvm-svn: 164993
* The Redeclarable part of named decls is read before their name.Axel Naumann2012-10-011-5/+7
| | | | | | | | Lookup can nevertheless find them due to the serialized lookup table. For instance when reading a template decl's templatedDecl, it will search for existing decls that it could be a redeclaration of, and find the half-read template decl. Thus there is no point in asserting the names of decls. llvm-svn: 164932
* Also merge template redeclarations.Axel Naumann2012-10-012-0/+14
| | | | | | Don't require specializations (of existing and read template) to be unique. llvm-svn: 164931
* Bring ASTReader and Writer into sync for the case where a canonical template ↵Axel Naumann2012-10-013-0/+17
| | | | | | | | | specialization was written, which is non-canonical at the time of reading: force the reading of the ClassTemplateDecl if it was written. The easiest way out is to store whether the decl was canonical at the time of writing. Add test. llvm-svn: 164927
* Introduce builtin macros to determine whether we're building aDouglas Gregor2012-09-251-0/+9
| | | | | | | | | | specific module (__building_module(modulename)) and to get the name of the current module as an identifier (__MODULE__). Used to help headers behave differently when they're being included as part of building a module. Oh, the irony. llvm-svn: 164605
* Update VerifyDiagnosticConsumer to only get directives during parsing.Jordan Rose2012-08-101-1/+1
| | | | | | | | | | | | | | | | | | | | The old behavior was to re-scan any files (like modules) where we may have directives but won't actually be parsing during the -verify invocation. Now, we keep the old behavior in Debug builds as a sanity check (though modules are a known entity), and expect all legitimate directives to come from comments seen by the preprocessor. This also affects the ARC migration tool, which captures diagnostics in order to filter some out. This change adds an explicit cleanup to CaptureDiagnosticsConsumer in order to let its sub-consumer handle the real end of diagnostics. This was originally split into four patches, but the tests do not run cleanly without all four, so I've combined them into one commit. Patches by Andy Gibbs, with slight modifications from me. llvm-svn: 161650
* Allow -verify directives to be filtered by preprocessing.Jordan Rose2012-07-111-1/+5
| | | | | | | | | | | | | | | | | | | | | This is accomplished by making VerifyDiagnosticsConsumer a CommentHandler, which then only reads the -verify directives that are actually in live blocks of code. It also makes it simpler to handle -verify directives that appear in header files, though we still have to manually reparse some files depending on how they are generated. This requires some test changes. In particular, all PCH tests now have their -verify directives outside the "header" portion of the file, using the @line syntax added in r159978. Other tests have been modified mostly to make it clear what is being tested, and to prevent polluting the expected output with the directives themselves. Patch by Andy Gibbs! (with slight modifications) The new Frontend/verify-* tests exercise the functionality of this commit, as well as r159978, r159979, and r160053 (Andy's other -verify enhancements). llvm-svn: 160068
* Fix ASTReader handling of ImportDecls, from Meador Inge!Douglas Gregor2012-05-162-0/+4
| | | | llvm-svn: 156923
* There's some code in the PCH reader that looks like it's needlessly complex, butNick Lewycky2012-04-123-0/+8
| | | | | | | turns out that it's actually needed for C++ modules support. Since simplifying it didn't cause any test failures, I'll add a test for it. llvm-svn: 154582
* Change @import to @__experimental_modules_import. We are not ready to ↵Ted Kremenek2012-03-0118-24/+24
| | | | | | | | commit to a particular syntax for modules, and don't have time to push it forward in the near future. llvm-svn: 151841
* Back out my heinous hack that tricked the module generation mechanismDouglas Gregor2012-02-024-0/+26
| | | | | | | | | | | | | | | | | | | | 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
* Test module lookup within a subdirectory of a normal include directory.Douglas Gregor2012-01-292-0/+4
| | | | 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-273-0/+15
| | | | | | | | | | | | | | 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-253-0/+27
| | | | | | | | | 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-152-0/+6
| | | | | | | | | | | | | | | 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-131-0/+5
| | | | | | | get added to the identifier chains as part of deserialization, because they should not be visible to name lookup. llvm-svn: 148159
* When deserializing an anonymous namespace from a module, do not attachDouglas Gregor2012-01-093-0/+37
| | | | | | | | 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-092-0/+24
| | | | | | | | | | 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-092-0/+27
| | | | | | | | | 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
* Switch NamespaceDecl from its own hand-rolled redeclaration chain overDouglas Gregor2012-01-074-0/+52
| | | | | | | | | | | | 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-051-0/+2
| | | | | | | | | | | | | | | | | | 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-042-0/+24
| | | | llvm-svn: 147535
* Implement declaration merging for non-template functions fromDouglas Gregor2012-01-042-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Test "merging" of typedef types across distinct modules. At present,Douglas Gregor2012-01-032-0/+6
| | | | | | | | | | | | 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-034-0/+36
| | | | | | | | | | | | 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-034-6/+6
| | | | llvm-svn: 147469
* Eliminate the uglified keyword __import_module__ for importingDouglas Gregor2012-01-038-11/+11
| | | | | | | | | | | | | 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-034-6/+6
| | | | | | | 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-037-10/+10
| | | | | | @import identifier [. identifier]* ; llvm-svn: 147452
* Diagnose cases where the definition of a particular type is required,Douglas Gregor2012-01-021-1/+8
| | | | | | | 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-013-0/+12
| | | | | | | multiple, disjoint modules. There is far too much duplicating with the ObjCInterfaceDecl case here, which I'll eliminate shortly. llvm-svn: 147417
OpenPOWER on IntegriCloud