summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
* [ASTMatchers] add matcher for decltypeType and its underlyingTypeJonas Toth2018-07-234-0/+34
| | | | | | | | | | | | | | | | Summary: This patch introduces a new matcher for `DecltypeType` and its underlying type in order to fix a bug in clang-tidy, see https://reviews.llvm.org/D48717 for more. Reviewers: aaron.ballman, alexfh, NoQ, dcoughlin Reviewed By: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48759 llvm-svn: 337703
* [NEON] Define half-precision vrnd intrinsics only when availableIvan A. Kosarev2018-07-232-6/+64
| | | | | | Differential Revision: https://reviews.llvm.org/D49376 llvm-svn: 337699
* [NEON] Fix support for vrndi_f32(), vrndiq_f32() and vrndns_f32() intrinsicsIvan A. Kosarev2018-07-235-188/+87
| | | | | | | | | | This patch adds support for vrndi_f32() and vrndiq_f32() intrinsics in AArch32 mode and for vrndns_f32() intrinsic in AArch64 mode. Differential Revision: https://reviews.llvm.org/D48829 llvm-svn: 337690
* [AST] Use llvm::TrailingObjects in CXXTryStmtBenjamin Kramer2018-07-232-17/+12
| | | | | | | | | | | | | | 1. Use llvm::TrailingObjects in CXXTryStmt instead of manually doing the reinterpret_casts + pointer arithmetic. This is more consistent with other classes using this idiom and this make it clearer that this class has trailing objects. 2. Make the class CXXTryStmt final since it has trailing objects. 3. Move the friend declarations together. No functional changes. Patch by Bruno Ricci! Differential Revision: https://reviews.llvm.org/D48873 llvm-svn: 337688
* [Tooling] Use UniqueStringSaver. NFCSam McCall2018-07-232-13/+3
| | | | llvm-svn: 337682
* Fix for last commit: adding new test file forgotten.Adam Balogh2018-07-231-0/+43
| | | | llvm-svn: 337679
* [Analyzer] Quick Fix for exponential execution time when simpilifying ↵Adam Balogh2018-07-237-28/+94
| | | | | | | | | | | | | | | | | | complex additive expressions Patch https://reviews.llvm.org/rC329780 not only rearranges comparisons but also binary expressions. This latter behavior is not protected by the analyzer option. Hower, since no complexity threshold is enforced to the symbols this may result in exponential execution time if the expressions are too complex: https://bugs.llvm.org/show_bug.cgi?id=38208. For a quick fix we extended the analyzer option to also cover the additive cases. This is only a temporary fix, the final solution should be enforcing the complexity threshold to the symbols. Differential Revision: https://reviews.llvm.org/D49536 llvm-svn: 337678
* Revert "Fold dangling-field warning into general initialization lifetime ↵Ilya Biryukov2018-07-235-191/+152
| | | | | | | | | | | | | | | | checks." This reverts commit r337627. After the change, clang started producing invalid warning on the following code: struct foo { foo(char *x) : x_(&x[10]) {} private: char *x_; }; 1.cpp:2:21: warning: initializing pointer member 'x_' with the stack address of parameter 'x' [-Wdangling-field] llvm-svn: 337671
* Fix the testBrad Smith2018-07-221-1/+2
| | | | llvm-svn: 337663
* OpenBSD/arm has switched to float ABI SoftFP.Brad Smith2018-07-222-2/+2
| | | | llvm-svn: 337660
* PR38257: don't perform ADL when instantiating a unary & operator that turns outRichard Smith2018-07-224-4/+52
| | | | | | to be forming a pointer-to-member. llvm-svn: 337653
* [HIP] Support -fcuda-flush-denormals-to-zero for amdgcnYaxun Liu2018-07-215-7/+20
| | | | | | Differential Revision: https://reviews.llvm.org/D48287 llvm-svn: 337639
* [NFC] CodeGen: rename memset to bzeroJF Bastien2018-07-201-30/+27
| | | | | | The optimization looks for opportunities to emit bzero, not memset. Rename the functions accordingly (and clang-format the diff) because I want to add a fallback optimization which actually tries to generate memset. bzero is still better and it would confuse the code to merge both. llvm-svn: 337636
* [Driver] Sanitizer support based on runtime library presenceGeorge Karpenkov2018-07-2022-42/+106
| | | | | | | | | | | | | | | The runtime libraries of sanitizers are built in compiler-rt, and Clang can be built without compiler-rt, or compiler-rt can be configured to only build certain sanitizers. The driver should provide reasonable diagnostics and not a link-time error when a runtime library is missing. This patch changes the driver for OS X to only support sanitizers of which we can find the runtime libraries. The discussion for this patch explains the rationale Differential Revision: https://reviews.llvm.org/D15225 llvm-svn: 337635
* [HIP] Register/unregister device fat binary only onceYaxun Liu2018-07-202-21/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | HIP generates one fat binary for all devices after linking. However, for each compilation unit a ctor function is emitted which register the same fat binary. Measures need to be taken to make sure the fat binary is only registered once. Currently each ctor function calls __hipRegisterFatBinary and stores the returned value to __hip_gpubin_handle. This patch changes the linkage of __hip_gpubin_handle to be linkonce so that they are shared between LLVM modules. Then this patch adds check of value of __hip_gpubin_handle to make sure __hipRegisterFatBinary is only called once. The code is equivalent to void *_gpubin_handle; void ctor() { if (__hip_gpubin_handle == 0) { __hip_gpubin_handle = __hipRegisterFatBinary(...); } // register kernels and variables. } The patch also does similar change to dtors so that __hipUnregisterFatBinary is called once. Differential Revision: https://reviews.llvm.org/D49083 llvm-svn: 337631
* Disable clang crash-report-modules.m test on Windows againReid Kleckner2018-07-201-0/+4
| | | | | | | | | | | It still appears to be failing: http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/12825 $ "rm" "-rf" "C:\b\slave\clang-x86-windows-msvc2015\clang-x86-windows-msvc2015\stage1\tools\clang\test\Driver\Output/crmdir" Error: 'rm' command failed, [Error 3] The system cannot find the path specified: 'C:\\b\\slave\\clang-x86-windows-msvc2015\\clang-x86-windows-msvc2015\\stage1\\tools\\clang\\test\\Driver\\Output/crmdir\\crash-report-modules-300567.cache\\vfs\\b\\slave\\clang-x86-windows-msvc2015\\clang-x86-windows-msvc2015\\llvm\\tools\\clang\\test\\Driver\\Inputs\\module\\module.modulemap' error: command failed with exit status: 1 llvm-svn: 337629
* Fold dangling-field warning into general initialization lifetime checks.Richard Smith2018-07-205-152/+191
| | | | llvm-svn: 337627
* fix typoNico Weber2018-07-201-1/+1
| | | | llvm-svn: 337620
* [ms] Add __shiftleft128 / __shiftright128 intrinsicsNico Weber2018-07-202-0/+16
| | | | | | | | | | | | Carefully match the pattern matched by ISel so that this produces shld / shrd (unless Subtarget->isSHLDSlow() is true). Thanks to Craig Topper for providing the LLVM IR pattern that gets successfully matched. Fixes PR37755. llvm-svn: 337619
* [codeview] Don't emit variable templates as class membersReid Kleckner2018-07-202-5/+45
| | | | | | | | | | | | | MSVC doesn't, so neither should we. Fixes PR38004, which is a crash that happens when we try to emit debug info for a still-dependent partial variable template specialization. As a follow-up, we should review what we're doing for function and class member templates. It looks like we don't filter those out, but I can't seem to get clang to emit any. llvm-svn: 337616
* AMDGPU: Switch default dwarf version to 2Konstantin Zhuravlyov2018-07-202-2/+2
| | | | | | | | | There were some problems unearthed with version 5, which I am going to look at. Differential Revision: https://reviews.llvm.org/D49613 llvm-svn: 337612
* [CStringSyntaxChecker] Fix build bot builds != x86 archsDavid Carlier2018-07-202-8/+13
| | | | | | | | | | Reviewers: NoQ,george.karpenkov Reviewed By: NoQ Differential Revision: https://reviews.llvm.org/D49588 llvm-svn: 337611
* [AST] Various micro-optimizations in CXXInheritanceBenjamin Kramer2018-07-202-28/+33
| | | | | | | | | | | | | | | | | 1. Pack std::pair<bool, unsigned> in CXXBasePaths::ClassSubobjects. 2. Use a SmallPtrSet instead of a SmallDenseSet for CXXBasePaths::VisitedDependentRecords. 3. Reorder some members of CXXBasePaths to save 8 bytes. 4. Use a SmallSetVector instead of a SetVector in CXXBasePaths::ComputeDeclsFound to avoid some allocations. This speeds up an -fsyntax-only on all of Boost by approx 0.15%, mainly by speeding up CXXBasePaths::lookupInBases by approx 10%. No functional changes. Patch by Bruno Ricci! Differential Revision: https://reviews.llvm.org/D49302 llvm-svn: 337607
* [CUDA] Provide integer SIMD functions for CUDA-9.2Artem Belevich2018-07-202-1/+429
| | | | | | | | | | | | | | | | | | | | | CUDA-9.2 made all integer SIMD functions into compiler builtins, so clang no longer has access to the implementation of these functions in either headers of libdevice and has to provide its own implementation. This is mostly a 1:1 mapping to a corresponding PTX instructions with an exception of vhadd2/vhadd4 that don't have an equivalent instruction and had to be implemented with a bit hack. Performance of this implementation will be suboptimal for SM_50 and newer GPUs where PTXAS generates noticeably worse code for the SIMD instructions compared to the code it generates for the inline assembly generated by nvcc (or used to come with CUDA headers). Differential Revision: https://reviews.llvm.org/D49274 llvm-svn: 337587
* Prevent Scoped Enums from being Integral constant expressions:Erich Keane2018-07-202-1/+15
| | | | | | | | | | | | | | | | Discovered because of: https://bugs.llvm.org/show_bug.cgi?id=38235 It seems to me that a scoped enum should NOT be an integral constant expression without a cast, so this seems like a sensical change. Attributes that check for an integer parameter simply use this function to ensure that they have an integer, so it was previously allowing a scoped enum. Also added a test based on Richard's feedback to ensure that case labels still work. Differential Revision: https://reviews.llvm.org/D49599 llvm-svn: 337585
* [CodeGen][ObjC] Make copying and disposing of a non-escaping blockAkira Hatanaka2018-07-204-6/+74
| | | | | | | | | | | | | | | | | | | | | | no-ops. A non-escaping block on the stack will never be called after its lifetime ends, so it doesn't have to be copied to the heap. To prevent a non-escaping block from being copied to the heap, this patch sets field 'isa' of the block object to NSConcreteGlobalBlock and sets the BLOCK_IS_GLOBAL bit of field 'flags', which causes the runtime to treat the block as if it were a global block (calling _Block_copy on the block just returns the original block and calling _Block_release is a no-op). Also, a new flag bit 'BLOCK_IS_NOESCAPE' is added, which allows the runtime or tools to distinguish between true global blocks and non-escaping blocks. rdar://problem/39352313 Differential Revision: https://reviews.llvm.org/D49303 llvm-svn: 337580
* Rewrite the VS integration scripts.Zachary Turner2018-07-201-4/+0
| | | | | | | | | | | | | | | | | | | | | | | This is a new modernized VS integration installer. It adds a Visual Studio .sln file which, when built, outputs a VSIX that can be used to install ourselves as a "real" Visual Studio Extension. We can even upload this extension to the visual studio marketplace. This fixes a longstanding problem where we didn't support installing into VS 2017 and higher. In addition to supporting VS 2017, due to the way this is written we now longer need to do anything special to support future versions of VS as well. Everything should "just work". This also fixes several bugs with our old integration, such as MSBuild triggering full rebuilds when /Zi was used. Finally, we add a new UI page called "LLVM" which becomes visible when the LLVM toolchain is selected. For now this only contains one option which is the path to clang-cl.exe, but in the future we can add more things here. Differential Revision: https://reviews.llvm.org/D42762 llvm-svn: 337572
* [analyzer] Rename DanglingInternalBufferChecker to InnerPointerChecker.Reka Kovacs2018-07-206-41/+39
| | | | | | Differential Revision: https://reviews.llvm.org/D49553 llvm-svn: 337559
* [www] Add CodeCompass and CodeChecker to Clang Related Projects pageBruno Cardoso Lopes2018-07-201-0/+22
| | | | llvm-svn: 337555
* Implement cpu_dispatch/cpu_specific MultiversioningErich Keane2018-07-2027-222/+1317
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As documented here: https://software.intel.com/en-us/node/682969 and https://software.intel.com/en-us/node/523346. cpu_dispatch multiversioning is an ICC feature that provides for function multiversioning. This feature is implemented with two attributes: First, cpu_specific, which specifies the individual function versions. Second, cpu_dispatch, which specifies the location of the resolver function and the list of resolvable functions. This is valuable since it provides a mechanism where the resolver's TU can be specified in one location, and the individual implementions each in their own translation units. The goal of this patch is to be source-compatible with ICC, so this implementation diverges from the ICC implementation in a few ways: 1- Linux x86/64 only: This implementation uses ifuncs in order to properly dispatch functions. This is is a valuable performance benefit over the ICC implementation. A future patch will be provided to enable this feature on Windows, but it will obviously more closely fit ICC's implementation. 2- CPU Identification functions: ICC uses a set of custom functions to identify the feature list of the host processor. This patch uses the cpu_supports functionality in order to better align with 'target' multiversioning. 1- cpu_dispatch function def/decl: ICC's cpu_dispatch requires that the function marked cpu_dispatch be an empty definition. This patch supports that as well, however declarations are also permitted, since the linker will solve the issue of multiple emissions. Differential Revision: https://reviews.llvm.org/D47474 llvm-svn: 337552
* Sema: Fix explicit address space cast in C++Yaxun Liu2018-07-203-0/+32
| | | | | | | | | | | | | | | | | | | | | Currently clang does not allow implicit cast of a pointer to a pointer type in different address space but allows C-style cast of a pointer to a pointer type in different address space. However, there is a bug in Sema causing incorrect Cast Expr in AST for the latter case, which in turn results in invalid LLVM IR in codegen. This is because Sema::IsQualificationConversion returns true for a cast of pointer to a pointer type in different address space, which in turn allows a standard conversion and results in a cast expression with no op in AST. This patch fixes that by let Sema::IsQualificationConversion returns false for a cast of pointer to a pointer type in different address space, which in turn disallows standard conversion, implicit cast, and static cast. Finally it results in an reinterpret cast and correct conversion kind is set. Differential Revision: https://reviews.llvm.org/D49294 llvm-svn: 337540
* Change \t to spacesFangrui Song2018-07-2022-37/+38
| | | | llvm-svn: 337530
* [Index] Set OrigD before D is changed.Eric Liu2018-07-204-3/+26
| | | | | | | | | | | | Reviewers: akyrtzi, arphaman Reviewed By: akyrtzi Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D49476 llvm-svn: 337529
* Document -fobjc-weak as an extension.John McCall2018-07-201-0/+45
| | | | | | Fixes rdar://24091053. llvm-svn: 337525
* Fix and improve the ARC spec's wording about unmanaged objects.John McCall2018-07-201-19/+57
| | | | llvm-svn: 337524
* Fix typo causing assert in self-host.Richard Smith2018-07-192-1/+12
| | | | llvm-svn: 337508
* [docs] Correct -fvisibility-inlines-hidden descriptionFangrui Song2018-07-192-2/+2
| | | | llvm-svn: 337505
* [CStringSyntaxChecker] Check strlcpy sizeof syntaxDavid Carlier2018-07-193-1/+78
| | | | | | | | | | | | | | | | | The last argument is expected to be the destination buffer size (or less). Detects if it points to destination buffer size directly or via a variable. Detects if it is an integral, try to detect if the destination buffer can receive the source length. Updating bsd-string.c unit tests as it make it fails now. Reviewers: george.karpenpov, NoQ Reviewed By: george.karpenkov Differential Revision: https://reviews.llvm.org/D48884 llvm-svn: 337499
* When we choose to use zeroinitializer for a trailing portion of an arrayRichard Smith2018-07-192-1/+17
| | | | | | | | | | | constant, don't convert the rest into a packed struct. If an array constant has a large non-zero portion and a large zero portion, we want to emit the first part as an array and the rest as a zeroinitializer if possible. This fixes a memory usage regression from r333141 when compiling PHP. llvm-svn: 337498
* [Sema] Diagnose an invalid dependent function template specializationErik Pilkington2018-07-193-5/+57
| | | | | | | | | | | Previously, clang marked the specialization as invalid without emitting a diagnostic. This lead to an assert in CodeGen. rdar://41806724 Differential revision: https://reviews.llvm.org/D49085 llvm-svn: 337497
* Fix failing testcase to actually be valid.Richard Smith2018-07-191-1/+1
| | | | llvm-svn: 337483
* Fix template argument deduction when a parameter pack has a valueRichard Smith2018-07-198-134/+385
| | | | | | | | | | | | | | provided by an outer template. We made the incorrect assumption in various places that the only way we can have any arguments already provided for a pack during template argument deduction was from a partially-specified pack. That's not true; we can also have arguments from an enclosing already-instantiated template, and that can even result in the function template's own pack parameters having a fixed length and not being packs for the purposes of template argument deduction. llvm-svn: 337481
* fix typo in commentNico Weber2018-07-191-1/+1
| | | | llvm-svn: 337480
* [analyzer] Fix memory sanitizer error in MallocChecker.Reka Kovacs2018-07-191-3/+3
| | | | | | | | StringRef's data() returns a string that may be non-null-terminated. Switch to using StringRefs from const char pointers in visitor notes to avoid problems. llvm-svn: 337474
* Fix unused variable warning.Erich Keane2018-07-191-1/+1
| | | | llvm-svn: 337473
* [analyzer] Memoize complexity of SymExprMikhail R. Gadelha2018-07-194-9/+32
| | | | | | | | | | | | | | | | | Summary: This patch introduces a new member to SymExpr, which stores the symbol complexity, avoiding recalculating it every time computeComplexity() is called. Also, increase the complexity of conjured Symbols by one, so it's clear that it has a greater complexity than its underlying symbols. Reviewers: NoQ, george.karpenkov Reviewed By: NoQ, george.karpenkov Subscribers: xazax.hun, szepet, a.sidorin Differential Revision: https://reviews.llvm.org/D49232 llvm-svn: 337472
* [Sema] Add a new warning, -Wmemset-transposed-argsErik Pilkington2018-07-194-12/+176
| | | | | | | | | | | | | | | This diagnoses calls to memset that have the second and third arguments transposed, for example: memset(buf, sizeof(buf), 0); This is done by checking if the third argument is a literal 0, or if the second is a sizeof expression (and the third isn't). The first check is also done for calls to bzero. Differential revision: https://reviews.llvm.org/D49112 llvm-svn: 337470
* The patch adds support for the new map interface between clang and ↵Alexey Bataev2018-07-1945-1156/+1611
| | | | | | | | | | | libomptarget. The changes in the interface are the following: device IDs are now 64-bit integers (as opposed to 32-bit) map flags are 64-bit long (used to be 32-bit) mappings for partially mapped structs are now calculated at compile time and members of partially mapped structs are flagged using the MEMBER_OF field Support for is_device_ptr on struct members was dropped - this functionality is not supported by the OpenMP standard and its implementation is technically infeasible (however, use_device_ptr on struct members works as a non-standard extension of the compiler) llvm-svn: 337468
* [analyzer] Fix disappearing notes in DanglingInternalBufferChecker testsReka Kovacs2018-07-191-2/+3
| | | | | | Correct a mistake of the exact same kind I am writing this checker for. llvm-svn: 337466
* [analyzer] Add support for more basic_string API inReka Kovacs2018-07-193-71/+271
| | | | | | | | | | | | | DanglingInternalBufferChecker. A pointer referring to the elements of a basic_string may be invalidated by calling a non-const member function, except operator[], at, front, back, begin, rbegin, end, and rend. The checker now warns if the pointer is used after such operations. Differential Revision: https://reviews.llvm.org/D49360 llvm-svn: 337463
OpenPOWER on IntegriCloud