summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* Refactor ExecuteAndWait to take StringRefs.Zachary Turner2018-06-123-21/+20
| | | | | | | | | | | | | | | | | | | This simplifies some code which had StringRefs to begin with, and makes other code more complicated which had const char* to begin with. In the end, I think this makes for a more idiomatic and platform agnostic API. Not all platforms launch process with null terminated c-string arrays for the environment pointer and argv, but the api was designed that way because it allowed easy pass-through for posix-based platforms. There's a little additional overhead now since on posix based platforms we'll be takign StringRefs which were constructed from null terminated strings and then copying them to null terminate them again, but from a readability and usability standpoint of the API user, I think this API signature is strictly better. llvm-svn: 334518
* [clang-format] Discourage breaks in submessage entries, hard ruleKrasimir Georgiev2018-06-123-6/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Currently clang-format allows this for text protos: ``` submessage: { key: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' } ``` when it is under the column limit and when putting it all on one line exceeds the column limit. This is not a very intuitive formatting, so I'd prefer having ``` submessage: { key: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' } ``` instead, even if it takes one line more. This patch prevents clang-format from inserting a break between `: {` and similar cases. Reviewers: djasper, sammccall Reviewed By: sammccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48063 llvm-svn: 334517
* Fix overload resolution between Ptr-To-Member and BoolErich Keane2018-06-122-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | As reported here (https://bugs.llvm.org/show_bug.cgi?id=19808) and discovered independently when looking at plum-hall tests, we incorrectly implemented over.ics.rank, which says "A conversion that is not a conversion of a pointer, or pointer to member, to bool is better than another conversion that is such a conversion.". In the current Draft (N4750), this is phrased slightly differently in paragraph 4.1: A conversion that does not convert a pointer, a pointer to member, or std::nullptr_t to bool is better than one that does. The comment on isPointerConversionToBool (the changed function) also confirms that this is the case (note outdated reference): isPointerConversionToBool - Determines whether this conversion is a conversion of a pointer or pointer-to-member to bool. This is used as part of the ranking of standard conversion sequences (C++ 13.3.3.2p4). However, despite this comment, it didn't check isMemberPointerType on the 'FromType', presumably incorrectly assuming that 'isPointerType' matched it. This patch fixes this by adding isMemberPointerType to this function. Additionally, member function pointers are just MemberPointerTypes that point to functions insted of data, so that is fixed in this patch as well. llvm-svn: 334503
* Re-apply r334418 "Enable crash recovery tests on Windows, globs work in the ↵Hans Wennborg2018-06-124-22/+7
| | | | | | | | | | | | | | | | lit internal shell now" Plus change run lines from not env FOO=bar %clang to env FOO=bar not %clang To not confuse the internal shell. llvm-svn: 334494
* Revert r334418 "Enable crash recovery tests on Windows, globs work in the ↵Hans Wennborg2018-06-124-1/+16
| | | | | | | | | | lit internal shell now" The tests fail on Windows bots, and for me locally. > Enable crash recovery tests on Windows, globs work in the lit internal shell now llvm-svn: 334493
* [AArch64] Corrected FP16 Intrinsic range checks in Clang + added Sema testsLuke Geeson2018-06-125-42/+109
| | | | | | | | | | | | | | | | | | Summary: This fixes the ranges for the vcvth family of FP16 intrinsics in the clang front end. Previously it was accepting incorrect ranges -Changed builtin range checking in SemaChecking -added tests SemaCheck changes - included in their own file since no similar one exists -modified existing tests to reflect new ranges Reviewers: SjoerdMeijer, javed.absar Reviewed By: SjoerdMeijer Subscribers: kristof.beyls, cfe-commits Differential Revision: https://reviews.llvm.org/D47592 llvm-svn: 334489
* Fix that AlignedAllocation.h doesn't compile because of VersionTupleRaphael Isemann2018-06-121-4/+4
| | | | | | | | | | | | Summary: rL334399 put VersionTuple in the llvm namespace, but this header still assumes it's in the clang namespace. This leads to compilation failures with enabled modules when building Clang. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48062 llvm-svn: 334471
* [CUDA][HIP] Set kernel calling convention before arrange functionYaxun Liu2018-06-125-7/+58
| | | | | | | | | | | | | Currently clang set kernel calling convention for CUDA/HIP after arranging function, which causes incorrect kernel function type since it depends on calling convention. This patch moves setting kernel convention before arranging function. Differential Revision: https://reviews.llvm.org/D47733 llvm-svn: 334457
* [CMake] Use libc++ and compiler-rt for bootstrap Fuchsia ClangPetr Hosek2018-06-111-0/+7
| | | | | | | | | | We want to build the second stage compiler with libc++ and compiler-rt, also include builtins and runtimes into extra bootstrap components to ensure these get built. Differential Revision: https://reviews.llvm.org/D47356 llvm-svn: 334445
* [CMake] Allow specifying extra dependencies of bootstrap stagePetr Hosek2018-06-111-0/+4
| | | | | | | | | This allows adding additional bootstrap dependencies to the bootstrap compiler that may be needed by later stages. Differential Revision: https://reviews.llvm.org/D47355 llvm-svn: 334437
* [X86] Fix operand order in the shuffle created for blend builtins.Craig Topper2018-06-111-1/+1
| | | | | | This was broken when the builtin was added in r334249. llvm-svn: 334422
* [clang-fuzzer] Modified protobuf and converter to add new signature, remove ↵Matt Morehouse2018-06-112-12/+29
| | | | | | | | | | | | conditionals. Changed the function signature and removed conditionals from loop body. Patch By: emmettneyman Differential Revision: https://reviews.llvm.org/D47964 llvm-svn: 334421
* Enable crash recovery tests on Windows, globs work in the lit internal shell nowReid Kleckner2018-06-114-16/+1
| | | | llvm-svn: 334418
* [MS] Use mangled names and comdats for string merging with ASanReid Kleckner2018-06-111-7/+5
| | | | | | | | This should reduce the binary size penalty of ASan on Windows. After r334313, ASan will add red zones to globals in comdats, so we will still find OOB accesses to string literals. llvm-svn: 334417
* [X86] Properly account for the immediate being multiplied by 8 in the ↵Craig Topper2018-06-111-1/+1
| | | | | | | | immediate range checking for BI__builtin_ia32_psrldqi128 and friends. The limit was set to 1023 which only up to 127*8. It needs to be 2047 to allow 255*8. llvm-svn: 334416
* clang-format: [JS] strict prop init annotation.Martin Probst2018-06-112-1/+13
| | | | | | | | | | | | | | | | | | | | | | Summary: TypeScript uses the `!` token for strict property initialization assertions, as in: class X { strictPropAsserted!: string; } Previously, clang-format would wrap between the `!` and the `:` for overly long lines. This patch fixes that by generally preventing the wrap in that location. Reviewers: krasimir Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48030 llvm-svn: 334415
* [Driver] Add aliases for -Qn/-QyMikhail Maltsev2018-06-112-1/+6
| | | | | | | | | This patch adds aliases for -Qn (-fno-ident) and -Qy (-fident) which look less cryptic than -Qn/-Qy. The aliases are compatible with GCC. Differential Revision: https://reviews.llvm.org/D48021 llvm-svn: 334414
* clang-format: Introduce BreakInheritanceList optionFrancois Ferrand2018-06-116-43/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This option replaces the BreakBeforeInheritanceComma option with an enum, thus introducing a mode where the colon stays on the same line as constructor declaration: // When it fits on line: class A : public B, public C { ... }; // When it does not fit: class A : public B, public C { ... }; This matches the behavior of the `BreakConstructorInitializers` option, introduced in https://reviews.llvm.org/D32479. Reviewers: djasper, klimek Reviewed By: djasper Subscribers: mzeren-vmw, cfe-commits Differential Revision: https://reviews.llvm.org/D43015 llvm-svn: 334408
* [clang-format] text protos: put entries on separate lines if there is a ↵Krasimir Georgiev2018-06-114-16/+362
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | submessage Summary: This patch updates clang-format text protos to put entries of a submessage into separate lines if the submessage contains at least two entries and contains at least one submessage entry. For example, the entries here are kept on separate lines even if putting them on a single line would be under the column limit: ``` message: { entry: 1 submessage: { key: value } } ``` Messages containing a single submessage or several scalar entries can still be put on one line if they fit: ``` message { submessage { key: value } } message { x: 1 y: 2 z: 3 } ``` Reviewers: sammccall Reviewed By: sammccall Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D46757 llvm-svn: 334401
* Move VersionTuple from clang/Basic to llvm/SupportPavel Labath2018-06-1123-281/+27
| | | | | | | | | | | | | | | | | | | | | | | Summary: This kind of functionality is useful to other project apart from clang. LLDB works with version numbers a lot, but it does not have a convenient abstraction for this. Moving this class to a lower level library allows it to be freely used within LLDB. Since this class is used in a lot of places in clang, and it used to be in the clang namespace, it seemed appropriate to add it to the list of adopted classes in LLVM.h to avoid prefixing all uses with "llvm::". Also, I didn't find any tests specific for this class, so I wrote a couple of quick ones for the more interesting bits of functionality. Reviewers: zturner, erik.pilkington Subscribers: mgorny, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D47887 llvm-svn: 334399
* [MS ABI] Mangle unnamed empty enums (PR37723)Hans Wennborg2018-06-112-4/+14
| | | | | | Differential Revision: https://reviews.llvm.org/D47875 llvm-svn: 334388
* [X86] Remove masking from dbpsadbw builtins, use select builtin instead.Craig Topper2018-06-116-51/+45
| | | | llvm-svn: 334385
* [X86] Use target independent masked expandload and compressstore intrinsics ↵Craig Topper2018-06-105-52/+138
| | | | | | | | | | | | | | | | to implement expandload/compressstore builtins. Summary: We've had these target independent intrinsics for at least a year and a half. Looks like they do exactly what we need here and the backend already supports them. Reviewers: RKSimon, delena, spatel, GBuella Reviewed By: RKSimon Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D47693 llvm-svn: 334366
* [NEON] Support VST1xN intrinsics in AArch32 mode (Clang part)Ivan A. Kosarev2018-06-104-2122/+2350
| | | | | | | | | We currently support them only in AArch64. The NEON Reference, however, says they are 'ARMv7, ARMv8' intrinsics. Differential Revision: https://reviews.llvm.org/D47446 llvm-svn: 334362
* [X86] Remove masking from the 512-bit packed floating point add/sub/mul/div ↵Craig Topper2018-06-104-142/+126
| | | | | | builtins. Use select in IR instead. llvm-svn: 334359
* [analyzer] Clean up the program state map of DanglingInternalBufferChecker.Reka Kovacs2018-06-091-1/+22
| | | | | | | | | | Symbols are cleaned up from the program state map when they go out of scope. Memory regions are cleaned up when the corresponding object is destroyed, and additionally in 'checkDeadSymbols' in case destructor modeling was incomplete. Differential Revision: https://reviews.llvm.org/D47416 llvm-svn: 334352
* [analyzer] Add dangling internal buffer check.Reka Kovacs2018-06-096-2/+215
| | | | | | | | | | | | This check will mark raw pointers to C++ standard library container internal buffers 'released' when the objects themselves are destroyed. Such information can be used by MallocChecker to warn about use-after-free problems. In this first version, 'std::basic_string's are supported. Differential Revision: https://reviews.llvm.org/D47135 llvm-svn: 334348
* Use SmallPtrSet instead of SmallSet in places where we iterate over the set.Craig Topper2018-06-092-8/+6
| | | | | | | | SmallSet forwards to SmallPtrSet for pointer types. SmallPtrSet supports iteration, but a normal SmallSet doesn't. So if it wasn't for the forwarding, this wouldn't work. These places were found by hiding the begin/end methods in the SmallSet forwarding. llvm-svn: 334339
* [X86] Add avx512 feature flags to __builtin_ia32_select*.Craig Topper2018-06-081-18/+18
| | | | | | | | There are many masked intrinsics that just wrap a select around a legacy intrinsic from a pre-avx512 instruciton set. If that intrinsic is implemented as a macro, nothing prevents it from being used when only the older feature was enabled. This likely generates very poor code since we don't have a good way to convert from the scalar masked type used by the intrinsic into a vector control for a legacy blend instruction. If we even have a blend instruction to use. By adding a feature to the select builtins we can prevent and diagnose misuse of these intrinsics. llvm-svn: 334334
* [X86] Add back some masked vector truncate builtins. Custom IRgen a a few ↵Craig Topper2018-06-084-17/+57
| | | | | | | | | | others. I'd like to make the select builtins require an avx512f, avx512bw, or avx512vl fature to match what is normally required to get masking. Truncate is special in that there are instructions with a 128/256-bit masked result even without avx512vl. By using special buitlins we can emit a select without using the 128/256-bit select builtins. llvm-svn: 334331
* [X86] Fold masking into subvector extract builtins.Craig Topper2018-06-087-124/+171
| | | | | | | | I'm looking into making the select builtins require avx512f, avx512bw, or avx512vl since masking operations generally require those features. The extract builtins are funny because the 512-bit versions return a 128 or 256 bit vector with masking even when avx512vl is not supported. llvm-svn: 334330
* [X86] Add builtins for vpermq/vpermpd instructions to enable target feature ↵Craig Topper2018-06-089-54/+46
| | | | | | checking. llvm-svn: 334311
* [X86] Change immediate type for some builtins from char to int.Craig Topper2018-06-084-16/+20
| | | | | | These builtins are all handled by CGBuiltin.cpp so it doesn't much matter what the immediate type is, but int matches the intrinsic spec. llvm-svn: 334310
* [CUDA] Fix emission of constant strings in sectionsJonas Hahnfeld2018-06-082-4/+8
| | | | | | | | | | | | | | | | | | | | | | | CGM.GetAddrOfConstantCString() sets the adress of the created GlobalValue to unnamed. When emitting the object file LLVM will mark the surrounding section as SHF_MERGE iff the string is nul-terminated and contains no other nuls (see IsNullTerminatedString). This results in problems when saving temporaries because LLVM doesn't set an EntrySize, so reading in the serialized assembly file fails. This never happened for the GPU binaries because they usually contain a nul-character somewhere. Instead this only affected the module ID when compiling relocatable device code. However, this points to a potentially larger problem: If we put a constant string into a named section, we really want the data to end up in that section in the object file. To avoid LLVM merging sections this patch unmarks the GlobalVariable's address as unnamed which also fixes the problem of invalid serialized assembly files when saving temporaries. Differential Revision: https://reviews.llvm.org/D47902 llvm-svn: 334281
* [X86] Add builtins for shufps and shufpd to enable target feature and ↵Craig Topper2018-06-086-24/+50
| | | | | | immediate range checking. llvm-svn: 334266
* [X86] Add builtins for pshufd, pshuflw, and pshufhw to enable target feature ↵Craig Topper2018-06-0813-139/+105
| | | | | | and immediate range checking. llvm-svn: 334265
* [X86] Fix some typecasts in intrinsic headers that I messed up in r334261.Craig Topper2018-06-081-3/+3
| | | | | | This was caught by the Header tests, but not the CodeGen tests. llvm-svn: 334264
* [X86] Add subvector insert and extract builtins to enable target feature ↵Craig Topper2018-06-0816-330/+243
| | | | | | | | checking and immediate range checking. Test changes are due to differences in how we generate undef elements now. We also changed the types used for extractf128_si256/insertf128_si256 to match the signature of the builtin that previously existed which this patch resurrects. This also matches gcc. llvm-svn: 334261
* [X86] Add builtins for vpermilps/pd instructions to enable target feature ↵Craig Topper2018-06-088-70/+64
| | | | | | checking. llvm-svn: 334256
* [CodeGen] Always use MSVC personality for windows-msvc targetsShoaib Meenai2018-06-083-26/+28
| | | | | | | | | | | | | | | | | The windows-msvc target is meant to be ABI compatible with MSVC, including the exception handling. Ensure that a windows-msvc triple always equates to the MSVC personality being used. This mostly affects the GNUStep and ObjFW Obj-C runtimes. To the best of my knowledge, those are normally not used with windows-msvc triples. I believe WinObjC is based on GNUStep (or it at least uses libobjc2), but that also takes the approach of wrapping Obj-C exceptions in C++ exceptions, so the MSVC personality function is the right one to use there as well. Differential Revision: https://reviews.llvm.org/D47862 llvm-svn: 334253
* [clang-fuzzer] Made loop_proto more "vectorizable".Matt Morehouse2018-06-082-45/+13
| | | | | | | | | | | | | Edited loop_proto and its converter to make more "vectorizable" code according to kcc's comment in D47666 - Removed all while loops - Can only index into array with induction variable Patch By: emmettneyman Differential Revision: https://reviews.llvm.org/D47920 llvm-svn: 334252
* Reapply "[Parse] Use CapturedStmt for @finally on MSVC"Shoaib Meenai2018-06-0810-15/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reapplies r334224 and adds explicit triples to some tests to fix them on Windows (where otherwise they would have run with the default windows-msvc triple, which I'm changing the behavior for). Original commit message: The body of a `@finally` needs to be executed on both exceptional and non-exceptional paths. On landingpad platforms, this is straightforward: the `@finally` body is emitted as a normal (non-exceptional) cleanup, and then a catch-all is emitted which branches to that cleanup (the cleanup has code to conditionally re-throw based on a flag which is set by the catch-all). Unfortunately, we can't use the same approach for MSVC exceptions, where the catch-all will be emitted as a catchpad. We can't just branch to the cleanup from within the catchpad, since we can only exit it via a catchret, at which point the exception is destroyed and we can't rethrow. We could potentially emit the finally body inside the catchpad and have the normal cleanup path somehow branch into it, but that would require some new IR construct that could branch into a catchpad. Instead, after discussing it with Reid Kleckner, we decided that frontend outlining was the best approach, similar to how SEH `__finally` works today. We decided to use CapturedStmt (which was also suggested by Reid) rather than CaptureFinder (which is what `__finally` uses) since the latter doesn't handle a lot of cases we care about, e.g. self accesses, property accesses, block captures, etc. Extending CaptureFinder to handle those additional cases proved unwieldy, whereas CapturedStmt already took care of all of those. In theory `__finally` could also be moved over to CapturedStmt, which would remove some existing limitations (e.g. the inability to capture this), although CaptureFinder would still be needed for SEH filters. The one case supported by `@finally` but not CapturedStmt (or CaptureFinder for that matter) is arbitrary control flow out of the `@finally`, e.g. having a return statement inside a `@finally`. We can add that support as a follow-up, but in practice we've found it to be used very rarely anyway. Differential Revision: https://reviews.llvm.org/D47564 llvm-svn: 334251
* [X86] Add builtins for blend with immediate control to enforce target ↵Craig Topper2018-06-088-71/+55
| | | | | | feature requirements and check immediate range. llvm-svn: 334249
* [X86] Add builtins for shuff32x4/shuff64x2/shufi32x4/shuff64x2 to enable ↵Craig Topper2018-06-077-82/+67
| | | | | | target feature checking and immediate range checking. llvm-svn: 334244
* [Frontend] Disallow non-MSVC exception models for windows-msvc targetsShoaib Meenai2018-06-078-71/+43
| | | | | | | | | | | | | | The windows-msvc target is used for MSVC ABI compatibility, including the exceptions model. It doesn't make sense to pair a windows-msvc target with a non-MSVC exception model. This would previously cause an assertion failure; explicitly error out for it in the frontend instead. This also allows us to reduce the matrix of target/exception models a bit (see the modified tests), and we can possibly simplify some of the personality code in a follow-up. Differential Revision: https://reviews.llvm.org/D47853 llvm-svn: 334243
* Revert "[Parse] Use CapturedStmt for @finally on MSVC"Shoaib Meenai2018-06-075-32/+2
| | | | | | | | | | This reverts commit r334224. This is causing buildbot failures on Windows, presumably because some tests don't specify a triple. I'll test this on Windows locally and recommit with the tests fixed. llvm-svn: 334240
* [MS] Re-add support for the ARM interlocked bittest intrinscsReid Kleckner2018-06-077-83/+293
| | | | | | | | | | | | | | | Adds support for these intrinsics, which are ARM and ARM64 only: _interlockedbittestandreset_acq _interlockedbittestandreset_rel _interlockedbittestandreset_nf _interlockedbittestandset_acq _interlockedbittestandset_rel _interlockedbittestandset_nf Refactor the bittest intrinsic handling to decompose each intrinsic into its action, its width, and its atomicity. llvm-svn: 334239
* [X86] Add builtins for VALIGNQ/VALIGND to enable proper target feature checking.Craig Topper2018-06-075-54/+44
| | | | | | | | We still emit shufflevector instructions we just do it from CGBuiltin.cpp now. This ensures the intrinsics that use this are only available on CPUs that support the feature. I also added range checking to the immediate, but only checked it is 8 bits or smaller. We should maybe be stricter since we never use all 8 bits, but gcc doesn't seem to do that. llvm-svn: 334237
* [Parse] Use CapturedStmt for @finally on MSVCShoaib Meenai2018-06-075-2/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The body of a `@finally` needs to be executed on both exceptional and non-exceptional paths. On landingpad platforms, this is straightforward: the `@finally` body is emitted as a normal (non-exceptional) cleanup, and then a catch-all is emitted which branches to that cleanup (the cleanup has code to conditionally re-throw based on a flag which is set by the catch-all). Unfortunately, we can't use the same approach for MSVC exceptions, where the catch-all will be emitted as a catchpad. We can't just branch to the cleanup from within the catchpad, since we can only exit it via a catchret, at which point the exception is destroyed and we can't rethrow. We could potentially emit the finally body inside the catchpad and have the normal cleanup path somehow branch into it, but that would require some new IR construct that could branch into a catchpad. Instead, after discussing it with Reid Kleckner, we decided that frontend outlining was the best approach, similar to how SEH `__finally` works today. We decided to use CapturedStmt (which was also suggested by Reid) rather than CaptureFinder (which is what `__finally` uses) since the latter doesn't handle a lot of cases we care about, e.g. self accesses, property accesses, block captures, etc. Extending CaptureFinder to handle those additional cases proved unwieldy, whereas CapturedStmt already took care of all of those. In theory `__finally` could also be moved over to CapturedStmt, which would remove some existing limitations (e.g. the inability to capture this), although CaptureFinder would still be needed for SEH filters. The one case supported by `@finally` but not CapturedStmt (or CaptureFinder for that matter) is arbitrary control flow out of the `@finally`, e.g. having a return statement inside a `@finally`. We can add that support as a follow-up, but in practice we've found it to be used very rarely anyway. Differential Revision: https://reviews.llvm.org/D47564 llvm-svn: 334224
* [FileSystem] Split up the OpenFlags enumeration.Zachary Turner2018-06-073-6/+5
| | | | | | | | | | | | | | | | | This breaks the OpenFlags enumeration into two separate enumerations: OpenFlags and CreationDisposition. The first controls the behavior of the API depending on whether or not the target file already exists, and is not a flags-based enum. The second controls more flags-like values. This yields a more easy to understand API, while also allowing flags to be passed to the openForRead api, where most of the values didn't make sense before. This also makes the apis more testable as it becomes easy to enumerate all the configurations which make sense, so I've added many new tests to exercise all the different values. llvm-svn: 334221
OpenPOWER on IntegriCloud