summaryrefslogtreecommitdiffstats
path: root/clang/test
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer] Attribute for RetainCountChecker for OSObject should propagate ↵George Karpenkov2018-12-051-3/+35
| | | | | | | | | | with inheritance rdar://46388388 Differential Revision: https://reviews.llvm.org/D55154 llvm-svn: 348396
* Address a post-commit review comment on r348325.Erik Pilkington2018-12-051-0/+2
| | | | llvm-svn: 348388
* [CodeComplete] Fix a crash in access checks of inner classesIlya Biryukov2018-12-051-0/+49
| | | | | | | | | | | | | | Summary: The crash was introduced in r348135. Reviewers: kadircet Reviewed By: kadircet Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55260 llvm-svn: 348387
* [OpenCL] Diagnose conflicting address spaces in templates.Anastasia Stulova2018-12-051-0/+19
| | | | | | | | | | | | | Added new diagnostic when templates are instantiated with different address space from the one provided in its definition. This also prevents deducing generic address space in pointer type of templates to allow giving them concrete address space during instantiation. Differential Revision: https://reviews.llvm.org/D55127 llvm-svn: 348382
* [Haiku] Support __float128 for x86 and x86_64Kristina Brooks2018-12-051-0/+4
| | | | | | | | | | | | | This patch addresses a compilation error with clang when running in Haiku being unable to compile code using float128 (throws compilation error such as 'float128 is not supported on this target'). Patch by kallisti5 (Alexander von Gluck IV) Differential Revision: https://reviews.llvm.org/D54901 llvm-svn: 348368
* Move detection of libc++ include dirs to Driver on MacOSIlya Biryukov2018-12-054-10/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The intention is to make the tools replaying compilations from 'compile_commands.json' (clang-tidy, clangd, etc.) find the same standard library as the original compiler specified in 'compile_commands.json'. Previously, the library detection logic was in the frontend (InitHeaderSearch.cpp) and relied on the value of resource dir as an approximation of the compiler install dir. The new logic uses the actual compiler install dir and is performed in the driver. This is consistent with the C++ standard library detection on other platforms and allows to override the resource dir in the tools using the compile_commands.json without altering the standard library detection mechanism. The tools have to override the resource dir to make sure they use a consistent version of the builtin headers. There is still logic in InitHeaderSearch that attemps to add the absolute includes for the the C++ standard library, so we keep passing the -stdlib=libc++ from the driver to the frontend via cc1 args to avoid breaking that. In the long run, we should move this logic to the driver too, but it could potentially break the library detection on other systems, so we don't tackle it in this patch to keep its scope manageable. This is a second attempt to fix the issue, first one was commited in r346652 and reverted in r346675. The original fix relied on an ad-hoc propagation (bypassing the cc1 flags) of the install dir from the driver to the frontend's HeaderSearchOptions. Unsurpisingly, the propagation was incomplete, it broke the libc++ detection in clang itself, which caused LLDB tests to break. The LLDB tests pass with new fix. Reviewers: JDevlieghere, arphaman, EricWF Reviewed By: arphaman Subscribers: mclow.lists, ldionne, dexonsmith, ioeric, christof, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54630 llvm-svn: 348365
* Revert: Honor -fdebug-prefix-map when creating function names for the debug ↵Renato Golin2018-12-051-10/+0
| | | | | | | | | info. This commit reverts r348060 and r348062 due to it breaking the AArch64 Full buildbot: https://bugs.llvm.org/show_bug.cgi?id=39892 llvm-svn: 348364
* [test] Disable Modules/prune.m on NetBSD as it requires 'touch -a'Michal Gorny2018-12-051-0/+3
| | | | llvm-svn: 348356
* [clang] - Simplify tools::SplitDebugName.George Rimar2018-12-051-0/+4
| | | | | | | | | | | | | | | | | | This is an updated version of the D54576, which was reverted. Problem was that SplitDebugName calls the InputInfo::getFilename which asserts if InputInfo given is not of type Filename: const char *getFilename() const { assert(isFilename() && "Invalid accessor."); return Data.Filename; } At the same time at that point, it can be of type Nothing and we need to use getBaseInput(), like original code did. Differential revision: https://reviews.llvm.org/D55006 llvm-svn: 348352
* [asan] Add clang flag -fsanitize-address-use-odr-indicatorVitaly Buka2018-12-052-0/+48
| | | | | | | | | | Reviewers: eugenis, m.ostapenko, ygribov Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D55157 llvm-svn: 348327
* [Sema] Remove some conditions of a failing assertErik Pilkington2018-12-051-0/+11
| | | | | | | | | | We should have been checking that this state is consistent, but its possible for it to be filled later, so it isn't really sound to check it here anyways. Fixes llvm.org/PR39742 llvm-svn: 348325
* Fix crash if an in-class explicit function specialization has explicitRichard Smith2018-12-041-0/+11
| | | | | | template arguments referring to template paramaeters. llvm-svn: 348313
* Adding tests for -ast-dump; NFC.Aaron Ballman2018-12-042-0/+636
| | | | | | This adds tests for the definition data of C++ record objects as well as special member functions. llvm-svn: 348309
* Add tests for dumping base classes; NFC.Aaron Ballman2018-12-041-0/+37
| | | | llvm-svn: 348308
* [PowerPC] Make no-PIC default to match GCC - CLANGStefan Pintilie2018-12-042-4/+40
| | | | | | | | Make -fno-PIC default on PowerPC LE. Differential Revision: https://reviews.llvm.org/D53384 llvm-svn: 348299
* Revert "Avoid emitting redundant or unusable directories in DIFile metadata ↵Ilya Biryukov2018-12-043-30/+7
| | | | | | | | | | 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
* [OPENMP][NVPTX]Fixed emission of the critical region.Alexey Bataev2018-12-041-1/+7
| | | | | | | | | | | | | Critical regions in NVPTX are the constructs, which, generally speaking, are not supported by the NVPTX target. Instead we're using special technique to handle the critical regions. Currently they are supported only within the loop and all the threads in the loop must execute the same critical region. Inside of this special regions the regions still must be emitted as critical, to avoid possible data races between the teams + synchronization must use __kmpc_barrier functions. llvm-svn: 348272
* [OPENMP][NVPTX]Mark __kmpc_barrier functions as convergent.Alexey Bataev2018-12-041-2/+8
| | | | | | | | __kmpc_barrier runtime functions must be marked as convergent to prevent some dangerous optimizations. Also, for NVPTX target all barriers must be emitted as simple barriers. llvm-svn: 348271
* PTH-- Remove feature entirely-Erich Keane2018-12-044-29/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When debugging a boost build with a modified version of Clang, I discovered that the PTH implementation stores TokenKind in 8 bits. However, we currently have 368 TokenKinds. The result is that the value gets truncated and the wrong token gets picked up when including PTH files. It seems that this will go wrong every time someone uses a token that uses the 9th bit. Upon asking on IRC, it was brought up that this was a highly experimental features that was considered a failure. I discovered via googling that BoostBuild (mostly Boost.Math) is the only user of this feature, using the CC1 flag directly. I believe that this can be transferred over to normal PCH with minimal effort: https://github.com/boostorg/build/issues/367 Based on advice on IRC and research showing that this is a nearly completely unused feature, this patch removes it entirely. Note: I considered leaving the build-flags in place and making them emit an error/warning, however since I've basically identified and warned the only user, it seemed better to just remove them. Differential Revision: https://reviews.llvm.org/D54547 Change-Id: If32744275ef1f585357bd6c1c813d96973c4d8d9 llvm-svn: 348266
* [SystemZ] Do not support __float128Ulrich Weigand2018-12-041-26/+1
| | | | | | | | | | | | | As of rev. 268898, clang supports __float128 on SystemZ. This seems to have been in error. GCC has never supported __float128 on SystemZ, since the "long double" type on the platform is already IEEE-128. (GCC only supports __float128 on platforms where "long double" is some other data type.) For compatibility reasons this patch removes __float128 on SystemZ again. The test case is updated accordingly. llvm-svn: 348247
* [Analyzer] Iterator Checker - Forbid decrements past the begin() and ↵Adam Balogh2018-12-041-34/+33
| | | | | | | | | | | | | | | | | | | | increments past the end() of containers Previously, the iterator range checker only warned upon dereferencing of iterators outside their valid range as well as increments and decrements of out-of-range iterators where the result remains out-of-range. However, the C++ standard is more strict than this: decrementing begin() or incrementing end() results in undefined behaviour even if the iterator is not dereferenced afterwards. Coming back to the range once out-of-range is also undefined. This patch corrects the behaviour of the iterator range checker: warnings are given for any operation whose result is ahead of begin() or past the end() (which is the past-end iterator itself, thus now we are speaking of past past-the-end). Differential Revision: https://reviews.llvm.org/D53812 llvm-svn: 348245
* [Analyzer] Iterator Checkers - Use the region of the topmost base class for ↵Adam Balogh2018-12-041-0/+37
| | | | | | | | | | | | | | | | | | iterators stored in a region If an iterator is represented by a derived C++ class but its comparison operator is for its base the iterator checkers cannot recognize the iterators compared. This results in false positives in very straightforward cases (range error when dereferencing an iterator after disclosing that it is equal to the past-the-end iterator). To overcome this problem we always use the region of the topmost base class for iterators stored in a region. A new method called getMostDerivedObjectRegion() was added to the MemRegion class to get this region. Differential Revision: https://reviews.llvm.org/D54466 llvm-svn: 348244
* Extend test for DependentSizedArrayTypeStephen Kelly2018-12-041-0/+9
| | | | | | | Use a using declaration to force the type to appear in the -ast-dump output. llvm-svn: 348241
* [WIP][Sema] Improve static_assert diagnostics for type traits.Clement Courbet2018-12-042-0/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In our codebase, `static_assert(std::some_type_trait<Ts...>::value, "msg")` (where `some_type_trait` is an std type_trait and `Ts...` is the appropriate template parameters) account for 11.2% of the `static_assert`s. In these cases, the `Ts` are typically not spelled out explicitly, e.g. `static_assert(std::is_same<SomeT::TypeT, typename SomeDependentT::value_type>::value, "message");` The diagnostic when the assert fails is typically not very useful, e.g. `static_assert failed due to requirement 'std::is_same<SomeT::TypeT, typename SomeDependentT::value_type>::value' "message"` This change makes the diagnostic spell out the types explicitly , e.g. `static_assert failed due to requirement 'std::is_same<int, float>::value' "message"` See tests for more examples. After this is submitted, I intend to handle `static_assert(!std::some_type_trait<Ts...>::value, "msg")`, which is another 6.6% of static_asserts. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D54903 llvm-svn: 348239
* [analyzer] MoveChecker: Add more common state resetting methods.Artem Dergachev2018-12-041-0/+10
| | | | | | | | | Includes "resize" and "shrink" because they can reset the object to a known state in certain circumstances. Differential Revision: https://reviews.llvm.org/D54563 llvm-svn: 348235
* Fix -Wmismatched-tags to not warn on redeclarations of structs in systemRichard Smith2018-12-041-1/+30
| | | | | | | | | | | | | | | | | | | | | | | | headers. Previously, we would only check whether the new declaration is in a system header, but that requires the user to be able to correctly guess whether a declaration in a system header is declared as a struct or a class when specializing standard library traits templates. We now entirely ignore declarations for which the warning was disabled when determining whether to warn on a tag mismatch. Also extend the diagnostic message to clarify that a) code containing such a tag mismatch is in fact valid and correct, and b) the (non-coding-style) reason to emit such a warning is that the Microsoft C++ ABI is broken and includes the tag kind in decorated names, as it seems a lot of users are confused by our diagnostic here (either not understanding why we produce it, or believing that it represents an actual language rule). llvm-svn: 348233
* [analyzer] MoveChecker: Improve warning and note messages.Artem Dergachev2018-12-041-71/+71
| | | | | | | | | | | | | | | | | | | The warning piece traditionally describes the bug itself, i.e. "The bug is a _____", eg. "Attempt to delete released memory", "Resource leak", "Method call on a moved-from object". Event pieces produced by the visitor are usually in a present tense, i.e. "At this moment _____": "Memory is released", "File is closed", "Object is moved". Additionally, type information is added into the event pieces for STL objects (in order to highlight that it is in fact an STL object), and the respective event piece now mentions that the object is left in an unspecified state after it was moved, which is a vital piece of information to understand the bug. Differential Revision: https://reviews.llvm.org/D54560 llvm-svn: 348229
* NFC: Make this test kinder on downstream forksErik Pilkington2018-12-041-1/+2
| | | | | | | | | | | Downstream forks that have their own attributes often run into this test failing when a new attribute is added to clang because the number of supported attributes no longer match. This is redundant information for this test, so we can get by without it. rdar://46288577 llvm-svn: 348218
* [Hexagon] Fix intrinsic testKrzysztof Parzyszek2018-12-031-4/+0
| | | | llvm-svn: 348214
* Relax test even more for WindowsAdrian Prantl2018-12-031-1/+1
| | | | llvm-svn: 348213
* Relax tests to also work on WindowsAdrian Prantl2018-12-032-5/+9
| | | | llvm-svn: 348211
* [analyzer] MoveChecker: Restrict to locals and std:: objects.Artem Dergachev2018-12-031-15/+86
| | | | | | | | | | | | | | | | | | | | | | | | In general case there use-after-move is not a bug. It depends on how the move-constructor or move-assignment is implemented. In STL, the convention that applies to most classes is that the move-constructor (-assignment) leaves an object in a "valid but unspecified" state. Using such object without resetting it to a known state first is likely a bug. Objects Local value-type variables are special because due to their automatic lifetime there is no intention to reuse space. If you want a fresh object, you might as well make a new variable, no need to move from a variable and than re-use it. Therefore, it is not always a bug, but it is obviously easy to suppress when it isn't, and in most cases it indeed is - as there's no valid intention behind the intentional use of a local after move. This applies not only to local variables but also to parameter variables, not only of value type but also of rvalue reference type (but not to lvalue references). Differential Revision: https://reviews.llvm.org/D54557 llvm-svn: 348210
* [analyzer] MoveChecker: NFC: Remove the workaround for the "zombie symbols" bug.Artem Dergachev2018-12-031-0/+12
| | | | | | | | | | | | | | | | | | The checker had extra code to clean up memory regions that were sticking around in the checker without ever being cleaned up due to the bug that was fixed in r347953. Because of that, if a region was moved from, then became dead, and then reincarnated, there were false positives. Why regions are even allowed to reincarnate is a separate story. Luckily, this only happens for local regions that don't produce symbols when loaded from. No functional change intended. The newly added test demonstrates that even though no cleanup is necessary upon destructor calls, the early return cannot be removed. It was not failing before the patch. Differential Revision: https://reviews.llvm.org/D54372 llvm-svn: 348208
* [analyzer] Rename MisusedMovedObjectChecker to MoveCheckerArtem Dergachev2018-12-031-2/+6
| | | | | | | | | This follows the Static Analyzer's tradition to name checkers after things in which they find bugs, not after bugs they find. Differential Revision: https://reviews.llvm.org/D54556 llvm-svn: 348201
* [analyzer] Dump stable identifiers for objects under construction.Artem Dergachev2018-12-031-3/+10
| | | | | | | | | | This continues the work that was started in r342313, which now gets applied to object-under-construction tracking in C++. Makes it possible to debug temporaries by dumping exploded graphs again. Differential Revision: https://reviews.llvm.org/D54459 llvm-svn: 348200
* Re-apply r347954 "[analyzer] Nullability: Don't detect post factum violation..."Artem Dergachev2018-12-032-2/+72
| | | | | | | | | | | Buildbot failures were caused by an unrelated UB that was introduced in r347943 and fixed in r347970. Also the revision was incorrectly specified as r344580 during revert. Differential Revision: https://reviews.llvm.org/D54017 llvm-svn: 348188
* [gcov/Darwin] Ensure external symbols are exported when using an export listVedant Kumar2018-12-031-1/+13
| | | | | | | | | | | | | | Make sure that symbols needed to implement runtime support for gcov are exported when using an export list on Darwin. Without the clang driver exporting these symbols, the linker hides them, resulting in tapi verification failures. rdar://45944768 Differential Revision: https://reviews.llvm.org/D55151 llvm-svn: 348187
* Adding tests for -ast-dump; NFC.Aaron Ballman2018-12-031-0/+239
| | | | | | This adds tests for struct and union declarations in C++. llvm-svn: 348156
* Avoid emitting redundant or unusable directories in DIFile metadata entries.Adrian Prantl2018-12-033-7/+26
| | | | | | | | | | | | | | | | | | | | | | | 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
* [AArch64] Add command-line option for SSBSPablo Barrio2018-12-031-0/+9
| | | | | | | | | | | | | | | | | | Summary: SSBS (Speculative Store Bypass Safe) is only mandatory from 8.5 onwards but is optional from Armv8.0-A. This patch adds testing for the ssbs command line option, added to allow enabling the feature in previous Armv8-A architectures to 8.5. Reviewers: olista01, samparker, aemerson Reviewed By: samparker Subscribers: javed.absar, kristof.beyls, cfe-commits Differential Revision: https://reviews.llvm.org/D54961 llvm-svn: 348142
* [CodeComplete] Cleanup access checking in code completionIlya Biryukov2018-12-032-0/+96
| | | | | | | | | | | | | | Summary: Also fixes a crash (see the added 'accessibility-crash.cpp' test). Reviewers: ioeric, kadircet Reviewed By: kadircet Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55124 llvm-svn: 348135
* [Analysis] Properly prepare test env in test/Analysis/undef-call.cIlya Biryukov2018-12-031-0/+2
| | | | | | The test expectes the '%T/ctudir' to be present, but does not create it. llvm-svn: 348124
* [clang] Do not read from 'test/SemaCXX/Inputs' inside 'test/AST'Ilya Biryukov2018-12-032-1/+38
| | | | | | | Our integrate relies on test inputs being taken from the same diretory as the test itself. llvm-svn: 348123
* Fix whitespaceStephen Kelly2018-12-021-1/+1
| | | | llvm-svn: 348094
* Add dump tests for ArrayInitLoopExpr and ArrayInitIndexExprStephen Kelly2018-12-021-0/+10
| | | | llvm-svn: 348093
* OpenCL: Improve vector printf warningsMatt Arsenault2018-12-012-10/+94
| | | | | | | | | | | | The vector modifier is considered separate, so don't treat it as a conversion specifier. This is still not warning on some cases, like using a type that isn't a valid vector element. Fixes bug 39652 llvm-svn: 348084
* OpenCL: Extend argument promotion rules to vector typesMatt Arsenault2018-12-011-0/+39
| | | | | | | | The spec is ambiguous on whether vector types are allowed to be implicitly converted. The only legal context I think this can be used for OpenCL is printf, where it seems necessary. llvm-svn: 348083
* Specify constant context in constant emitterBill Wendling2018-12-012-3/+171
| | | | | | | The constant emitter may need to evaluate the expression in a constant context. For exasmple, global initializer lists. llvm-svn: 348070
* Relax test to also work on Windows.Adrian Prantl2018-12-011-1/+1
| | | | llvm-svn: 348062
* Honor -fdebug-prefix-map when creating function names for the debug info.Adrian Prantl2018-12-011-0/+10
| | | | | | | | | | | | | This adds a callback to PrintingPolicy to allow CGDebugInfo to remap file paths according to -fdebug-prefix-map. Otherwise the debug info (particularly function names for C++ lambdas) may contain paths that should have been remapped in the debug info. <rdar://problem/46128056> Differential Revision: https://reviews.llvm.org/D55137 llvm-svn: 348060
OpenPOWER on IntegriCloud