summaryrefslogtreecommitdiffstats
path: root/clang/test
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement codegen for MSVC unions with reference members.Aaron Ballman2019-08-271-0/+34
| | | | | | | | Currently, clang accepts a union with a reference member when given the -fms-extensions flag. This change fixes the codegen for this case. Patch by Dominic Ferreira. llvm-svn: 370052
* [ASTImporter] Fix name conflict handling with different strategiesGabor Marton2019-08-271-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are numorous flaws about the name conflict handling, this patch attempts fixes them. Changes in details: * HandleNameConflict return with a false DeclarationName Hitherto we effectively never returned with a NameConflict error, even if the preceding StructuralMatch indicated a conflict. Because we just simply returned with the parameter `Name` in HandleNameConflict and that name is almost always `true` when converted to `bool`. * Add tests which indicate wrong NameConflict handling * Add to ConflictingDecls only if decl kind is different Note, we might not indicate an ODR error when there is an existing record decl and a enum is imported with same name. But there are other cases. E.g. think about the case when we import a FunctionTemplateDecl with name f and we found a simple FunctionDecl with name f. They overload. Or in case of a ClassTemplateDecl and CXXRecordDecl, the CXXRecordDecl could be the 'templated' class, so it would be false to report error. So I think we should report a name conflict error only when we are 100% sure of that. That is why I think it should be a general pattern to report the error only if the kind is the same. * Fix failing ctu test with EnumConstandDecl In ctu-main.c we have the enum class 'A' which brings in the enum constant 'x' with value 0 into the global namespace. In ctu-other.c we had the enum class 'B' which brought in the same name ('x') as an enum constant but with a different enum value (42). This is clearly an ODR violation in the global namespace. The solution was to rename the second enum constant. * Introduce ODR handling strategies Reviewers: a_sidorin, shafik Differential Revision: https://reviews.llvm.org/D59692 llvm-svn: 370045
* Revert "[clang-scan-deps] Minimizer: Correctly handle multi-line content ↵Richard Smith2019-08-271-16/+0
| | | | | | | | | | | | with CR+LF line endings" This reverts commit r369986. This change added a dependency on the 'dos2unix' tool, which is not one of our accepted test dependencies and may not exist on all machines that build Clang. llvm-svn: 370000
* [clang-scan-deps] Skip UTF-8 BOM in source minimizerAlexandre Ganea2019-08-271-0/+10
| | | | | | Differential Revision: https://reviews.llvm.org/D66511 llvm-svn: 369993
* NFC: Make test work with or without assertionsVitaly Buka2019-08-271-7/+10
| | | | llvm-svn: 369992
* [clang-scan-deps] Minimizer: Correctly skip over double slashes in angle ↵Alexandre Ganea2019-08-261-0/+8
| | | | | | | | | | bracket #include Previously, double slashes (//) occurring in angle brackets #include were incorrectly interpreted as comments. eg. #include <dir//file.h> Differential Revision: https://reviews.llvm.org/D66550 llvm-svn: 369988
* [clang-scan-deps] Minimizer: Correctly handle multi-line content with CR+LF ↵Alexandre Ganea2019-08-261-0/+16
| | | | | | | | | | line endings Previously, an #error directive with quoted, multi-line content, along with CR+LF line endings wasn't handled correctly. Differential Revision: https://reviews.llvm.org/D66556 llvm-svn: 369986
* PR42587: diagnose unexpanded uses of a pack parameter of a genericRichard Smith2019-08-261-0/+13
| | | | | | | | | | | | | | | | | lambda from within the lambda-declarator. Instead of trying to reconstruct whether a parameter pack was declared inside a lambda (which we can't do correctly in general because we might not have attached parameters to their declaration contexts yet), track the set of parameter packs introduced in each live lambda scope, and require only those parameters to be immediately expanded when they appear inside that lambda. In passing, fix incorrect disambiguation of a lambda-expression starting with an init-capture pack in a braced-init-list. We previously incorrectly parsed that as a designated initializer. llvm-svn: 369985
* hwasan, codegen: Keep more lifetime markers used for hwasanVitaly Buka2019-08-262-0/+6
| | | | | | | | | | | | Reviewers: eugenis Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66697 llvm-svn: 369980
* msan, codegen, instcombine: Keep more lifetime markers used for msanVitaly Buka2019-08-262-0/+6
| | | | | | | | | | | | Reviewers: eugenis Subscribers: hiraditya, cfe-commits, #sanitizers, llvm-commits Tags: #clang, #sanitizers, #llvm Differential Revision: https://reviews.llvm.org/D66695 llvm-svn: 369979
* Revert r369843 "[Testing] Unbreak r369830"Vitaly Buka2019-08-261-1/+0
| | | | | | | | That was not the fix. This reverts commit 8bcf690ae03db85608b2ea22eac7a91c84df4dc. llvm-svn: 369971
* Updating a test case that was missed in r369957.Aaron Ballman2019-08-261-1/+1
| | | | llvm-svn: 369968
* [DebugInfo] Add debug-entry-values test coverage, NFCVedant Kumar2019-08-261-0/+7
| | | | | | | Check that call site descriptions are emitted in dwarf4 + lldb + debug-entry-values mode. llvm-svn: 369964
* Fixing a weird copy-pasta to get bots back to green.Aaron Ballman2019-08-261-1/+1
| | | | llvm-svn: 369960
* Reword the C11 extension diagnostic.Aaron Ballman2019-08-262-29/+29
| | | | | | This makes it more consistent with other language extension diagnostics. llvm-svn: 369957
* Fix gen-cdb-fragment test for WindowsAlex Lorenz2019-08-261-2/+2
| | | | | | Windows bots didn't seem to like the empty argument, so I rewrote the test. llvm-svn: 369956
* [Clang][Bundler] Use llvm-objcopy for creating fat object filesSergey Dmitriev2019-08-262-6/+4
| | | | | | | | clang-offload-bundler currently uses partial linking for creating fat object files, but such technique cannot be used on Windows due to the absence of partial linking support in the linker. This patch changes implementation to use llvm-objcopy for merging device and host objects instead of doing partial linking. This is one step forward towards enabling OpenMP offload on Windows. Differential Revision: https://reviews.llvm.org/D66485 llvm-svn: 369955
* Diagnose use of _Thread_local as an extension when not in C11 mode.Aaron Ballman2019-08-263-35/+50
| | | | llvm-svn: 369954
* [OPENMP][NVPTX]Fix critical region codegen.Alexey Bataev2019-08-261-1/+2
| | | | | | | | | | | | | | | | | Summary: Previously critical regions were emitted with the barrier making it a worksharing construct though it is not. Also, it leads to incorrect behavior in Cuda9+. Patch fixes this problem. Reviewers: ABataev, jdoerfert Subscribers: jholewinski, guansong, cfe-commits, grokos Tags: #clang Differential Revision: https://reviews.llvm.org/D66673 llvm-svn: 369946
* Improve behavior in the case of stack exhaustion.Richard Smith2019-08-264-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Clang performs various recursive operations (such as template instantiation), and may use non-trivial amounts of stack space in each recursive step (for instance, due to recursive AST walks). While we try to keep the stack space used by such steps to a minimum and we have explicit limits on the number of such steps we perform, it's impractical to guarantee that we won't blow out the stack on deeply recursive template instantiations on complex ASTs, even with only a moderately high instantiation depth limit. The user experience in these cases is generally terrible: we crash with no hint of what went wrong. Under this patch, we attempt to do better: * Detect when the stack is nearly exhausted, and produce a warning with a nice template instantiation backtrace, telling the user that we might run slowly or crash. * For cases where we're forced to trigger recursive template instantiation in arbitrarily-deeply-nested contexts, check whether we're nearly out of stack space and allocate a new stack (by spawning a new thread) after producing the warning. Reviewers: rnk, aaron.ballman Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66361 llvm-svn: 369940
* [driver] add a new option `-gen-cdb-fragment-path` to emitAlex Lorenz2019-08-261-0/+37
| | | | | | | | | | | | | | a fragment of a compilation database for each compilation This patch adds a new option called -gen-cdb-fragment-path to the driver, which can be used to specify a directory path to which clang can emit a fragment of a CDB for each compilation it needs to invoke. This option emits the same CDB contents as -MJ, and will be ignored if -MJ is specified. Differential Revision: https://reviews.llvm.org/D66555 llvm-svn: 369938
* [Wdocumentation] improve wording of a warning messageDmitri Gribenko2019-08-251-6/+6
| | | | | | | | | | | Based on @davezarzycki remarks in D64696 improved the wording of the warning message. Differential Revision: https://reviews.llvm.org/D66700 Patch by Mark de Wever. llvm-svn: 369873
* [Testing] Unbreak r369830David Zarzycki2019-08-241-0/+1
| | | | llvm-svn: 369843
* PR42513: Enter the proper DeclContext before substituting into anRichard Smith2019-08-242-3/+23
| | | | | | | | | | | | default template argument expression. We already did this for type template parameters and template template parameters, but apparently forgot to do so for non-type template parameters. This causes the substituted default argument expression to be substituted in the proper context, and in particular to properly mark its subexpressions as odr-used. llvm-svn: 369834
* NFC: Rename some sanitizer related lifetime checksVitaly Buka2019-08-243-47/+55
| | | | llvm-svn: 369830
* PR40674: fix assertion failure if a structured binding declaration has aRichard Smith2019-08-241-1/+7
| | | | | | | tuple-like decomposition that produces value-dependent reference bindings. llvm-svn: 369829
* [libclang][index][NFC] Fix test for skipping already parsed function bodiesJan Korous2019-08-231-1/+1
| | | | llvm-svn: 369822
* Fix a test to test what the name suggest.Gabor Horvath2019-08-231-1/+1
| | | | llvm-svn: 369820
* [LifetimeAnalysis] Make it possible to disable the new warningsGabor Horvath2019-08-231-0/+23
| | | | llvm-svn: 369817
* [OPENMP5]Use nonmonotonic modifier by default for non-static andAlexey Bataev2019-08-231-5/+12
| | | | | | | | | | non-ordered loops. According to OpenMP 5.0, 2.9.2 Worksharing-Loop Construct, Desription, If the static schedule kind is specified or if the ordered clause is specified, and if the nonmonotonic modifier is not specified, the effect is as if the monotonic modifier is specified. Otherwise, unless the monotonic modifier is specified, the effect is as if the nonmonotonic modifier is specified. The first part of this requirement is implemented in runtime. Patch adds support for the second, nonmonotonic, part of this requirement. llvm-svn: 369801
* [Sema] Don't warn on printf('%hd', [char]) (PR41467)Nathan Huckleberry2019-08-234-9/+17
| | | | | | | | | | | | | | | | Summary: Link: https://bugs.llvm.org/show_bug.cgi?id=41467 Reviewers: rsmith, nickdesaulniers, aaron.ballman, lebedev.ri Reviewed By: nickdesaulniers, aaron.ballman, lebedev.ri Subscribers: lebedev.ri, nickdesaulniers, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66186 llvm-svn: 369791
* [OpenCL] Renamed value of std flag in C++ mode.Anastasia Stulova2019-08-231-1/+1
| | | | | | | | Clang should accept -std=clc++ (not -std=c++!) for OpenCL. This was forgotten in r367008. llvm-svn: 369779
* [OPENMP5.0]Add support for device_type clause in declare targetAlexey Bataev2019-08-236-9/+116
| | | | | | | | | | construct. OpenMP 5.0 introduced new clause for declare target directive, device_type clause, which may accept values host, nohost, and any. Host means that the function must be emitted only for the host, nohost - only for the device, and any - for both, device and the host. llvm-svn: 369775
* [analyzer] Avoid unnecessary enum range check on LValueToRValue castsKristof Umann2019-08-232-1/+43
| | | | | | | | | | | | | | | | Summary: EnumCastOutOfRangeChecker should not perform enum range checks on LValueToRValue casts, since this type of cast does not actually change the underlying type. Performing the unnecessary check actually triggered an assertion failure deeper in EnumCastOutOfRange for certain input (which is captured in the accompanying test code). Reviewers: #clang, Szelethus, gamesh411, NoQ Reviewed By: Szelethus, gamesh411, NoQ Subscribers: NoQ, gamesh411, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, Charusso, bjope, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66014 llvm-svn: 369760
* [analyzer] CastValueChecker: Correctly model results of based-to-derived casts.Artem Dergachev2019-08-232-3/+12
| | | | | | | | | | Our SVal hierarchy doesn't allow modeling pointer casts as no-op. The pointer type is instead encoded into the pointer object. Defer to our usual pointer casting facility, SValBuilder::evalBinOp(). Fixes a crash. llvm-svn: 369729
* [analyzer] CastValueChecker: Provide DynamicTypeMap with pointer types only.Artem Dergachev2019-08-232-2/+10
| | | | | | | | | The idea to drop this requirement is good, but for now every other user of DynamicTypeInfo expects pointer types. Fixes a crash. llvm-svn: 369728
* [analyzer] CastValueChecker: Avoid modeling casts between objects.Artem Dergachev2019-08-234-8/+20
| | | | | | | | | Our method only works correctly when casting a pointer to a pointer or a reference to a reference. Fixes a crash. llvm-svn: 369727
* [analyzer] DynamicTypeInfo: Avoid putting null regions into dynamic typemap.Artem Dergachev2019-08-231-0/+5
| | | | | | Fixes a crash. llvm-svn: 369726
* Revert "PR42587: diagnose unexpanded uses of a pack parameter of a generic" ↵Richard Smith2019-08-231-8/+0
| | | | | | | | due to buildbot breakage. This reverts commit r369722. llvm-svn: 369725
* PR42587: diagnose unexpanded uses of a pack parameter of a genericRichard Smith2019-08-231-0/+8
| | | | | | lambda from within the lambda-declarator. llvm-svn: 369722
* [clang][ifs] Dropping older experimental interface stub formats.Puyan Lotfi2019-08-2211-48/+67
| | | | | | | | | | | | I've been working on a new tool, llvm-ifs, for merging interface stub files generated by clang and I've iterated on my derivative format of TBE to a newer format. llvm-ifs will only support the new format, so I am going to drop the older experimental interface stubs formats in this commit to make things simpler. Differential Revision: https://reviews.llvm.org/D66573 llvm-svn: 369719
* [Bugfix] fix r369705 unit testNick Desaulniers2019-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: Aliases aren't supported on OSX. Add a GNU target triple. Reported-by: leonardchan Reported-by: erik.pilkington Reviewers: leonardchan, erik.pilkington Reviewed By: leonardchan, erik.pilkington Subscribers: dexonsmith, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66622 llvm-svn: 369713
* [Clang][CodeGen] set alias linkage on QualTypeNick Desaulniers2019-08-221-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: It seems that CodeGen was always using ExternalLinkage when emitting a GlobalDecl with __attribute__((alias)). This leads to symbol redefinitions (ODR) that cause failures at link time for static aliases. This is readily attempting to link an ARM (32b) allyesconfig Linux kernel built with Clang. Reported-by: nathanchance Suggested-by: ihalip Link: https://bugs.llvm.org/show_bug.cgi?id=42377 Link: https://github.com/ClangBuiltLinux/linux/issues/631 Reviewers: rsmith, aaron.ballman, erichkeane Reviewed By: aaron.ballman Subscribers: javed.absar, kristof.beyls, cfe-commits, srhines, ihalip, nathanchance Tags: #clang Differential Revision: https://reviews.llvm.org/D66492 llvm-svn: 369705
* Introduce FileEntryRef and use it when handling includes to report correct ↵Alex Lorenz2019-08-221-0/+16
| | | | | | | | | | | | | | | | | | | | | | | dependencies when the FileManager is reused across invocations This commit introduces a parallel API to FileManager's getFile: getFileEntryRef, which returns a reference to the FileEntry, and the name that was used to access the file. In the case of a VFS with 'use-external-names', the FileEntyRef contains the external name of the file, not the filename that was used to access it. The new API is adopted only in the HeaderSearch and Preprocessor for include file lookup, so that the accessed path can be propagated to SourceManager's FileInfo. SourceManager's FileInfo now can report this accessed path, using the new getName method. This API is then adopted in the dependency collector, which now correctly reports dependencies when a file is included both using a symlink and a real path in the case when the FileManager is reused across multiple Preprocessor invocations. Note that this patch does not fix all dependency collector issues, as the same problem is still present in other cases when dependencies are obtained using FileSkipped, InclusionDirective, and HasInclude. This will be fixed in follow-up commits. Differential Revision: https://reviews.llvm.org/D65907 llvm-svn: 369680
* Revert "[LifetimeAnalysis] Support more STL idioms (template forward ↵Richard Smith2019-08-222-70/+0
| | | | | | | | | | declaration and DependentNameType)" This reverts commit r369591, because it causes the formerly-reliable -Wreturn-stack-address warning to start issuing false positives. Testcase provided on the commit thread. llvm-svn: 369677
* Revert r369402 "win: Enable /Zc:twoPhase by default if targeting MSVC 2017 ↵Hans Wennborg2019-08-221-12/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | update 3 or newer" This broke compiling some ASan tests with never versions of MSVC/the Win SDK, see https://crbug.com/996675 > MSVC 2017 update 3 (_MSC_VER 1911) enables /Zc:twoPhase by default, and > so should clang-cl: > https://docs.microsoft.com/en-us/cpp/build/reference/zc-twophase > > clang-cl takes the MSVC version it emulates from the -fmsc-version flag, > or if that's not passed it tries to check what the installed version of > MSVC is and uses that, and failing that it uses a default version that's > currently 1911. So this changes the default if no -fmsc-version flag is > passed and no installed MSVC is detected. (It also changes the default > if -fmsc-version is passed or MSVC is detected, and either indicates > _MSC_VER >= 1911.) > > As mentioned in the MSDN article, the Windows SDK header files in > version 10.0.15063.0 (Creators Update or Redstone 2) and earlier > versions do not work correctly with /Zc:twoPhase. If you need to use > these old SDKs with a new clang-cl, explicitly pass /Zc:twoPhase- to get > the old behavior. > > Fixes PR43032. > > Differential Revision: https://reviews.llvm.org/D66394 llvm-svn: 369647
* Revert r369458 "[DebugInfo] Add debug location to dynamic atexit destructor"Hans Wennborg2019-08-222-27/+7
| | | | | | | | | | | | | | | | It causes the build to fail with "inlinable function call in a function with debug info must have a !dbg location" in Chromium. See llvm-commits thread for more info. (This also reverts the follow-up in r369474.) > Fixes PR43012 > > Differential Revision: https://reviews.llvm.org/D66328 llvm-svn: 369633
* [OpenMP] Permit map with DSA on combined directiveJoel E. Denny2019-08-227-22/+214
| | | | | | | | | | | | | | | | | | | | | | | | | | | For `map`, the following restriction changed in OpenMP 5.0: * OpenMP 4.5 [2.15.5.1, Restrictions]: "A list item cannot appear in both a map clause and a data-sharing attribute clause on the same construct. * OpenMP 5.0 [2.19.7.1, Restrictions]: "A list item cannot appear in both a map clause and a data-sharing attribute clause on the same construct unless the construct is a combined construct." This patch removes this restriction in the case of combined constructs and OpenMP 5.0, and it updates Sema not to capture a scalar by copy in the target region when `firstprivate` and `map` appear for that scalar on a combined target construct. This patch also adds a fixme to a test that now reveals that a diagnostic about loop iteration variables is dropped in the case of OpenMP 5.0. That bug exists regardless of this patch's changes. Reviewed By: ABataev, jdoerfert, hfinkel, kkwli0 Differential Revision: https://reviews.llvm.org/D65835 llvm-svn: 369619
* [analyzer] Enable control dependency condition tracking by defaultKristof Umann2019-08-224-1/+7
| | | | | | | | This patch concludes my GSoC'19 project by enabling track-conditions by default. Differential Revision: https://reviews.llvm.org/D66381 llvm-svn: 369616
* [analyzer] CastValueChecker: Model isa(), isa_and_nonnull()Csaba Dabis2019-08-223-8/+30
| | | | | | | | | | Summary: - Reviewed By: NoQ Differential Revision: https://reviews.llvm.org/D66423 llvm-svn: 369615
OpenPOWER on IntegriCloud