summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
Commit message (Collapse)AuthorAgeFilesLines
...
* clang/test/Modules/explicit-build.cpp: Tweak to meet win32's backslash.NAKAMURA Takumi2014-10-281-1/+1
| | | | llvm-svn: 220770
* [modules] Load .pcm files specified by -fmodule-file lazily.Richard Smith2014-10-271-59/+63
| | | | llvm-svn: 220731
* [modules] Support combining 'textual' with 'private'.Richard Smith2014-10-244-1/+22
| | | | llvm-svn: 220589
* Add a "signature" to AST files to verify that they haven't changedBen Langmuir2014-10-231-0/+29
| | | | | | | | | | | | | | | | | | | | | Since the order of the IDs in the AST file (e.g. DeclIDs, SelectorIDs) is not stable, it is not safe to load an AST file that depends on another AST file that has been rebuilt since the importer was built, even if "nothing changed". We previously used size and modtime to check this, but I've seen cases where a module rebuilt quickly enough to foil this check and caused very hard to debug build errors. To save cycles when we're loading the AST, we just generate a random nonce value and check that it hasn't changed when we load an imported module, rather than actually hash the whole file. This is slightly complicated by the fact that we need to verify the signature inside addModule, since we might otherwise consider that a mdoule is "OutOfDate" when really it is the importer that is out of date. I didn't see any regressions in module load time after this change. llvm-svn: 220493
* Revert accidentally-committed files in r220460.Richard Smith2014-10-234-22/+1
| | | | llvm-svn: 220461
* Refactor implementation of 'exclude header'.Richard Smith2014-10-234-1/+22
| | | | | | | | | This was not a real header role, and was never exposed to clients of ModuleMap. Remove the enumeration value for it and track it as marking the header as 'known' rather than creating an extra KnownHeader entry that *every single* client ignores. llvm-svn: 220460
* Test files I forgot to svn add in r220448.Richard Smith2014-10-223-0/+27
| | | | llvm-svn: 220449
* [modules] Add support for 'textual header' directives.Richard Smith2014-10-221-0/+9
| | | | | | | | This allows a module to specify that it logically contains a file, but that said file is non-modular and intended for textual inclusion. This allows layering checks to work properly in the presence of such files. llvm-svn: 220448
* [modules] Initial support for explicitly loading .pcm files.Richard Smith2014-10-226-2/+175
| | | | | | | | | | | | | | | Implicit module builds are not well-suited to a lot of build systems. In particular, they fare badly in distributed build systems, and they lead to build artifacts that are not tracked as part of the usual dependency management process. This change allows explicitly-built module files (which are already supported through the -emit-module flag) to be explicitly loaded into a build, allowing build systems to opt to manage module builds and dependencies themselves. This is only the first step in supporting such configurations, and it should be considered experimental and subject to change or removal for now. llvm-svn: 220359
* [modules] When building an injected-class-name type, we may have to insert itRichard Smith2014-10-215-0/+25
| | | | | | into multiple merged classes' TypeForDecl slots. llvm-svn: 220331
* [modules] Add support for #include_next.Richard Smith2014-10-208-1/+22
| | | | | | | | | | | | #include_next interacts poorly with modules: it depends on where in the list of include paths the current file was found. Files covered by module maps are not found in include search paths when building the module (and are not found in include search paths when @importing the module either), so this isn't really meaningful. Instead, we fake up the result that #include_next *should* have given: find the first path that would have resulted in the given file being picked, and search from there onwards. llvm-svn: 220177
* CodeGen: ConstStructBuilder must verify packed constraints after paddingDavid Majnemer2014-10-191-4/+4
| | | | | | | | | | | | | | | | | | This reverts commit r220169 which reverted r220153. However, it also contains additional changes: - We may need to add padding *after* we've packed the struct. This occurs when the aligned next field offset is greater than the new field's offset. When this occurs, we make the struct packed. *However*, once packed the next field offset might be less than the new feild's offset. It is in this case that we might further pad the struct. - We would pad structs which were perfectly sized! This behavior is immensely old. This behavior came from blindly subtracting NextFieldOffsetInChars from RecordSize. This doesn't take into account the fact that the struct might have a greater overall alignment than the last field. llvm-svn: 220175
* PR21215: Support -fmodule-map-file being specified multiple times. SupportRichard Smith2014-10-174-4/+13
| | | | | | loading multiple module map files from the same directory. llvm-svn: 220020
* Extend -Rmodule-build to also remark when module building finishes.Richard Smith2014-10-141-5/+10
| | | | | | | In cases of nested module builds, or when you care how long module builds take, this information was not previously easily available / obvious. llvm-svn: 219658
* [modules] Merging for class-scope using-declarations.Richard Smith2014-10-144-0/+164
| | | | llvm-svn: 219657
* [modules] When instantiating a class member, don't expect to find the previousRichard Smith2014-10-113-0/+8
| | | | | | | declaration in the instantiation if the previous declaration came from another definition of the class template that got merged into the pattern definition. llvm-svn: 219552
* [modules] Delay loading the field declared with an anonymous tag declarationRichard Smith2014-10-103-0/+17
| | | | | | until after we've had a chance to merge that tag. llvm-svn: 219539
* test: Disable standard system includes in %clang_cc1Justin Bogner2014-10-034-14/+14
| | | | | | | | | | | | | | This adds -nostdsysteminc to the %clang_cc1 expansion, which should make it harder to accidentally write tests that depend on headers in /usr/include. It also updates a few tests that use -isysroot <x> and a darwin triple to omit the triple and use -isystem <x>/usr/include instead, making them a little bit more general. Incidentally, this fixes a test failure I'm seeing on darwin in Modules/stddef.c, that happens because my system finds a stddef.h in /usr/include. llvm-svn: 219030
* Fix interaction of max_align_t and modules.Richard Smith2014-10-035-1/+33
| | | | | | | | | When building with modules enabled, we were defining max_align_t as a typedef for a different anonymous struct type each time it was included, resulting in an error if <stddef.h> is not covered by a module map and is included more than once in the same modules-enabled compilation of C11 or C++11 code. llvm-svn: 218931
* Reduce the PR20399 test case.David Blaikie2014-10-014-79/+30
| | | | | | | | | I couldn't get something /really/ obvious, and I imagine Richard Smith might be able to provide some text explaining the sequence of steps that's demonstrated by these files - but at least it's a bit simpler now. llvm-svn: 218840
* PR20399: Do not assert when adding an implicit member coming from a module atRichard Smith2014-09-306-0/+126
| | | | | | | | writing time. Patch by Vassil Vassilev! llvm-svn: 218651
* PR19692: Add (passing) regression test.Richard Smith2014-09-158-0/+25
| | | | llvm-svn: 217836
* Remove a couple of fixed paths that snuck into my test from 217550Ben Langmuir2014-09-101-2/+2
| | | | | | I forgot to fix these again the second time I copy-and-pasted. llvm-svn: 217552
* Avoid a couple of assertions when preprocessing with modulesBen Langmuir2014-09-104-0/+26
| | | | | | | | | | | | | | | | 1. We were hitting the NextIsPrevious assertion because we were trying to merge decl chains that were independent of each other because we had no Sema object to allow them to find existing decls. This is fixed by delaying loading the "preloaded" decls until Sema is available. 2. We were trying to get identifier info from an annotation token, which asserts. The fix is to special-case the module annotations in the preprocessed output printer. Fixed in a single commit because when you hit 1 you almost invariably hit 2 as well. llvm-svn: 217550
* Fix PCHs that import more than one moduleBen Langmuir2014-09-082-0/+2
| | | | | | | We were passing < to std::unique, but it expects ==. Since the input is sorted, we were always trimming it to one entry. llvm-svn: 217402
* Fix test to not write output to the test directory, as it may not be writable.David Blaikie2014-09-071-2/+2
| | | | llvm-svn: 217337
* Add -Wunused-local-typedef, a warning that finds unused local typedefs.Nico Weber2014-09-063-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The warning warns on TypedefNameDecls -- typedefs and C++11 using aliases -- that are !isReferenced(). Since the isReferenced() bit on TypedefNameDecls wasn't used for anything before this warning it wasn't always set correctly, so this patch also adds a few missing MarkAnyDeclReferenced() calls in various places for TypedefNameDecls. This is made a bit complicated due to local typedefs possibly being used only after their local scope has closed. Consider: template <class T> void template_fun(T t) { typename T::Foo s3foo; // YYY (void)s3foo; } void template_fun_user() { struct Local { typedef int Foo; // XXX } p; template_fun(p); } Here the typedef in XXX is only used at end-of-translation unit, when YYY in template_fun() gets instantiated. To handle this, typedefs that are unused when their scope exits are added to a set of potentially unused typedefs, and that set gets checked at end-of-TU. Typedefs that are still unused at that point then get warned on. There's also serialization code for this set, so that the warning works with precompiled headers and modules. For modules, the warning is emitted when the module is built, for precompiled headers each time the header gets used. Finally, consider a function using C++14 auto return types to return a local type defined in a header: auto f() { struct S { typedef int a; }; return S(); } Here, the typedef escapes its local scope and could be used by only some translation units including the header. To not warn on this, add a RecursiveASTVisitor that marks all delcs on local types returned from auto functions as referenced. (Except if it's a function with internal linkage, or the decls are private and the local type has no friends -- in these cases, it _is_ safe to warn.) Several of the included testcases (most of the interesting ones) were provided by Richard Smith. (gcc's spelling -Wunused-local-typedefs is supported as an alias for this warning.) llvm-svn: 217298
* Fix r217275 to work without the need for standard headers being includedDavid Blaikie2014-09-052-4/+0
| | | | | | | | It seems (I guess) in ObjC that va_list is provided without the need for inclusions. I verified that with this change the test still crashes in the absence of the fix committed in r217275. llvm-svn: 217290
* Move the initialization of VAListTagName after InitializeSema()Ben Langmuir2014-09-054-0/+36
| | | | | | | | | | | | | | | | | | | | This innocuous statement to get the identifier info for __va_list_tag was causing an assertion failure: NextIsPrevious() && "decl became non-canonical unexpectedly" if the __va_list_tag identifier was found in a PCH in some circumstances, because it was looked up before the ASTReader had a Sema object to use to find existing decls to merge with. We could possibly move getting the identifier info even later, or make it lazy if we wanted to, but this seemed like the minimal change. Now why a PCH would have this identifier in the first place is a bit mysterious. This seems to be related to the global module index in some way, because when the test case is built without the global module index it will not emit an identifier for __va_list_tag into the PCH, but with the global module index it does. llvm-svn: 217275
* [modules] Make NamespaceAliasDecl redeclarable, as it should be. This fixesRichard Smith2014-09-033-0/+8
| | | | | | | merging of namespace aliases across modules and improves source fidelity. Incidentally also fixes PR20816. llvm-svn: 217103
* [modules] Use DeclContext::equals rather than == on DeclContext* whenRichard Smith2014-09-034-4/+31
| | | | | | | | | | determining whether a declaration is out of line, instead of assuming that the semantic and lexical DeclContext will be the same declaration whenever they're the same entity. This fixes behavior of declarations within merged classes and enums. llvm-svn: 217008
* [modules] Fix deserialization cycle when loading a tag declaration with a ↵Richard Smith2014-08-303-0/+19
| | | | | | typedef name for linkage purposes. When loading the type, delay loading its typedef until we've finished loading and merging the type. In its place, save out the name of the typedef, which we need for merging purposes. llvm-svn: 216806
* Add some missing test coverage for merging 'extern "C"' functions with modules.Richard Smith2014-08-295-0/+15
| | | | llvm-svn: 216796
* Oops, use correct RUN: line for test.Richard Smith2014-08-281-2/+2
| | | | llvm-svn: 216685
* [modules] PR20786: add (already passing) regression test from the bug report.Richard Smith2014-08-286-0/+21
| | | | llvm-svn: 216683
* [modules] When completing the redecl chain for an anonymous declaration in aRichard Smith2014-08-286-4/+19
| | | | | | | merged context, pull in the lexical decls in that context, since one of them may complete the redecl chain. llvm-svn: 216652
* [modules] Number anonymous declarations that are lexically within mergeableRichard Smith2014-08-284-0/+16
| | | | | | contexts, so that we can merge them when we merge the surrounding context. llvm-svn: 216639
* [modules] Don't assert when merging virtual functions that override otherRichard Smith2014-08-263-0/+18
| | | | | | | functions. Also don't needlessly pull in non-canonical declarations of the overridden virtual functions. llvm-svn: 216503
* [modules] Track the described template in an alias declaration that is theRichard Smith2014-08-264-0/+10
| | | | | | | pattern of an alias template declaration. Use this to merge alias templates properly when they're members of class template specializations. llvm-svn: 216437
* Fix typo.Richard Smith2014-08-253-0/+6
| | | | llvm-svn: 216417
* [modules] Fix false report of an ODR violation when merging friendRichard Smith2014-08-253-1/+16
| | | | | | | | | | declarations. We can't expect to find them in the canonical definition of the class, because that's not where they live. This means we no longer reject real ODR violations with friend declarations, but we weren't consistently doing so anyway. llvm-svn: 216369
* [modules] When merging a tag declaration that has a typedef name for linkageRichard Smith2014-08-233-0/+17
| | | | | | | purposes, look for other typedefs with that same name and merge into their named tag declaration if there is one. llvm-svn: 216312
* [modules] Put class template declarations into the scope in which they'reRichard Smith2014-08-233-0/+20
| | | | | | | | | | | declared, rather than putting them into the template parameter scope. We previously had *no record* in the scope for class template declarations, once those declarations completed and their template parameter scopes were popped. This in turn caused us to be unable to merge class template declarations that were declared in the global scope (where we use scope lookup rather than DeclContext lookup for merging), when loading a module. llvm-svn: 216311
* [modules] Turn off a broken optimization: we need to pick up implicit specialRichard Smith2014-08-143-0/+55
| | | | | | | members from all redefinitions of a class that have them, in case the special member is defined in one module but only declared in another. llvm-svn: 215675
* [modules] Don't assert if the same imported class template specializationRichard Smith2014-08-143-0/+6
| | | | | | | declaration has its definition instantiated in two sibling modules and they use a partial specialization. llvm-svn: 215616
* [modules] When we merge together multiple class template specializationRichard Smith2014-08-144-0/+8
| | | | | | | | | | definitions (because some other declaration declares a special member that isn't present in the canonical definition), we need to search *all* of them; we can't just stop when we find the requested name in any of the definitions, because that can fail to find things (and in particular, it can fail to find the member of the canonical declaration and return a bogus ODR failure). llvm-svn: 215612
* clang/test/Modules/cxx-irgen.cpp: Let it tolerant of x86_thiscallcc.NAKAMURA Takumi2014-08-141-4/+4
| | | | llvm-svn: 215607
* [modules] Fix a rejects-valid resulting from emitting an inline functionRichard Smith2014-08-132-0/+28
| | | | | | | | recursively within the emission of another inline function. This ultimately led to us emitting the same inline function definition twice, which we then rejected because we believed we had a mangled name conflict. llvm-svn: 215579
* Default getFile() to use the last accessed name in the FileEntry.Manuel Klimek2014-08-133-0/+13
| | | | | | | | | | | | With modules we start accessing headers for the first time while reading the module map, which often has very different paths from the include scanning logic. Using the name by which the file was accessed gets us one step closer to the right solution, which is using a FileName abstraction that decouples the name by which a file was accessed from the FileEntry. llvm-svn: 215541
* [modules] When performing a lookup into a namespace, ensure that any laterRichard Smith2014-08-139-2/+33
| | | | | | | | | | redefinitions of that namespace have already been loaded. When writing out the names in a namespace, if we see a name that is locally declared and had imported declarations merged on top of it, export the local declaration as the lookup result, because it will be the most recent declaration of that entity in the redeclaration chain of an importer of the module. llvm-svn: 215518
OpenPOWER on IntegriCloud