summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
Commit message (Collapse)AuthorAgeFilesLines
...
* [VFS] Add support for handling path traversalsBruno Cardoso Lopes2016-02-222-0/+130
| | | | | | | | | | | | | | | | | | | | | | Handle ".", ".." and "./" with trailing slashes while collecting files to be dumped into the vfs overlay directory. Include the support for symlinks into components. Given the path: /install-dir/bin/../lib/clang/3.8.0/include/altivec.h, if "bin" component is a symlink, it's not safe to use `path::remove_dots` here, and `realpath` is used to get the right answer. Since `realpath` is expensive, we only do it at collecting time (which only happens during the crash reproducer) and cache the base directory for fast lookups. Overall, this makes the input to the VFS YAML file to be canonicalized to never contain traversal components. Differential Revision: http://reviews.llvm.org/D17104 rdar://problem/24499339 llvm-svn: 261551
* [modules] Flatten -fmodule-name= and -fmodule-implementation-of= into a singleRichard Smith2016-02-194-12/+8
| | | | | | | | | | | | option. Previously these options could both be used to specify that you were compiling the implementation file of a module, with a different set of minor bugs in each case. This change removes -fmodule-implementation-of, and instead tracks a flag to determine whether we're currently building a module. -fmodule-name now behaves the same way that -fmodule-implementation-of previously did. llvm-svn: 261372
* [Modules] Early-exit if ReadOptionsBlock fails to avoid crashingBen Langmuir2016-02-111-0/+6
| | | | | | | | | | | | | | | If we didn't tell ReadOptionsBlock to allow failures then we can't assume that the stream is not in the middle of a block if it returns out-of-date. This was causing a crash when we tried to continue reading. Also, it's just generally a good idea to early-exit if we're doing implicit module builds, since we will want to immediately rebuild this module anyway and there's no reason to waste time continuing after failure. rdar://problem/24114938 llvm-svn: 260563
* Remove some unnecessary CHECK-SAMEs in ModuleDebugInfo.{cpp,m}.Justin Lebar2016-02-102-2/+0
| | | | | | Suggested by Paul Robinson. llvm-svn: 260346
* Get rid of CHECK-SAME-NOT in tests.Justin Lebar2016-02-102-15/+26
| | | | | | | | | | | | Summary: This isn't a FileCheck directive; it does nothing. Reviewers: jroelofs Subscribers: cfe-commits, majnemer Differential Revision: http://reviews.llvm.org/D17051 llvm-svn: 260334
* [modules] Compress files embedded into a .pcm file, to reduce the disk usage ↵Richard Smith2016-02-061-0/+23
| | | | | | of -fembed-all-files mode. llvm-svn: 259976
* [modules] Separately track whether an identifier's preprocessor information andRichard Smith2016-02-051-0/+10
| | | | | | | | | | name lookup information have changed since deserialization. For a C++ modules build, we do not need to re-emit the identifier into the serialized identifier table if only the name lookup information has changed (and in all cases, we don't need to re-emit the macro information if only the name lookup information has changed). llvm-svn: 259901
* Don't synthesize an ImportDecl for a module named in -fmodule-implementation-ofBen Langmuir2016-02-052-1/+2
| | | | | | | | | | When building a PCH with modules enabled this import would assert in the ASTWriter and (if assertions were disabled) sometimes crash the compiler that loaded the resulting PCH when trying to lookup the submodule ID. rdar://problem/24137448 llvm-svn: 259859
* Fix predefine for __NSConstantString struct typeBen Langmuir2016-02-042-5/+4
| | | | | | | | | | | | | | | | | Per review feedback the name was wrong and it can be used outside Objective-C. Unfortunately, making the internal struct visible broke some ASTMatchers tests that assumed that the first record decl would be from user code, rather than a builtin type. I'm worried that this will also affect users' code. So this patch adds a typedef to wrap the internal struct and only makes the typedef visible to namelookup. This is sufficient to allow the ASTReader to merge the decls we need without making the struct itself visible. rdar://problem/24425801 llvm-svn: 259734
* Reapply r259624, it is likely not the commit causing the bot failures.Quentin Colombet2016-02-032-8/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original message: Make CF constant string decl visible to name lookup to fix module errors The return type of the __builtin___*StringMakeConstantString functions is a pointer to a struct, so we need that struct to be visible to name lookup so that we will correctly merge multiple declarations of that type if they come from different modules. Incidentally, to make this visible to name lookup we need to rename the type to __NSConstantString, since the real NSConstantString is an Objective-C interface type. This shouldn't affect anyone outside the compiler since users of the constant string builtins cast the result immediately to CFStringRef. Since this struct type is otherwise implicitly created by the AST context and cannot access namelookup, we make this a predefined type and initialize it in Sema. Note: this issue of builtins that refer to types not visible to name lookup technically also affects other builtins (e.g. objc_msgSendSuper), but in all other cases the builtin is a library builtin and the issue goes away if you include the library that defines the types it uses, unlike for these constant string builtins. rdar://problem/24425801 llvm-svn: 259721
* Revert r259624 - Make CF constant string decl visible to name lookup to fix ↵Quentin Colombet2016-02-032-25/+8
| | | | | | | | | module errors. This breaks some internal bots in stage2: clang seg fault. Looking with Ben to see what is going on. llvm-svn: 259715
* Make CF constant string decl visible to name lookup to fix module errorsBen Langmuir2016-02-032-8/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | The return type of the __builtin___*StringMakeConstantString functions is a pointer to a struct, so we need that struct to be visible to name lookup so that we will correctly merge multiple declarations of that type if they come from different modules. Incidentally, to make this visible to name lookup we need to rename the type to __NSConstantString, since the real NSConstantString is an Objective-C interface type. This shouldn't affect anyone outside the compiler since users of the constant string builtins cast the result immediately to CFStringRef. Since this struct type is otherwise implicitly created by the AST context and cannot access namelookup, we make this a predefined type and initialize it in Sema. Note: this issue of builtins that refer to types not visible to name lookup technically also affects other builtins (e.g. objc_msgSendSuper), but in all other cases the builtin is a library builtin and the issue goes away if you include the library that defines the types it uses, unlike for these constant string builtins. rdar://problem/24425801 llvm-svn: 259624
* Module Debugging: Canonicalize the file names used as PCH module namesAdrian Prantl2016-01-222-2/+2
| | | | | | | | | | | by stripping the path. Follow-up to r258555. This is safe because only one PCH per CU is currently supported for module debugging. rdar://problem/24301262 llvm-svn: 258582
* Module debugging: Create a parent DIModule with the PCH name for typesAdrian Prantl2016-01-221-45/+50
| | | | | | | | | emitted into a precompiled header to mirror the debug info emitted for object files importing the PCH. rdar://problem/24290667 llvm-svn: 258555
* Rephrase this test to help debug a buildbot issueAdrian Prantl2016-01-221-1/+2
| | | | llvm-svn: 258526
* Merge templated static member variables, fixes http://llvm.org/pr26179.Yaron Keren2016-01-225-0/+36
| | | | | | | Patch by Vassil Vassilev! Reviewed by Richard Smith. llvm-svn: 258524
* Fix a typo in r258507 and change the PCH dwoid constant to ~1UL.Adrian Prantl2016-01-221-1/+2
| | | | | | rdar://problem/24290667 llvm-svn: 258519
* Fix 80-column violations.Adrian Prantl2016-01-221-3/+6
| | | | llvm-svn: 258518
* Module Debugging: Use a nonzero DWO id for precompiled headers.Adrian Prantl2016-01-222-2/+5
| | | | | | | | | | | | | PCH files don't have a module signature and LLVM uses a nonzero DWO id as an indicator for skeleton / module CUs. This change pins the DWO id for PCH files to a known constant value. The correct long-term solution here is to implement a module signature that is an actual dterministic hash (at the moment module signatures are just random nonzero numbers) and then enable this for PCH files as well. <rdar://problem/24290667> llvm-svn: 258507
* Module Debugging: Fine-tune the condition that determines whether a typeAdrian Prantl2016-01-203-1/+19
| | | | | | | | | | | | | can be found in a module. There are externally visible anonymous types that can be found: typedef struct { } s; // I can be found via the typedef. There are anonymous internal types that can be found: namespace { struct s {}; } // I can be found by name. rdar://problem/24199640 llvm-svn: 258272
* Module Debugging: Add Objective-C testcases for anonymous tag decls. (NFC)Adrian Prantl2016-01-193-0/+75
| | | | | | rdar://problem/24199640 llvm-svn: 258252
* Module Debugging: Don't emit external type references to anonymous types.Adrian Prantl2016-01-191-0/+9
| | | | | | | | Even if they exist in the module, they can't be matched with the forward declaration in the object file. <rdar://problem/24199640> llvm-svn: 258251
* Module Debugging: Make sure that anonymous tag decls that define globalAdrian Prantl2016-01-193-0/+24
| | | | | | | | | variables are visited. This shouldn't encourage anyone to put global variables into clang modules. rdar://problem/24199640 llvm-svn: 258250
* Module Debugging: Defer the emission of anonymous tag declsAdrian Prantl2016-01-193-0/+27
| | | | | | | | | | | | | until we are visiting their declcontext. This fixes a regression introduced in r256962: When building debug info for a typdef'd anonymous tag type, we would be visiting the inner anonymous type first thus creating a "typedef changes linkage of anonymous type, but linkage was already computed" error. rdar://problem/24199640 llvm-svn: 258152
* [modules] Don't diagnose a conflict between two using-declarations that name ↵Richard Smith2016-01-124-4/+17
| | | | | | equivalent internal linkage entities. llvm-svn: 257512
* When a tag is declared in prototype scope in C, if we've decided that itRichard Smith2016-01-111-0/+18
| | | | | | | | | | | | | | redeclares an existing tag but are creating a new declaration anyway (because it has attributes or changes the visibility of the name), don't warn that it won't be visible outside the current scope. That's not true. Also narrow down the set of cases where we create these extra declarations when building modules; previously, all tag declarations but the first in a module header would get this treatment if -fmodules-local-submodule-visibility. (This isn't a functional change, but we try to avoid creating these extra declarations whenever we can.) llvm-svn: 257403
* [modules] If we're treating an elaborated-type-specifier as if it introduces aRichard Smith2016-01-091-2/+5
| | | | | | | | tag (because the previous declaration was found in a different module), inject the tag into the appropriate scope (that is, the enclosing scope if we're in a function prototype scope in C++). llvm-svn: 257251
* Module debugging: Add a testcase for standalone forward declarations.Adrian Prantl2016-01-092-0/+6
| | | | llvm-svn: 257241
* [modules] Make sure we always include the contents of private headers whenRichard Smith2016-01-083-3/+5
| | | | | | | | | | building a module. Prior to this change, the private header's content would only be included if the header were included by another header in the same module. If not (if the private header is only used by the .cc files of the module, or is included from outside the module via -Wno-private-header), a #include of that file would be silently ignored. llvm-svn: 257222
* Fix a typo.Adrian Prantl2016-01-061-1/+1
| | | | llvm-svn: 256963
* Module debugging: Defer emitting tag types until their definitionAdrian Prantl2016-01-062-6/+20
| | | | | | | | | was visited and all decls have been merged. We only get a single chance to emit the types for virtual classes because CGDebugInfo::completeRequiredType() categorically doesn't complete them. llvm-svn: 256962
* [modules] When a tag type that was imported from a module is referenced via anRichard Smith2016-01-061-0/+22
| | | | | | | elaborated-type-specifier, create a declaration of it to track that the current module makes it visible too. llvm-svn: 256907
* Fix a typo in testcase and increase its coverage!Adrian Prantl2016-01-051-1/+1
| | | | llvm-svn: 256874
* [modules] Don't try to use the definition of a class ifRichard Smith2015-12-183-4/+20
| | | | | | | RequireCompleteType(..., 0) says we're not permitted to do so. The definition might not be visible, even though we know what it is. llvm-svn: 256045
* Allow non-defining declarations of class template partial specializations toRichard Smith2015-12-111-0/+7
| | | | | | | | | have a nested name specifier. Strictly speaking, forward declarations of class template partial specializations are not permitted at all, but that seems like an obvious wording defect, and if we allow them without a nested name specifier we should also allow them with a nested name specifier. llvm-svn: 255383
* Reapply "[Modules] Fix regression when an elaborated-type-specifier mentions ↵Ben Langmuir2015-12-113-0/+28
| | | | | | | | | a hidden tag" Now not trying to use a C++ lookup mechanism in C (d'oh). Unqualified lookup is actually fine for this case in C. llvm-svn: 255377
* Revert "[Modules] Fix regression when an elaborated-type-specifier mentions ↵Ben Langmuir2015-12-113-28/+0
| | | | | | | | | | a hidden tag" This is causing assertion failures; reverting until I can fix. This reverts commit r255267 llvm-svn: 255324
* [Modules] Fix regression when an elaborated-type-specifier mentions a hidden tagBen Langmuir2015-12-103-0/+28
| | | | | | | | | This makes non-C++ languages find the same decl as C++ does to workaround a regression introduced in r252960. rdar://problem/23784203 llvm-svn: 255267
* [modules] Don't reject multiple modules providing contents for the same ↵Richard Smith2015-12-011-0/+15
| | | | | | embedded file. llvm-svn: 254365
* [modules] Add -cc1 flag -fmodules-embed-all-files.Richard Smith2015-11-241-1/+6
| | | | | | | | | | | | | | This flag causes all files that were read by the compilation to be embedded into a produced module file. This is useful for distributed build systems that use an include scanning system to determine which files are "needed" by a compilation, and only provide those files to remote compilation workers. Since using a module can require any file that is part of that module (or anything it transitively includes), files that are not found by an include scanner can be required in a regular build using explicit modules. With this flag, only files that are actually referenced by transitively-#included files are required to be present on the build machine. llvm-svn: 253950
* Revert "Change memcpy/memset/memmove to have dest and source alignments."Pete Cooper2015-11-191-2/+2
| | | | | | | | | | This reverts commit r253512. This likely broke the bots in: http://lab.llvm.org:8011/builders/clang-ppc64-elf-linux2/builds/20202 http://bb.pgr.jp/builders/clang-3stage-i686-linux/builds/3787 llvm-svn: 253542
* Change memcpy/memset/memmove to have dest and source alignments.Pete Cooper2015-11-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | This is a follow on from a similar LLVM commit: r253511. Note, this was reviewed (and more details are in) http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html These intrinsics currently have an explicit alignment argument which is required to be a constant integer. It represents the alignment of the source and dest, and so must be the minimum of those. This change allows source and dest to each have their own alignments by using the alignment attribute on their arguments. The alignment argument itself is removed. The only code change to clang is hidden in CGBuilder.h which now passes both dest and source alignment to IRBuilder, instead of taking the minimum of dest and source alignments. Reviewed by Hal Finkel. llvm-svn: 253512
* [modules] When a #include is mapped to a module import and appears somewhereRichard Smith2015-11-171-1/+13
| | | | | | | | | | | | | | other than the top level, we issue an error. This breaks a fair amount of C++ code wrapping C libraries, where the C library is #included within a namespace / extern "C" combination, because the C library (probably) includes C++ standard library headers which may be within modules. Without modules, this setup is harmless if (and *only* if) the corresponding standard library module was already included outside the namespace, so downgrade the error to a default-error extension in that case, so that it can be selectively disabled for such misbehaving libraries. llvm-svn: 253398
* [modules] Fix some more cases where we used to reject a conflict between twoRichard Smith2015-11-172-0/+31
| | | | | | | declarations that are not simultaneously visible, and where at least one of them has internal/no linkage. llvm-svn: 253283
* [modules] Allow "redefinition" of typedef of anon tag from unimported submoduleBen Langmuir2015-11-144-0/+17
| | | | | | | | | r233345 started being stricter about typedef names for linkage purposes in non-visible modules, but broke languages without the ODR. rdar://23527954 llvm-svn: 253123
* Fix auto-link for text-based dynamic library SDKs.Juergen Ributzka2015-11-133-0/+19
| | | | | | | | | | When linking against text-based dynamic library SDKs the library name of a framework has now more than one possible filename extensions. This fix tests for both possible extensions (none, and .tbd). This fixes rdar://problem/20609975 llvm-svn: 253060
* [modules] When a declaration has non-trivial visibility, check whether it'sRichard Smith2015-11-131-0/+7
| | | | | | | actually hidden before we check its linkage. This avoids computing the linkage "too early" for an anonymous struct with a typedef name for linkage. llvm-svn: 253012
* [modules] Follow the C++ standard's rule for linkage of enumerators: they haveRichard Smith2015-11-133-5/+8
| | | | | | | | | the linkage of the enumeration. For enumerators of unnamed enumerations, extend the -Wmodules-ambiguous-internal-linkage extension to allow selecting an arbitrary enumerator (but only if they all have the same value, otherwise it's ambiguous). llvm-svn: 253010
* Avoid duplicated diagnostic when lookup for a nested-name-specifier fails ↵Richard Smith2015-11-121-1/+1
| | | | | | due to ambiguity. llvm-svn: 252967
* [modules] Simplify and generalize the existing rule for finding hiddenRichard Smith2015-11-129-21/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud