summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
Commit message (Collapse)AuthorAgeFilesLines
...
* Update ODR hashing testsRichard Trieu2017-11-041-120/+723
| | | | | | | | Add a mix of postive and negative tests to check that wrong Decls won't be flagged in the diagnostic. Split the check everything test and moved the pieces closer to where the related tests are. llvm-svn: 317394
* Modular Codegen: Don't home always_inline functionsDavid Blaikie2017-11-023-1/+9
| | | | | | | | Since they'll likely (not always - if the address is taken, etc) be inlined away, even at -O0, separately provided weak definitions are likely to be unused so skip all of that. llvm-svn: 317279
* Modular Codegen: Don't home/modularize static functions in headersDavid Blaikie2017-11-021-3/+9
| | | | | | | | | | | | | | | | Consistent with various workarounds in the backwards compatible modules that allow static functions in headers to exist, be deduplicated to some degree, and not generally fail right out of the gate... do the same with modular codegen as there are enough cases (including in libstdc++ and in LLVM itself - though I cleaned up the easy ones) that it's worth supporting as a migration/backcompat step. Simply create a separate, internal linkage function in each object that needs it. If an available_externally/modularized function references a static function, but the modularized function is eventually dropped and not inlined, the static function will be dropped as unreferenced. llvm-svn: 317274
* PR33746: Store the 'inline'ness of a static data member with the update recordRichard Smith2017-11-021-0/+30
| | | | | | | | | for instantiating its definition. We model the 'inline'ness as being instantiated with the static data member in order to track whether the declaration has become a definition yet. llvm-svn: 317147
* [modules] Retain multiple using-directives in the same scope even if they ↵Richard Smith2017-10-301-0/+37
| | | | | | | | | | | | name the same namespace. They might have different visibility, and thus discarding all but one of them can result in rejecting valid code. Also fix name lookup to cope with multiple using-directives being found that denote the same namespace, where some are not visible -- don't cache an "already visited" state for a using-directive that we didn't visit because it was hidden. llvm-svn: 316965
* [modules] Add a regression test for merging anon decls in extern C contexts.Vassil Vassilev2017-10-241-0/+19
| | | | llvm-svn: 316444
* [modules] When finding the owning module of an instantiated context in templateRichard Smith2017-10-181-0/+51
| | | | | | | instantiation, follow lexical parents not semantic ones: we want to find the module where the pattern was written. llvm-svn: 316055
* Revert r314955: "Remove PendingBody mechanism for function and ObjC method ↵Daniel Jasper2017-10-111-43/+0
| | | | | | | | | | | deserialization." This is breaking a build of https://github.com/abseil/abseil-cpp and so likely not really NFC. Also reverted subsequent r314956/7. I'll forward reproduction instructions to Richard. llvm-svn: 315439
* [modules] Fix visibility checking for using declarations via ADL.Richard Smith2017-10-111-0/+40
| | | | | | | We want to check whether the using (shadow) declaration itself is visible, not whether its target is visible. llvm-svn: 315408
* [modules] Only take visible using-directives into account during name lookup.Richard Smith2017-10-111-0/+62
| | | | llvm-svn: 315402
* [Modules TS] Module ownership semantics for redeclarations.Richard Smith2017-10-101-0/+12
| | | | | | | | | | | | | | | | | When declaring an entity in the "purview" of a module, it's never a redeclaration of an entity in the purview of a default module or in no module ("in the global module"). Don't consider those other declarations as possible redeclaration targets if they're not visible, and reject any cases where we pick a prior visible declaration that violates this rule. This reinstates r315251 and r315256, reverted in r315309 and r315308 respectively, tweaked to avoid triggering a linkage calculation when declaring implicit special members (this exposed our pre-existing issue with typedef names for linkage changing the linkage of types whose linkage has already been computed and cached in more cases). A testcase for that regression has been added in r315366. llvm-svn: 315379
* Revert "[Modules TS] Avoid computing the linkage of the enclosing ↵Eric Liu2017-10-101-12/+0
| | | | | | | | DeclContext for a declaration in the global module." This reverts commit r315256. See the original commit thread for reason. llvm-svn: 315308
* [Modules TS] Avoid computing the linkage of the enclosing DeclContext for a ↵Richard Smith2017-10-101-0/+12
| | | | | | | | | | declaration in the global module. This works around a language issue where adding a typedef name for linkage purposes changes the linkage of an already-defined class after it becomes complete. llvm-svn: 315256
* Add testcase for r314956:Richard Smith2017-10-051-0/+43
| | | | | PR33924: Merge block-scope anonymous declarations if there are multiple definitions of the enclosing function. llvm-svn: 314957
* [ODRHash] Add base classes to hashing CXXRecordDecl.Richard Trieu2017-09-301-0/+120
| | | | llvm-svn: 314581
* [test] Disable leak checking on a clang crash test on DarwinFrancis Ricci2017-09-291-0/+1
| | | | | | | | | | | | Suspected failure due to LSan's atexit and exit interception behavior. Reviewers: kcc, kubamracek, bogner, hfinkel, alekseyshl, Hahnfeld, gtbercea Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37810 llvm-svn: 314526
* Fix Modules/{builtin-import.mm,umbrella-header-include-builtin.mm} to be ↵Filipe Cabecinhas2017-09-292-6/+2
| | | | | | | | | | | | | | able to handle non-Darwin targets Summary: Also makes them pass on Darwin, if the default target triple is a Linux triple. Reviewers: bruno, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D38364 llvm-svn: 314524
* Extend -ast-dump for CXXRecordDecl to dump the flags from the DefinitionData.Richard Smith2017-09-221-0/+14
| | | | llvm-svn: 313943
* [Module map] Introduce a private module re-export directive.Douglas Gregor2017-09-142-0/+18
| | | | | | | | | | | | | Introduce a new "export_as" directive for top-level modules, which indicates that the current module is a "private" module whose symbols will eventually be exported through the named "public" module. This is in support of a common pattern in the Darwin ecosystem where a single public framework is constructed of several private frameworks, with (currently) header duplication and some support from the linker. Addresses rdar://problem/34438420. llvm-svn: 313316
* [modules] Add test for using declaration in classes.Raphael Isemann2017-08-291-0/+34
| | | | | | | | | | | | | | | | | Summary: This adds a test that checks if the using declaration in classes still works as intended with modules. The motivation for this is that we tried to add a shortcut to `removeDecl` that would skip the removal of declarations from the lookup table if they are hidden. This optimization passed the clang test suite but actually broke the using declaration in combination with -fmodules-local-submodule-visibility. In this mode we hide all decls from other modules such as by chance the parent method, in which case don't remove the parent method from the lookup table and get ambiguous lookup errors. After this patch we now correctly see if this behavior is broken by a patch like this in the test suite. Reviewers: v.g.vassilev Reviewed By: v.g.vassilev Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D37180 llvm-svn: 311991
* [ODRHash] Diagnose differing template parameters.Richard Trieu2017-08-231-0/+77
| | | | llvm-svn: 311519
* [clang] Get rid of "%T" expansionsKuba Mracek2017-08-152-4/+5
| | | | | | | | | | The %T lit expansion expands to a common directory shared between all the tests in the same directory, which is unexpected and unintuitive, and more importantly, it's been a source of subtle race conditions and flaky tests. In https://reviews.llvm.org/D35396, it was agreed that it would be best to simply ban %T and only keep %t, which is unique to each test. When a test needs a temporary directory, it can just create one using mkdir %t. This patch removes %T in clang. Differential Revision: https://reviews.llvm.org/D36437 llvm-svn: 310950
* Revert "[Modules] Prevent #import to reenter header if not building a module."Bruno Cardoso Lopes2017-08-122-14/+0
| | | | | | | This reverts commit r310605. Richard pointed out a better way to achieve this, which I'll post a patch for soon. llvm-svn: 310775
* [modules] Set the lexical DC for dummy tag decls that refer to hiddenAlex Lorenz2017-08-113-0/+27
| | | | | | | | | | | | | | declarations that are made visible after the dummy is parsed and ODR verified Prior to this commit the "(getContainingDC(DC) == CurContext && "The next DeclContext should be lexically contained in the current one.")," assertion failure was triggered during semantic analysis of the dummy tag declaration that was declared in another tag declaration because its lexical context did not point to the outer tag decl. rdar://32292196 llvm-svn: 310706
* [Modules] Prevent #import to reenter header if not building a module.Bruno Cardoso Lopes2017-08-102-0/+14
| | | | | | | | | | When non-modular headers are imported while not building a module but in -fmodules mode, be conservative and preserve the default #import semantic: do not reenter headers. rdar://problem/33745031 llvm-svn: 310605
* Fix incorrect use of current directory to find moved paths in ASTReader.Manuel Klimek2017-07-251-0/+70
| | | | | | | | | | | | | | | | | | | | | CurrentDir was set as the path of the current module, but that can change as part of a chain of loaded modules. When we try to locate a file mentioned in a module that does not exist, we use a heuristic to look at the relative path between the original location of the module and the file we look for, and use that relatively to the CurrentDir. This only works if CurrentDir is the same as the (current) path of the module file the file was mentioned in; if it is not, we look at the path relatively to the wrong directory, and can end up reading random unrelated files that happen to have the same name. This patch fixes this by using the BaseDirectory of the module file the file we look for was mentioned in instead of the CurrentDir heuristic. Differential Revision: https://reviews.llvm.org/D35828 llvm-svn: 308962
* Debug Info: Avoid completing class types when a definition is in a module.Adrian Prantl2017-07-243-6/+20
| | | | | | | | | | This patch adds an early exit to CGDebugInfo::completeClassData() when compiling with -gmodules and the to-be-completed type is available in a clang module. rdar://problem/23599990 llvm-svn: 308938
* Update for LLVM IR metadata changes (DIImportedEntity now needs a DIFile).Adrian Prantl2017-07-196-5/+37
| | | | | | | | | <rdar://problem/33357889> https://bugs.llvm.org/show_bug.cgi?id=33822 Differential Revision: https://reviews.llvm.org/D35583 llvm-svn: 308399
* Debug Info: Set the MainFileName when generating -gmodules debug info for PCM.Adrian Prantl2017-07-181-2/+4
| | | | | | | Previously it was uninitialized and thus always defaulted to "<stdin>". This is mostly a cosmetic change that helps making the debug info more readable. llvm-svn: 308397
* [ODRHash] Revert r307743 which reverted r307720Richard Trieu2017-07-151-0/+69
| | | | | | | Reapply r307720 to allow processing of constructors and destructors. Reuse the diagnostics for CXXMethodDecl for them. llvm-svn: 308077
* [ODRHash] Avoid taking the types of FunctionDecl'sRichard Trieu2017-07-141-0/+14
| | | | | | | | FunctionDecl already hashes most of the information in the function's type. Add hashing of the return type, and skip hashing the function's type to avoid redundancy and extra work when computing the hash. llvm-svn: 307986
* [ODRHash] Revert r307720 to fix buildbot.Richard Trieu2017-07-121-69/+0
| | | | llvm-svn: 307743
* [ODRHash] Support more method types.Richard Trieu2017-07-111-0/+69
| | | | | | | Hash CXXConstructorDecl and CXXDestructorDecl. Extend the diagnostics from CXXMethodDecl to include constructors and destructors. llvm-svn: 307720
* [ODRHash] Support FriendDeclRichard Trieu2017-07-081-0/+78
| | | | llvm-svn: 307458
* Reject attempts to build a module without -fmodules, rather than silently ↵Richard Smith2017-07-063-11/+16
| | | | | | doing weird things. llvm-svn: 307316
* [ODRHash] Revert r305104 - Skip inline namespaces when hashing.Richard Trieu2017-07-011-0/+18
| | | | | | Test inline namespaces and handle them in the ODR hash again. llvm-svn: 306926
* [Modules] Implement ODR-like semantics for tag types in C/ObjCBruno Cardoso Lopes2017-07-017-13/+86
| | | | | | | | | | | | | | | | | | | | | | Allow ODR for ObjC/C in the sense that we won't keep more that one definition around (merge them). However, ensure the decl pass the structural compatibility check in C11 6.2.7/1, for that, reuse the structural equivalence checks used by the ASTImporter. Few other considerations: - Create error diagnostics for tag types mismatches and thread them into the structural equivalence checks. - Note that by doing this we only support redefinition between types that are considered "compatible types" by C. This is mixed approach of the suggestions discussed in http://lists.llvm.org/pipermail/cfe-dev/2017-March/053257.html Differential Revision: https://reviews.llvm.org/D31778 rdar://problem/31909368 llvm-svn: 306918
* [ODRHash] Support Type TemplateArgumentRichard Trieu2017-06-301-0/+34
| | | | llvm-svn: 306904
* [ODRHash] Improve typedef handling.Richard Trieu2017-06-291-0/+16
| | | | | | | Follow typedef chains to find the root type when processing types, and also keep track of qualifiers. llvm-svn: 306753
* [ASTReader] Add test for previous change r306583 / 145692e.Graydon Hoare2017-06-295-0/+29
| | | | | | | | | | | | | | | | | | | | Summary: Add a test for the change to ASTReader that reproduces the logic for consolidating multiple ObjC interface definitions to the case of multiple ObjC protocol definitions. This test is a modified copy of the test that accompanied the original change to interfaces, in 2ba1979. Reviewers: bruno Reviewed By: bruno Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D34788 llvm-svn: 306732
* Track the set of module maps read while building a .pcm file and reload ↵Richard Smith2017-06-296-0/+23
| | | | | | those when preprocessing from that .pcm file. llvm-svn: 306628
* Fix this test to use a construct that actually forces struct layout to ↵Richard Smith2017-06-271-1/+1
| | | | | | happen when testing -Wpadded. llvm-svn: 306349
* When preprocessing with -frewrite-imports and -fmodule-file=, do not pass allRichard Smith2017-06-265-16/+38
| | | | | | | | | | | modules to preprocessing of nested .pcm files. Making those module files available results in loading more .pcm files than necessary, and potentially in misbehavior if a module makes itself visible during its own compilation (as parts of that module that have not yet been processed would then become visible). llvm-svn: 306320
* Testcase missed from r306075.Richard Smith2017-06-261-0/+29
| | | | llvm-svn: 306270
* PR33002: When we instantiate the definition of a static data member, we mightRichard Smith2017-06-221-0/+30
| | | | | | | have attached an initializer to the in-class declaration. If so, include the initializer in the update record for the instantiation. llvm-svn: 306065
* Support non-identifier module names when preprocessing modules.Richard Smith2017-06-191-0/+4
| | | | llvm-svn: 305758
* [ODRHash] Hash VarDecl members.Richard Trieu2017-06-161-2/+177
| | | | | | | These VarDecl's are static data members of classes. Since the initializers are also hashed, this also provides checking for default arguments to methods. llvm-svn: 305543
* [ODRHash] Hash TemplateArgument::Pack and TemplateTypeParmTypeRichard Trieu2017-06-151-0/+41
| | | | llvm-svn: 305440
* [ODRHash] Hash Template and TemplateExpansion in TemplateArgument.Richard Trieu2017-06-141-0/+18
| | | | llvm-svn: 305361
* [ODRHash] Hash Expr for TemplateArgument::ExpressionRichard Trieu2017-06-141-0/+33
| | | | llvm-svn: 305360
OpenPOWER on IntegriCloud