summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [X86] Remove some unnecessarily escaped new lines from avx512fintrin.hCraig Topper2018-07-071-10/+10
| | | | llvm-svn: 336499
* [X86] Fix a few intrinsics that were ignoring their rounding mode argument ↵Craig Topper2018-07-071-5/+5
| | | | | | | | | | and hardcoded _MM_FROUND_CUR_DIRECTION internally. I believe these have been broken since their introduction into clang. I've enhanced the tests for these intrinsics to using a real rounding mode and checking all the intrinsic arguments instead of just the name. llvm-svn: 336498
* [analyzer] Add support for data() in DanglingInternalBufferChecker.Reka Kovacs2018-07-071-5/+6
| | | | | | | | | DanglingInternalBufferChecker now tracks use-after-free problems related to the incorrect usage of std::basic_string::data(). Differential Revision: https://reviews.llvm.org/D48532 llvm-svn: 336497
* [analyzer] Highlight c_str() call in DanglingInternalBufferChecker.Reka Kovacs2018-07-073-10/+88
| | | | | | | | | | Add a bug visitor to DanglingInternalBufferChecker that places a note at the point where the dangling pointer was obtained. The visitor is handed over to MallocChecker and attached to the report there. Differential Revision: https://reviews.llvm.org/D48522 llvm-svn: 336495
* [analyzer] Fix -Wcovered-switch-default warning in MallocChecker.Reka Kovacs2018-07-071-1/+0
| | | | | | Remove unnecessary default case that caused buildbot failures. llvm-svn: 336493
* [analyzer] Highlight container object destruction in MallocChecker.Reka Kovacs2018-07-071-14/+46
| | | | | | | | | Extend MallocBugVisitor to place a note at the point where objects with AF_InternalBuffer allocation family are destroyed. Differential Revision: https://reviews.llvm.org/D48521 llvm-svn: 336489
* [X86] Change _mm512_shuffle_pd and _mm512_shuffle_ps to use target specific ↵Craig Topper2018-07-071-28/+4
| | | | | | | | shuffle builtins instead of generic __builtin_shufflevector. I added the builtins for 128, 256, and 512 bits recently but looks like I failed to convert to using the 512 bit one. llvm-svn: 336488
* [X86] Fix various type mismatches in intrinsic headers and intrinsic tests ↵Craig Topper2018-07-073-48/+48
| | | | | | | | that cause extra bitcasts to be emitted in the IR. Found via imprecise grepping of the -O0 IR. There could still be more bugs out there. llvm-svn: 336487
* P0806R2 Implicit capture of this with a capture-default of [=] isRichard Smith2018-07-071-0/+11
| | | | | | | | | | deprecated. Add a -Wdeprecated warning for this in C++2a onwards. (In C++17 and before, there isn't a reasonable alternative because [=,this] is ill-formed.) llvm-svn: 336480
* [Sema] Emit -Wincomplete-implementation for partial methods.Erik Pilkington2018-07-071-10/+2
| | | | | | Fixes rdar://40634455 llvm-svn: 336478
* Check returned type is valid before using it.Richard Trieu2018-07-071-0/+3
| | | | | | Add a .isNull() check to returned QualType. Fixes PR38077 llvm-svn: 336475
* [X86] When creating a select for scalar masked sqrt and div builtins make ↵Craig Topper2018-07-061-12/+19
| | | | | | | | | | sure we optimize the all ones mask case. This case occurs in the intrinsic headers so we should avoid emitting the mask in those cases. Factor the code into a helper function to make this easy. llvm-svn: 336472
* [MachineOutliner] Properly pass -moutline along to the toolchainJessica Paquette2018-07-062-9/+13
| | | | | | | | | | This moves the LTO-specific code for outlining from ToolChains/Clang.cpp to ToolChains/Darwin.cpp. Passing -mllvm flags isn't sufficient for making sure that the specified pass will actually run in LTO. This makes sure that when -moutline is passed, the MachineOutliner will actually be added to the LTO pass pipeline as expected. llvm-svn: 336471
* [X86] Add missing scalar fma intrinsics with rounding, but no mask.Craig Topper2018-07-061-0/+48
| | | | | | | | We had the mask versions of the rounding intrinsics, but not one without masking. Also change the rounding tests to not use the CUR_DIRECTION rounding mode. llvm-svn: 336470
* [ASTMatchers] A matcher for Objective-C @autoreleasepoolGeorge Karpenkov2018-07-062-0/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D48910 llvm-svn: 336468
* [OPENMP] Fix PR38026: Link -latomic when -fopenmp is used.Alexey Bataev2018-07-061-1/+5
| | | | | | | On Linux atomic constructs in OpenMP require libatomic library. Patch links libatomic when -fopenmp is used. llvm-svn: 336467
* [OPENMP] Make clauses closing loc point to right bracket.Alexey Bataev2018-07-061-13/+20
| | | | | | | | For some of the clauses the closing location erroneously points to the beginning of the next clause rather than on the location of the closing bracket of the clause. llvm-svn: 336460
* [Driver,AArch64] Add support for -mcpu=native.Florian Hahn2018-07-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | This patches adds support for passing -mcpu=native for AArch64. It will get turned into the host CPU name, before we get the target features. CPU = native is handled in a similar fashion in getAArch64MicroArchFetauresFromMtune and getAArch64TargetCPU already. Having a good test case for this is hard, as it depends on the host CPU of the machine running the test. But we can check that native has been replaced with something else. When cross-compiling, we will get a CPU name from the host architecture and get ` the clang compiler does not support '-mcpu=native'` as error message, which seems reasonable to me. Reviewers: rengolin, peter.smith, dlj, javed.absar, t.p.northover Reviewed By: peter.smith Tags: #clang Differential Revision: https://reviews.llvm.org/D48931 llvm-svn: 336429
* [SemaCodeComplete] Expose a method to create CodeCompletionString for macros.Eric Liu2018-07-061-44/+49
| | | | | | | | | | | | | | | | | Summary: The method only takes PPreprocessor and don't require structures that might not be available (e.g. Sema and ASTContext) when CodeCompletionString needs to be generated for macros. Reviewers: sammccall Reviewed By: sammccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48973 llvm-svn: 336427
* [X86] Implement _builtin_ia32_vfmaddss and _builtin_ia32_vfmaddsd with ↵Craig Topper2018-07-061-0/+10
| | | | | | | | native IR using llvm.fma intrinsic. This generates some extra zeroing currently, but we should be able to quickly address that with some isel patterns. llvm-svn: 336417
* [ms] Fix mangling of string literals used to initialize arrays larger or ↵Hans Wennborg2018-07-061-21/+23
| | | | | | | | | | | | | | | | | | | | | | | | smaller than the literal A Chromium developer reported a bug which turned out to be a mangling collision between these two literals: char s[] = "foo"; char t[32] = "foo"; They may look the same, but for the initialization of t we will (under some circumstances) use a literal that's extended with zeros, and both the length and those zeros should be accounted for by the mangling. This actually makes the mangling code simpler: where it previously had special logic for null terminators, which are not part of the StringLiteral, that is now covered by the general algorithm. (The problem was reported at https://crbug.com/857442) Differential Revision: https://reviews.llvm.org/D48928 llvm-svn: 336415
* [Sema] -Wformat-pedantic only for NSInteger/NSUInteger %tu/%td on DarwinAlex Lorenz2018-07-052-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The '%tu'/'%td' as formatting specifiers have been used to print out the NSInteger/NSUInteger values for a long time. Typically their ABI matches, but that's not the case on watchOS. The ABI difference boils down to the following: - Regular 32-bit darwin targets (like armv7) use 'ptrdiff_t' of type 'int', which matches 'NSInteger'. - WatchOS arm target (armv7k) uses 'ptrdiff_t' of type 'long', which doesn't match 'NSInteger' of type 'int'. Because of this ABI difference these specifiers trigger -Wformat warnings only for watchOS builds, which is really inconvenient for cross-platform code. This patch avoids this -Wformat warning for '%tu'/'%td' and NS[U]Integer only, and instead uses the new -Wformat-pedantic warning that JF introduced in https://reviews.llvm.org/D47290. This is acceptable because Darwin guarantees that, despite the watchOS ABI differences, sizeof(ptrdiff_t) == sizeof(NS[U]Integer), and alignof(ptrdiff_t) == alignof(NS[U]Integer) so the warning is therefore noisy for pedantic reasons. I'll update public documentation to ensure that this behaviour is properly communicated. rdar://41739204 Differential Revision: https://reviews.llvm.org/D48852 llvm-svn: 336396
* [X86] Use shufflevector instead of a select with a constant mask for ↵Craig Topper2018-07-051-8/+4
| | | | | | | | | | fmaddsub/fmsubadd IR emission. Shufflevector is easier to generate and matches what the backend pattern matches without relying on constant selects being turned into shuffles. While I was there I also made the IR regular expressions a little stricter to ensure operand order on the shuffle. llvm-svn: 336388
* [clang-cl, PCH] Implement support for MS-style PCH through headersErich Keane2018-07-059-117/+168
| | | | | | | | | | | | | | | | | | | | | Implement support for MS-style PCH through headers. This enables support for /Yc and /Yu where the through header is either on the command line or included in the source. It replaces the current support the requires the header also be specified with /FI. This change adds a -cc1 option -pch-through-header that is used to either start or stop compilation during PCH create or use. When creating a PCH, the compilation ends after compilation of the through header. When using a PCH, tokens are skipped until after the through header is seen. Patch By: mikerice Differential Revision: https://reviews.llvm.org/D46652 llvm-svn: 336379
* Fix __builtin_*_overflow when out-param isn't constexprErich Keane2018-07-051-1/+2
| | | | | | | | | | | | | | | As brought up on cfe-commits[1], r334650 causes the dependency of the out parameter to the __builtin_*_overflow functions to be ignored. The result was a usage that was otherwise constexpr (both operands to the operation were constexpr) would be evaluated, but the out parameter wouldn't be modified, so it would still be 'undef'. This patch correctly handles the return value of handleAssignment to ensure that this value is properly considered/evaluated. [1] http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180702/233667.html llvm-svn: 336364
* [X86] Fix some vector cmp builtins - TRUE/FALSE predicatesGabor Buella2018-07-051-37/+32
| | | | | | | | | | | | | | | | | This patch removes on optimization used with the TRUE/FALSE predicates, as was suggested in https://reviews.llvm.org/D45616 for r335339. The optimization was buggy, since r335339 used it also for *_mask builtins, without actually applying the mask -- the mask argument was just ignored. Reviewers: craig.topper, uriel.k, RKSimon, andrew.w.kaylor, spatel, scanon, efriedma Reviewed By: spatel Differential Revision: https://reviews.llvm.org/D48715 llvm-svn: 336355
* [mips] Add '-mcrc', '-mno-crc' options to enable/disable CRC ASEVladimir Stefanovic2018-07-051-0/+2
| | | | | | | | | '-mcrc' is shared with ARM. '-mno-crc' is Mips-only (ARM uses '-mnocrc'). Differential revision: https://reviews.llvm.org/D48169 llvm-svn: 336347
* [ASTImporter] Fix import of objects with anonymous typesGabor Marton2018-07-051-11/+2
| | | | | | | | | | | | | | | | Summary: Currently, anonymous types are merged into the same redecl chain even if they are structurally inequivalent. This results that global objects are not imported, if there are at least two global objects with different anonymous types. This patch provides a fix. Reviewers: a.sidorin, balazske, r.stahl Subscribers: rnkovacs, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D48773 llvm-svn: 336332
* [NFS] Wipe trailing whitespacesKirill Bobyrev2018-07-051-740/+740
| | | | | | | | This patch is a preparation for another one containing meaningful changes. This patch simply removes trailing whitespaces in few files affected by the upcoming patch and reformats llvm-svn: 336330
* [Power9] Update fp128 as a valid homogenous aggregate base typeLei Huang2018-07-051-4/+9
| | | | | | | | | Update clang to treat fp128 as a valid base type for homogeneous aggregate passing and returning. Differential Revision: https://reviews.llvm.org/D48044 llvm-svn: 336308
* [Index] Remove unused index::IndexDataConsumer::_anchor()Fangrui Song2018-07-051-2/+0
| | | | | | It was supposed to serve as a key function, but it was invalid as it was not the first out-of-line non-pure virtual function. llvm-svn: 336300
* [analyzer][ctu] fix unsortable diagnosticsRafael Stahl2018-07-041-3/+7
| | | | | | | | | | | | | | Summary: In the provided test case the PathDiagnostic compare function was not able to find a difference. Reviewers: xazax.hun, NoQ, dcoughlin, george.karpenkov Reviewed By: george.karpenkov Subscribers: a_sidorin, szepet, rnkovacs, a.sidorin, mikhail.ramalho, cfe-commits Differential Revision: https://reviews.llvm.org/D48474 llvm-svn: 336275
* [ASTImporter] import macro source locationsRafael Stahl2018-07-041-37/+46
| | | | | | | | | | | | | | Summary: Implement full import of macro expansion info with spelling and expansion locations. Reviewers: a.sidorin, klimek, martong, balazske, xazax.hun Reviewed By: martong Subscribers: thakis, xazax.hun, balazske, rnkovacs, cfe-commits Differential Revision: https://reviews.llvm.org/D47698 llvm-svn: 336269
* [SemaCodeComplete] Make sure visited contexts are passed to completion ↵Eric Liu2018-07-041-107/+75
| | | | | | | | | | | | results handler. Reviewers: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48917 llvm-svn: 336255
* [Sema] Fix crash in getConstructorName.Ilya Biryukov2018-07-041-0/+2
| | | | | | | | | | | | | | | | Summary: Can happen when getConstructorName is called on invalid decls, specifically the ones that do not have the injected class name. Reviewers: bkramer, rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48880 llvm-svn: 336244
* PR33924: merge local declarations that have linkage of some kind withinRichard Smith2018-07-042-25/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [Sema] Consider all format_arg attributes.Michael Kruse2018-07-041-6/+15
| | | | | | | | | | | | | | | | If a function has multiple format_arg attributes, clang only considers the first it finds (because AttributeLists are in reverse order, not necessarily the textually first) and ignores all others. Loop over all FormatArgAttr to print warnings for all declared format_arg attributes. For instance, libintl's ngettext (select plural or singular version of format string) has two __format_arg__ attributes. Differential Revision: https://reviews.llvm.org/D48734 llvm-svn: 336239
* [Sema] Discarded statment should be an evaluatable context.Erik Pilkington2018-07-031-1/+1
| | | | | | | | | | The constexpr evaluator was erroring out because these templates weren't defined. Despite being used in a discarded statement, we still need to constexpr evaluate them, which means that we need to instantiate them. Fixes PR37585. Differential revision: https://reviews.llvm.org/D48322 llvm-svn: 336233
* Factor out Clang's desired 8MB stack size constant from the variousRichard Smith2018-07-032-4/+4
| | | | | | places we hardcode it. llvm-svn: 336231
* Fix allocation of Nullability attribute.Erich Keane2018-07-031-9/+7
| | | | | | | | | | | Existing code always allocates for on the declarator's attribute pool, but sometimes adds it to the declspec. This patch ensures that the correct pool is used. Discovered while testing: https://reviews.llvm.org/D48788 llvm-svn: 336225
* Fix crash in clang.Zachary Turner2018-07-031-1/+3
| | | | | | | | | | This happened during a recent refactor. toStringRefArray() returns a vector<StringRef>, which was being implicitly converted to an ArrayRef<StringRef>, and then the vector was immediately being destroyed, so the ArrayRef<> was losing its backing storage. Fix this by making sure the vector gets permanent storage. llvm-svn: 336219
* [Driver] Add PPC64 as supported for ScudoKostya Kortchinsky2018-07-031-1/+2
| | | | | | | | | | | | | | | | | | Summary: Scudo works on PPC64 as is, so mark the architecture as supported for it. This will also require a change to config-ix.cmake on the compiler-rt side. Update the tests accordingly. Reviewers: eugenis, alekseyshl Reviewed By: alekseyshl Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48833 llvm-svn: 336202
* Revert r336021 "PR33924: merge local declarations that have linkage of some ↵Hans Wennborg2018-07-032-94/+25
| | | | | | | | | | | | | | | | | | | | | | | | | kind within" This caused test failures in 32-bit builds (PR38015). > 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. llvm-svn: 336175
* [Driver][Darwin] Use Host Triple to infer target os versionSteven Wu2018-07-031-1/+7
| | | | | | | | | | | | | | | | | | | | Summary: When clang required to infer target os version from --target option and the os version is not specified in targets, check the host triple. If the host and target are both macOS, use host triple to infer target os version. rdar://problem/41651999 Reviewers: arphaman, dexonsmith Reviewed By: arphaman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48849 llvm-svn: 336168
* Per C++ [over.match.copy]p1, direct-initialization of a reference canRichard Smith2018-07-021-4/+6
| | | | | | only invoke converting constructors of the reference's underlying type. llvm-svn: 336153
* [CodeGenCXX] Emit strip.invariant.group with -fstrict-vtable-pointersPiotr Padlewski2018-07-023-3/+79
| | | | | | | | | | | | | | | Summary: Emmiting new intrinsic that strips invariant.groups to make devirtulization sound, as described in RFC: Devirtualization v2. Reviewers: rjmccall, rsmith, amharc, kuhar Subscribers: llvm-commits, cfe-commits Differential Revision: https://reviews.llvm.org/D47299 Co-authored-by: Krzysztof Pszeniczny <krzysztof.pszeniczny@gmail.com> llvm-svn: 336137
* [ms] Fix mangling of char16_t and char32_t to be compatible with MSVC.Nico Weber2018-07-021-10/+10
| | | | | | | | | | MSVC limits char16_t and char32_t string literal names to 32 bytes of character data, not to 32 characters. wchar_t string literal names on the other hand can get up to 64 bytes of character data. https://reviews.llvm.org/D48781 llvm-svn: 336097
* [X86] Correct the width of mask arguments in intrinsic headers and tests.Craig Topper2018-06-303-11/+11
| | | | | | | | | | | | | All of these found by grepping through IR from the builtin tests for extra trunc and zext/sext instructions that shouldn't have been there. Some of these were real bugs where we lost bits from the user input: _mm512_mask_broadcast_f32x8 _mm512_maskz_broadcast_f32x8 _mm512_mask_broadcast_i32x8 _mm512_maskz_broadcast_i32x8 _mm256_mask_cvtusepi16_storeu_epi8 llvm-svn: 336042
* Driver: Don't mix system tools with devtoolset tools on RHELTom Stellard2018-06-301-0/+9
| | | | | | | | | | | | | | | | | Summary: On RHEL, devtoolset provides a more up-to-date toolchain than the base install, and we want to make sure all the tools use are from the same toolchain. Reviewers: rsmith, bruno Reviewed By: bruno Subscribers: bruno, cfe-commits Differential Revision: https://reviews.llvm.org/D34848 llvm-svn: 336037
* [X86] Remove masking from the avx512 rotate builtins. Use a select builtin ↵Craig Topper2018-06-303-306/+201
| | | | | | instead. llvm-svn: 336036
OpenPOWER on IntegriCloud