summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
Commit message (Collapse)AuthorAgeFilesLines
* CodeGen: fix autolink emission on ELFSaleem Abdulrasool2019-01-051-2/+2
| | | | | | | | | The autolinking extension for ELF uses a slightly different format for encoding the autolink information compared to COFF and MachO. Account for this in the CGM to ensure that we do not assert when emitting assembly or an object file. llvm-svn: 350476
* Reapply "Avoid emitting redundant or unusable directories in DIFile metadata ↵Adrian Prantl2018-12-061-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | entries."" This reverts commit r348280 and reapplies D55085 without modifications. Original commit message: Avoid emitting redundant or unusable directories in DIFile metadata entries. As discussed on llvm-dev recently, Clang currently emits redundant directories in DIFile entries, such as .file 1 "/Volumes/Data/llvm" "/Volumes/Data/llvm/tools/clang/test/CodeGen/debug-info-abspath.c" This patch looks at any common prefix between the compilation directory and the (absolute) file path and strips the redundant part. More importantly it leaves the compilation directory empty if the two paths have no common prefix. After this patch the above entry is (assuming a compilation dir of "/Volumes/Data/llvm/_build"): .file 1 "/Volumes/Data/llvm" "tools/clang/test/CodeGen/debug-info-abspath.c" When building the FileCheck binary with debug info, this patch makes the build artifacts ~1kb smaller. Differential Revision: https://reviews.llvm.org/D55085 llvm-svn: 348513
* Diagnose friend function template redefinitions.Serge Pavlov2018-12-061-0/+2
| | | | | | | | | | | | | | Friend function template defined in a class template becomes available if the enclosing class template is instantiated. Until the function template is used, it does not have a body, but still is considered a definition for the purpose of redeclaration checks. This change modifies redefinition check so that it can find the friend function template definitions in instantiated classes. Differential Revision: http://reviews.llvm.org/D21508 llvm-svn: 348473
* [test] Disable Modules/prune.m on NetBSD as it requires 'touch -a'Michal Gorny2018-12-051-0/+3
| | | | llvm-svn: 348356
* Revert "Avoid emitting redundant or unusable directories in DIFile metadata ↵Ilya Biryukov2018-12-041-3/+1
| | | | | | | | | | entries." This reverts commit r348154 and follow-up commits r348211 and r3248213. Reason: the original commit broke compiler-rt tests and a follow-up fix (r348203) broke our integrate and was reverted. llvm-svn: 348280
* Relax tests to also work on WindowsAdrian Prantl2018-12-031-1/+3
| | | | llvm-svn: 348211
* Avoid emitting redundant or unusable directories in DIFile metadata entries.Adrian Prantl2018-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | As discussed on llvm-dev recently, Clang currently emits redundant directories in DIFile entries, such as .file 1 "/Volumes/Data/llvm" "/Volumes/Data/llvm/tools/clang/test/CodeGen/debug-info-abspath.c" This patch looks at any common prefix between the compilation directory and the (absolute) file path and strips the redundant part. More importantly it leaves the compilation directory empty if the two paths have no common prefix. After this patch the above entry is (assuming a compilation dir of "/Volumes/Data/llvm/_build"): .file 1 "/Volumes/Data/llvm" "tools/clang/test/CodeGen/debug-info-abspath.c" When building the FileCheck binary with debug info, this patch makes the build artifacts ~1kb smaller. Differential Revision: https://reviews.llvm.org/D55085 llvm-svn: 348154
* [-gmodules] Honor -fdebug-prefix-map in the debug info inside PCMs.Adrian Prantl2018-11-291-0/+23
| | | | | | | | | | | | This patch passes -fdebug-prefix-map (a feature for renaming source paths in the debug info) through to the per-module codegen options and adds the debug prefix map to the module hash. <rdar://problem/46045865> Differential Revision: https://reviews.llvm.org/D55037 llvm-svn: 347926
* CGDecl::emitStoresForConstant fix synthesized constant's nameJF Bastien2018-11-151-4/+4
| | | | | | | | | | | | Summary: The name of the synthesized constants for constant initialization was using mangling for statics, which isn't generally correct and (in a yet-uncommitted patch) causes the mangler to assert out because the static ends up trying to mangle function parameters and this makes no sense. Instead, mangle to `"__const." + FunctionName + "." + DeclName`. Reviewers: rjmccall Subscribers: dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D54055 llvm-svn: 346915
* [HeaderSearch] loadSubdirectoryModuleMaps should respect -working-directoryAlex Lorenz2018-11-143-0/+19
| | | | | | | | | | | Include search paths can be relative paths. The loadSubdirectoryModuleMaps function should account for that and respect the -working-directory parameter given to Clang. rdar://46045849 Differential Revision: https://reviews.llvm.org/D54503 llvm-svn: 346822
* Fix test from r346439 to also work on Windows due to path separator differences.Douglas Yung2018-11-091-1/+1
| | | | llvm-svn: 346468
* [Frontend/Modules] Show diagnostics on prebuilt module configuration ↵David Blaikie2018-11-081-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | mismatch too The current version only emits the below error for a module (attempted to be loaded) from the `prebuilt-module-path`: ``` error: module file blabla.pcm cannot be loaded due to a configuration mismatch with the current compilation [-Wmodule-file-config-mismatch] ``` With this change, if the prebuilt module is used, we allow the proper diagnostic behind the configuration mismatch to be shown. ``` error: POSIX thread support was disabled in PCH file but is currently enabled error: module file blabla.pcm cannot be loaded due to a configuration mismatch with the current compilation [-Wmodule-file-config-mismatch] ``` (A few lines later an error is emitted anyways, so there is no reason not to complain for configuration mismatches if a config mismatch is found and kills the build.) Reviewed By: dblaikie Tags: #clang Differential Revision: https://reviews.llvm.org/D53334 llvm-svn: 346439
* Reapply "Fix regression in behavior of clang -x c++-header -fmodule-name=XXX"Benjamin Kramer2018-11-051-0/+17
| | | | | | | | | | | | | This reverts commit r345963. We have a path forward now. Original commit message: The driver accidentally stopped passing the input filenames on to -cc1 in this mode due to confusion over what action was being requested. This change also fixes a couple of crashes I encountered when passing multiple files to such a -cc1 invocation. llvm-svn: 346130
* Add an explicit -std=c++14 to this test.Adrian Prantl2018-11-021-4/+4
| | | | | | rdar://problem/45642490 llvm-svn: 346048
* Revert "Fix regression in behavior of clang -x c++-header -fmodule-name=XXX"Ilya Biryukov2018-11-021-17/+0
| | | | | | | | | | This reverts commit r345803 and r345915 (a follow-up fix to r345803). Reason: r345803 blocks our internal integrate because of the new warnings showing up in too many places. The fix is actually correct, we will reland it after figuring out how to integrate properly. llvm-svn: 345963
* Fix regression in behavior of clang -x c++-header -fmodule-name=XXXRichard Smith2018-11-011-0/+17
| | | | | | | | | | | | -fsyntax-only. The driver accidentally stopped passing the input filenames on to -cc1 in this mode due to confusion over what action was being requested. This change also fixes a couple of crashes I encountered when passing multiple files to such a -cc1 invocation. llvm-svn: 345803
* NFC: Remove the ObjC1/ObjC2 distinction from clang (and related projects)Erik Pilkington2018-10-301-1/+1
| | | | | | | | | | We haven't supported compiling ObjC1 for a long time (and never will again), so there isn't any reason to keep these separate. This patch replaces LangOpts::ObjC1 and LangOpts::ObjC2 with LangOpts::ObjC. Differential revision: https://reviews.llvm.org/D53547 llvm-svn: 345637
* [VFS] Remove 'ignore-non-existent-contents' attribute for YAML-based VFS.Volodymyr Sapsai2018-10-245-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | 'ignore-non-existent-contents' stopped working after r342232 in a way that the actual attribute value isn't used and it works as if it is always `true`. Common use case for VFS iteration is iterating through files in umbrella directories for modules. Ability to detect if some VFS entries point to non-existing files is nice but non-critical. Instead of adding back support for `'ignore-non-existent-contents': false` I am removing the attribute, because such scenario isn't used widely enough and stricter checks don't provide enough value to justify the maintenance. rdar://problem/45176119 Reviewers: bruno Reviewed By: bruno Subscribers: hiraditya, dexonsmith, sammccall, cfe-commits Differential Revision: https://reviews.llvm.org/D53228 llvm-svn: 345212
* Debug Info (-gmodules): emit full types for non-anchored template ↵Adrian Prantl2018-10-246-2/+122
| | | | | | | | | | | | | | | | | specializations Before this patch, clang would emit a (module-)forward declaration for template instantiations that are not anchored by an explicit template instantiation, but still are guaranteed to be available in an imported module. Unfortunately detecting the owning module doesn't reliably work when local submodule visibility is enabled and the template is inside a cross-module namespace. This make clang debuggable again with -gmodules and LSV enabled. rdar://problem/41552377 llvm-svn: 345109
* Fix an assert in -Wquoted-include-in-framework-headerErik Pilkington2018-09-203-0/+5
| | | | | | | | Fixes rdar://43692300 Differential revision: https://reviews.llvm.org/D52253 llvm-svn: 342679
* [Modules] Add platform and environment features to requires clauseBruno Cardoso Lopes2018-09-181-0/+79
| | | | | | | | | | | | | Allows module map writers to add build requirements based on platform/os. This helps when target features and language dialects aren't enough to conditionalize building a module, among other things, it allow module maps for different platforms to live in the same file. rdar://problem/43909745 Differential Revision: https://reviews.llvm.org/D51910 llvm-svn: 342499
* [modules] Support use of -E on modules built from the command line.Richard Smith2018-09-151-0/+5
| | | | llvm-svn: 342306
* [modules] Frontend support for building a header module from a list ofRichard Smith2018-09-153-0/+52
| | | | | | headaer files. llvm-svn: 342304
* [ODRHash] Fix early exit that skipped code.Richard Trieu2018-09-141-0/+1
| | | | | | | | | | There is a bit of code at the end of AddDeclaration that should be run on every exit of the function. However, there was an early exit beforehand that could be triggered, which causes a small amount of data to skip the hashing, leading to false positive mismatch. Use a separate function so that this code is always run. llvm-svn: 342199
* Print correctly dependency paths on WindowsDavid Bolvansky2018-09-131-3/+3
| | | | | | | | | | | | | | | | | | | Summary: Before: main.o: main.c ../include/lib\test.h After: main.o: main.c ../include/lib/test.h Fixes PR38877 Reviewers: zturner Subscribers: xbolva00, cfe-commits Differential Revision: https://reviews.llvm.org/D51847 llvm-svn: 342139
* Track definition merging on the canonical declaration even when localRichard Smith2018-09-121-0/+34
| | | | | | | | | | | | | | submodule visibility is disabled. Attempting to pick a specific declaration to make visible when the module containing the merged declaration becomes visible is error-prone, as we don't yet know which declaration we'll choose to be the definition when we are informed of the merging. This reinstates r342019, reverted in r342020. The regression previously observed after this commit was fixed in r342096. llvm-svn: 342097
* When we leave a module header, make that header visible in itsRichard Smith2018-09-125-0/+32
| | | | | | includer's context, even if its overall module is unavailable. llvm-svn: 342096
* Revert r342019, "Track definition merging on the canonical declarationRichard Smith2018-09-121-34/+0
| | | | | | | | | even when [...]" Further testing has revealed that this causes build breaks during explicit module compilations. llvm-svn: 342020
* Track definition merging on the canonical declaration even when localRichard Smith2018-09-121-0/+34
| | | | | | | | | | | submodule visibility is disabled. Attempting to pick a specific declaration to make visible when the module containing the merged declaration becomes visible is error-prone, as we don't yet know which declaration we'll choose to be the definition when we are informed of the merging. llvm-svn: 342019
* Consistently create a new declaration when merging a pre-existing butRichard Smith2018-09-121-1/+1
| | | | | | | | | | | | | | | | hidden definition with a would-be-parsed redefinition. This permits a bunch of cleanups. In particular, we no longer need to take merged definitions into account when checking declaration visibility, only when checking definition visibility, which makes certain visibility checks take linear instead of quadratic time. We could also now remove the UPD_DECL_EXPORTED update record and track on each declaration whether it was demoted from a definition (as we already do for variables), but I'm not doing that in this patch to keep the changes here simpler. llvm-svn: 342018
* Fix tracking of merged definitions when the merge target is also mergedRichard Smith2018-09-121-0/+34
| | | | | | into something else. llvm-svn: 342017
* [Modules] Add imported modules to the output of -module-file-infoBruno Cardoso Lopes2018-09-111-0/+1
| | | | | | | | | Fix a bug in the deserialization of IMPORTS section and allow for imported modules to also be printed with -module-file-info. rdar://problem/43867753 llvm-svn: 341902
* PR38627: Fix handling of exception specification adjustment forRichard Smith2018-09-052-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | destructors. We previously tried to patch up the exception specification after completing the class, which went wrong when the exception specification was needed within the class body (in particular, by a friend redeclaration of the destructor in a nested class). We now mark the destructor as having a not-yet-computed exception specification immediately after creating it. This requires delaying various checks against the exception specification (where we'd previously have just got the wrong exception specification, and now find we have an exception specification that we can't compute yet) when those checks fire while the class is being defined. This also exposed an issue that we were missing a CodeSynthesisContext for computation of exception specifications (otherwise we'd fail to make the module containing the definition of the class visible when computing its members' exception specs). Adding that incidentally also gives us a diagnostic quality improvement. This has also exposed an pre-existing problem: making the exception specification evaluation context a non-SFINAE context (as it should be) results in a bootstrap failure; PR38850 filed for this. llvm-svn: 341499
* Remove unnecessary options from test RUN lines.Richard Trieu2018-09-052-6/+6
| | | | | | | These tests do not check the color printing, so color options should not be used when running them. llvm-svn: 341498
* Add triple to test case.Richard Trieu2018-09-051-1/+3
| | | | | | | This test uses enums, which have different behavior when targeting different systems. Specifying a triple will give predictable behavior to this test. llvm-svn: 341496
* [ODRHash] Extend hash to support all Type's.Richard Trieu2018-09-046-2/+1129
| | | | llvm-svn: 341421
* Ensure canonical type is actually canonical.Richard Trieu2018-08-301-0/+74
| | | | | | | | | ASTContext::applyObjCProtocolQualifiers will return a canonical type when given a canonical type and an array of canonical protocols. If the protocols are not canonical then the returned type is also not canonical. Since a canonical type is needed, canonicalize the returned type before using it. This later prevents a type from having a non-canonical canonical type. llvm-svn: 341013
* [CMake] Use normalized Windows target triplesPetr Hosek2018-08-096-6/+6
| | | | | | | | | | | Changes the default Windows target triple returned by GetHostTriple.cmake from the old environment names (which we wanted to move away from) to newer, normalized ones. This also requires updating all tests to use the new systems names in constraints. Differential Revision: https://reviews.llvm.org/D47381 llvm-svn: 339307
* Diagnose invalid cv-qualifiers for friend decls.Eli Friedman2018-08-031-18/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D45712 llvm-svn: 338931
* [modules] Defer merging deduced return types.Richard Smith2018-08-032-0/+9
| | | | | | | | | | | We can't read a deduced return type until we are sure that the types referred to by it are not in the middle of being loaded. So defer all reading of such deduced return types until the end of the recursive deserialization step. Also, when we load a function type that has a deduced return type, update all other redeclarations of the function to have that deduced return type. llvm-svn: 338798
* Fix assertion failure when emitting code for a merged lambda.Richard Smith2018-08-021-1/+1
| | | | llvm-svn: 338766
* [Modules] Do not emit relocation error when -fno-validate-pch is setYuka Takahashi2018-08-011-0/+2
| | | | | | | | | | | | Summary: Clang emits error when implicit modules was relocated from the first build directory. However this was biting our usecase where we copy the contents of build directory to another directory in order to distribute. Differential Revision: https://reviews.llvm.org/D49852 llvm-svn: 338503
* [ODRHash] Support hashing enums.Richard Trieu2018-07-251-0/+171
| | | | llvm-svn: 337978
* [PCH+Modules] Load -fmodule-map-file content before including PCHsBruno Cardoso Lopes2018-07-191-0/+16
| | | | | | | | | | | | | | | | Consider: 1) Generate PCH with -fmodules and -fmodule-map-file 2) Use PCH with -fmodules and the same -fmodule-map-file If we don't load -fmodule-map-file content before including PCHs, the modules that are dependencies in PCHs cannot get loaded, since there's no matching module map file when reading back the AST. rdar://problem/40852867 Differential Revision: https://reviews.llvm.org/D48685 llvm-svn: 337447
* Reapply r336660: [Modules] Autoload subdirectory modulemaps with specific ↵Bruno Cardoso Lopes2018-07-186-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | LangOpts Summary: Reproducer and errors: https://bugs.llvm.org/show_bug.cgi?id=37878 lookupModule was falling back to loadSubdirectoryModuleMaps when it couldn't find ModuleName in (proper) search paths. This was causing iteration over all files in the search path subdirectories for example "/usr/include/foobar" in bugzilla case. Users don't expect Clang to load modulemaps in subdirectories implicitly, and also the disk access is not cheap. if (AllowExtraModuleMapSearch) true with ObjC with @import ModuleName. Reviewers: rsmith, aprantl, bruno Subscribers: cfe-commits, teemperor, v.g.vassilev Differential Revision: https://reviews.llvm.org/D48367 llvm-svn: 337430
* [modules] Print input files when -module-file-info file switch is passed.Vassil Vassilev2018-07-181-0/+10
| | | | | | | | | This patch improves traceability of duplicated header files which end up in multiple pcms. Differential Revision: https://reviews.llvm.org/D47118 llvm-svn: 337353
* Revert "[modules] Fix 37878; Autoload subdirectory modulemaps with specific ↵Bruno Cardoso Lopes2018-07-126-33/+0
| | | | | | | | | | | | | | | LangOpts" This reverts commit f40124d4f05ecf4f880cf4e8f26922d861f705f3 / r336660. This change shouldn't be affecting `@import` behavior, but turns out it is: https://ci.swift.org/view/swift-master-next/job/oss-swift-incremental-RA-osx-master-next/2800/consoleFull#-12570166563122a513-f36a-4c87-8ed7-cbc36a1ec144 Working on a reduced testcase for this, reverting in the meantime. rdar://problem/42102222 llvm-svn: 336920
* [modules] Fix 37878; Autoload subdirectory modulemaps with specific LangOptsYuka Takahashi2018-07-106-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Reproducer and errors: https://bugs.llvm.org/show_bug.cgi?id=37878 lookupModule was falling back to loadSubdirectoryModuleMaps when it couldn't find ModuleName in (proper) search paths. This was causing iteration over all files in the search path subdirectories for example "/usr/include/foobar" in bugzilla case. Users don't expect Clang to load modulemaps in subdirectories implicitly, and also the disk access is not cheap. if (AllowExtraModuleMapSearch) true with ObjC with @import ModuleName. Reviewers: rsmith, aprantl, bruno Subscribers: cfe-commits, teemperor, v.g.vassilev Differential Revision: https://reviews.llvm.org/D48367 llvm-svn: 336660
* [ODRHash] Merge the two function hashes into one.Richard Trieu2018-07-101-0/+222
| | | | | | | | | | | Functions that are a sub-Decl of a record were hashed differently than other functions. This change keeps the AddFunctionDecl function and the hash of records now calls this function. In addition, AddFunctionDecl has an option to perform a hash as if the body was absent, which is required for some checks after loading modules. Additional logic prevents multiple error message from being printed. llvm-svn: 336632
* PR33924: merge local declarations that have linkage of some kind withinRichard Smith2018-07-046-0/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | merged function definitions; also merge functions with deduced return types. This seems like two independent fixes, but unfortunately they are hard to separate because it's challenging to reliably test either one of them without also testing the other. A complication arises with deduced return type support: we need the type of the function in order to know how to merge it, but we can't load the actual type of the function because it might reference an entity declared within the function (and we need to have already merged the function to correctly merge that entity, which we would need to do to determine if the function types match). So we instead compare the declared function type when merging functions, and defer loading the actual type of a function with a deduced type until we've finished loading and merging the function. This reverts r336175, reinstating r336021, with one change (for PR38015): we look at the TypeSourceInfo of the first-so-far declaration of each function when considering whether to merge two functions. This works around a problem where the calling convention in the TypeSourceInfo for subsequent redeclarations may not match if it was implicitly adjusted. llvm-svn: 336240
OpenPOWER on IntegriCloud