summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [Driver, CodeGen] rename options to disable an FP cast optimizationSanjay Patel2018-04-303-6/+9
| | | | | | | | | | | | | | As suggested in the post-commit thread for rL331056, we should match these clang options with the established vocabulary of the corresponding sanitizer option. Also, the use of 'strict' is well-known for these kinds of knobs, and we can improve the descriptive text in the docs. So this intends to match the logic of D46135 but only change the words. Matching LLVM commit to match this spelling of the attribute to follow shortly. Differential Revision: https://reviews.llvm.org/D46236 llvm-svn: 331209
* [OPENMP] Do not crash on codegen for CXX member functions.Alexey Bataev2018-04-301-0/+3
| | | | | | | Non-static member functions should not be emitted as a standalone functions, this leads to compiler crash. llvm-svn: 331206
* [OPENMP] Do not crash on incorrect input data.Alexey Bataev2018-04-301-11/+36
| | | | | | | | Emit error messages instead of compiler crashing when the target region does not exist in the device code + fix crash when the location comes from macros. llvm-svn: 331195
* IWYU for llvm-config.h in clang. See r331124 for details.Nico Weber2018-04-306-3/+3
| | | | llvm-svn: 331177
* Remove unnecessary indirection. No behavior change.Nico Weber2018-04-301-12/+6
| | | | llvm-svn: 331176
* [Targets] Implement getConstraintRegister for ARM and AArch64Mikhail Maltsev2018-04-302-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The getConstraintRegister method is used by semantic checking of inline assembly statements in order to diagnose conflicts between clobber list and input/output lists. Currently ARM and AArch64 don't override getConstraintRegister, so conflicts between registers assigned to variables in asm labels and clobber lists are not diagnosed. Such conflicts can cause assertion failures in the back end and even miscompilations. This patch implements getConstraintRegister for ARM and AArch64 targets. Since these targets don't have single-register constraints, the implementation is trivial and just returns the register specified in an asm label (if any). Reviewers: eli.friedman, javed.absar, thopre Reviewed By: thopre Subscribers: rengolin, eraman, rogfer01, myatsina, kristof.beyls, cfe-commits, chrib Differential Revision: https://reviews.llvm.org/D45965 llvm-svn: 331164
* PR37189 Fix incorrect end source location and spelling for a split '>>' token.Richard Smith2018-04-3026-186/+247
| | | | | | | | | | | | | | | | | | When a '>>' token is split into two '>' tokens (in C++11 onwards), or (as an extension) when we do the same for other tokens starting with a '>', we can't just use a location pointing to the first '>' as the location of the split token, because that would result in our miscomputing the length and spelling for the token. As a consequence, for example, a refactoring replacing 'A<X>' with something else would sometimes replace one character too many, and similarly diagnostics highlighting a template-id source range would highlight one character too many. Fix this by creating an expansion range covering the first character of the '>>' token, whose spelling is '>'. For this to work, we generalize the expansion range of a macro FileID to be either a token range (the common case) or a character range (used in this new case). llvm-svn: 331155
* Fix printing of reference-to-reference types.Richard Smith2018-04-291-8/+20
| | | | | | Previously we would sometimes print these as 'T &&&' or even 'T &&&&'. llvm-svn: 331137
* PR37275 packed attribute should not apply to base classesRichard Smith2018-04-291-3/+8
| | | | | | | | | | | | | Clang incorrectly applied the packed attribute to base classes. Per GCC's documentation and as can be observed from its behavior, packed only applies to members, not base classes. This change is conditioned behind -fclang-abi-compat so that an ABI break can be avoided by users if desired. Differential Revision: https://reviews.llvm.org/D46218 llvm-svn: 331136
* Remove unused includes of clang/Config/config.hNico Weber2018-04-285-5/+0
| | | | | | | | | | | | | | | | | | | | Found by opening config.h.cmake in vim, finding all defined macros with /define\(01\)\? \zs[A-Za-z0-9_]*<cr> :%s//\=setreg('A', submatch(0), 'V')/gn<cr> :put A<cr> and then joining them all with |, and passing that to git grep -E that_pattern 'clang/*.h' 'clang/*.cpp' 'clang/*.c' and diffing that output with the result of git grep Config/config.h 'clang/*.h' 'clang/*.cpp' 'clang/*.c' No intended behavior change. llvm-svn: 331124
* [ItaniumMangle] Undeduced auto type shouldn't be substitutable.Erik Pilkington2018-04-281-11/+16
| | | | | | | | | We still support the old mangling if we're trying to be ABI-compatible with Clang 6.0, though. Differential revision: https://reviews.llvm.org/D45451 llvm-svn: 331098
* [analyzer] CStringChecker: Add support for BSD strlcpy() and strlcat().Artem Dergachev2018-04-271-2/+39
| | | | | | | | Patch by David Carlier! Differential Revision: https://reviews.llvm.org/D45177 llvm-svn: 331096
* [analyzer] ObjCAutoreleaseWrite: Support a few more APIs and fix warning text.Artem Dergachev2018-04-271-6/+31
| | | | | | API list and improved warning text composed by Devin Coughlin. llvm-svn: 331089
* Revert r329698 (and r329702).Nico Weber2018-04-272-5/+37
| | | | | | | | | Speculative. ClangMoveTests started failing on http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/9958 after this change. I can't reproduce on my machine, let's see if it was due to this change. llvm-svn: 331077
* s/LLVM_ON_WIN32/_WIN32/, clangNico Weber2018-04-279-11/+11
| | | | | | | | | | | LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in HandleLLVMOptions.cmake, which is where _WIN32 defined too. Just use the default macro instead of a reinvented one. See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev. No intended behavior change. llvm-svn: 331069
* [clang-format/ObjC] Use getIdentifierInfo() instead of tok::identifierBen Hamilton2018-04-271-4/+21
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, we checked tokens for `tok::identifier` to see if they were identifiers inside an Objective-C selector. However, this missed C++ keywords like `new` and `delete`. To fix this, this diff uses `getIdentifierInfo()` to find identifiers or keywords inside Objective-C selectors. Test Plan: New tests added. Ran tests with: % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests Reviewers: djasper, jolesiak Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D46143 llvm-svn: 331067
* [Modules][ObjC] ASTReader should add protocols for class extensionsBruno Cardoso Lopes2018-04-271-0/+6
| | | | | | | | | | | | During deserialization clang is currently missing the merging of protocols into the canonical interface for the class extension. This merging only currently happens during parsing and should also be considered during deserialization. rdar://problem/38724303 llvm-svn: 331063
* Test commit removing trailing whitespaceStuart Brady2018-04-271-1/+1
| | | | llvm-svn: 331053
* [Driver, CodeGen] add options to enable/disable an FP cast optimizationSanjay Patel2018-04-273-0/+10
| | | | | | | | | | | | | | | | | | | | | | As discussed in the post-commit thread for: rL330437 ( http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20180423/545906.html ) We need a way to opt-out of a float-to-int-to-float cast optimization because too much existing code relies on the platform-specific undefined result of those casts when the float-to-int overflows. The LLVM changes associated with adding this function attribute are here: rL330947 rL330950 rL330951 Also as suggested, I changed the LLVM doc to mention the specific sanitizer flag that catches this problem: rL330958 Differential Revision: https://reviews.llvm.org/D46135 llvm-svn: 331041
* [ARM,AArch64] Add intrinsics for dot product instructionsOliver Stannard2018-04-271-0/+12
| | | | | | | | | | The ACLE spec which describes these intrinsics hasn't been published yet, but this is based on the final draft which will be published soon, and these have already been implemented by GCC. Differential revision: https://reviews.llvm.org/D46109 llvm-svn: 331039
* [ARM] Add __ARM_FEATURE_DOTPROD pre-defined macroOliver Stannard2018-04-272-0/+7
| | | | | | | | | | | | | | This adds a pre-defined macro to test if the compiler has support for the v8.2-A dot rpoduct intrinsics in AArch32 mode. The AAcrh64 equivalent has already been added by rL330229. The ACLE spec which describes this macro hasn't been published yet, but this is based on the final internal draft, and GCC has already implemented this. Differential revision: https://reviews.llvm.org/D46108 llvm-svn: 331038
* [OpenCL] Add separate read_only and write_only pipe IR typesSven van Haastregt2018-04-273-12/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | SPIR-V encodes the read_only and write_only access qualifiers of pipes, so separate LLVM IR types are required to target SPIR-V. Other backends may also find this useful. These new types are `opencl.pipe_ro_t` and `opencl.pipe_wo_t`, which replace `opencl.pipe_t`. This replaces __get_pipe_num_packets(...) and __get_pipe_max_packets(...) which took a read_only pipe with separate versions for read_only and write_only pipes, namely: * __get_pipe_num_packets_ro(...) * __get_pipe_num_packets_wo(...) * __get_pipe_max_packets_ro(...) * __get_pipe_max_packets_wo(...) These separate versions exist to avoid needing a bitcast to one of the two qualified pipe types. Patch by Stuart Brady. Differential Revision: https://reviews.llvm.org/D46015 llvm-svn: 331026
* Make MultiplexASTDeserializationListener part of the API [NFC]Raphael Isemann2018-04-271-24/+0
| | | | | | | | | | | | | | | | | | | | | Summary: This patch moves the MultiplexASTDeserializationListener declaration into a public header. We're currently using this multiplexer in the cling interpreter to attach another ASTDeserializationListener during the execution (so, after the MultiplexConsumer is already attached which prevents us from attaching more). So far we're doing this by patching clang and making this class public, but it makes things easier if we make this instead just public in upstream. Reviewers: thakis, v.g.vassilev, rsmith, bruno Reviewed By: bruno Subscribers: llvm-commits, cfe-commits, v.g.vassilev Differential Revision: https://reviews.llvm.org/D37475 llvm-svn: 331021
* [CodeGen] Avoid destructing a callee-destructued struct type in aAkira Hatanaka2018-04-274-3/+31
| | | | | | | | | | | | | | | | | | | | | | | function if a function delegates to another function. Fix a bug introduced in r328731, which caused a struct with ObjC __weak fields that was passed to a function to be destructed twice, once in the callee function and once in another function the callee function delegates to. To prevent this, keep track of the callee-destructed structs passed to a function and disable their cleanups at the point of the call to the delegated function. This reapplies r331016, which was reverted in r331019 because it caused an assertion to fail in EmitDelegateCallArg on a windows bot. I made changes to EmitDelegateCallArg so that it doesn't try to deactivate cleanups for structs that have trivial destructors (cleanups for those structs are never pushed to the cleanup stack in EmitParmDecl). rdar://problem/39194693 Differential Revision: https://reviews.llvm.org/D45382 llvm-svn: 331020
* Revert "[CodeGen] Avoid destructing a callee-destructued struct type in a"Akira Hatanaka2018-04-274-35/+3
| | | | | | | | This reverts commit r331016, which broke a windows bot. http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/11727 llvm-svn: 331019
* [CodeGen] Avoid destructing a callee-destructued struct type in aAkira Hatanaka2018-04-274-3/+35
| | | | | | | | | | | | | | | | | function if a function delegates to another function. Fix a bug introduced in r328731, which caused a struct with ObjC __weak fields that was passed to a function to be destructed twice, once in the callee function and once in another function the callee function delegates to. To prevent this, keep track of the callee-destructed structs passed to a function and disable their cleanups at the point of the call to the delegated function. rdar://problem/39194693 Differential Revision: https://reviews.llvm.org/D45382 llvm-svn: 331016
* [analyzer] Fix operator delete[] array-type-sub-expression handling.Artem Dergachev2018-04-271-2/+4
| | | | | | | | | | | | Avoid crash when the sub-expression of operator delete[] is of array type. This is not the same as simply using a delete[] syntax. We're still not properly calling destructors in this case in the analyzer. Differential Revision: https://reviews.llvm.org/D46146 llvm-svn: 331014
* Parse A::template B as an identifier rather than as a template-id with noRichard Smith2018-04-2710-50/+77
| | | | | | | | | | template arguments. This fixes some cases where we'd incorrectly accept "A::template B" when B is a kind of template that requires template arguments (in particular, a variable template or a concept). llvm-svn: 331013
* [Driver] Don't enable "-fregister-global-dtors-with-atexit" by defaultAkira Hatanaka2018-04-271-1/+1
| | | | | | | | | when compiling the kernel or kexts. Destructors should be registered with atexit by default only when we are compiling userland code. llvm-svn: 331010
* [x86] Revert r330322 (& r330323): Lowering x86 adds/addus/subs/subus intrinsicsChandler Carruth2018-04-261-98/+1
| | | | | | | | The LLVM commit introduces a crash in LLVM's instruction selection. I filed http://llvm.org/PR37260 with the test case. llvm-svn: 330997
* [X86] Make __builtin_ia32_readeflags_u32 and __builtin_ia32_writeeflags_u32 ↵Craig Topper2018-04-261-0/+17
| | | | | | | | | | | | only available on 32-bit targets. These builtins can't be handled by the backend on 64-bit targets. So error up front instead of throwing an isel error. Fixes PR37225 Differential Revision: https://reviews.llvm.org/D46132 llvm-svn: 330987
* [ConfigFiles] Update argument strings when merging argrument listsSerge Pavlov2018-04-261-1/+4
| | | | | | | | | | | Implementation of `InputArgList` assumes its field `ArgStrings` contains strings for each argument exactly in the same order. This condition was broken when arguments from config file and from invocation were merged. This change fixes https://bugs.llvm.org/show_bug.cgi?id=37196 (Clang config files can crash argument handling). llvm-svn: 330926
* [X86] Add support for _mm512_mullox_epi64 and _mm512_mask_mullox_epi64 ↵Craig Topper2018-04-261-0/+12
| | | | | | | | | | intrinsics to match icc. On AVX512F targets we'll produce an emulated sequence using 3 pmuludqs with shifts and adds. On AVX512DQ we'll use vpmulld. Fixes PR37140. llvm-svn: 330923
* Diagnose missing template arguments for a variable template even when there isRichard Smith2018-04-261-0/+8
| | | | | | | | | a preceding 'template' keyword. We only diagnose in the dependent case (wherein we used to crash). Another bug prevents the diagnostic from appearing in the non-template case. llvm-svn: 330894
* Revert addition of 'concept' to diagnostics in r330890.Richard Smith2018-04-261-2/+0
| | | | | | Matches revert in r330888 of r330794. llvm-svn: 330891
* Factor out common code for diagnosing missing template arguments.Richard Smith2018-04-264-22/+18
| | | | | | In passing, add 'concept' to the list of template kinds in diagnostics. llvm-svn: 330890
* Fix a merge conflict that was inadvertently introduced in r330888 Faisal Vali2018-04-261-6/+0
| | | | | | - during the reversion of r330794 llvm-svn: 330889
* Revert rC330794 and some dependent tiny bug fixes Faisal Vali2018-04-2620-382/+29
| | | | | | | | | | | | | | See Richard's humbling feedback here: http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226482.html http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226486.html Wish I'd had the patience to solicit the feedback prior to committing :) Sorry for the noise guys. Thank you Richard for being the steward that clang deserves! llvm-svn: 330888
* Switch to Clang's isDigit function.Richard Trieu2018-04-251-4/+4
| | | | | | | | std::isdigit can be overloaded, causing the template deduction to fail. Use Clang's isDigit function which to avoid this. Switch the other calls for consistency. llvm-svn: 330887
* Include <cctype> to get std::isdigit, fixes MSVC STL buildReid Kleckner2018-04-251-0/+1
| | | | llvm-svn: 330886
* [analyzer] Fix a crash on lifetime extension through aggregate initialization.Artem Dergachev2018-04-252-6/+22
| | | | | | | | | | | | If 'A' is a C++ aggregate with a reference field of type 'C', in code like A a = { C() }; C() is lifetime-extended by 'a'. The analyzer wasn't expecting this pattern and crashing. Additionally, destructors aren't added in the CFG for this case, so for now we shouldn't be inlining the constructor for C(). Differential Revision: https://reviews.llvm.org/D46037 llvm-svn: 330882
* Fix crash on qualified template name instantiation if the template name has noRichard Smith2018-04-251-6/+9
| | | | | | template argument list. llvm-svn: 330881
* [RISCV] More validations on the input value of -march=Ana Pazos2018-04-251-20/+270
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Supporting additional rules for parsing ISA string. - RISC-V ISA strings must be lowercase. E.g.: rv32IMC is not supported, rv32imc is correct. - Multi-letter extensions are to be separated by a single underscore '_'. The extension prefix counts as a letter. This means extensions that start with 's', 'sx' and 'sx' are all multi-letter. E.g.: xasb is a single non-standard extension named 'xasb' xa_sb are two extensions, the non-standard user level extension 'xa', and the supervisor level extension 'sb'. - Standard user-level extensions are specified following a canonical order, according to Table 22.1 in RISC-V User-Level ISA V2.2. - Non-standard user-level 'x' extensions, standard supervisor-level 's' extensions and non-standard supervisor-level 'sx' extensions are also specified following a canonical order according to Table 22.1 in RISC-V User-Level ISA V2.2: 'x' extensions, follwed by 's' extensions and then 'sx' extensions. - Extensions might have a version number. Underscores may be used to separate ISA subset components to improve readability and to provide disambiguation. E.g.: rv32i2_m3_a1_f2_d2 - Version numbers are divided into major and minor numbers, separated by a 'p'. If the minor version is 0, then 'p0' can be omitted. - Additional checks for dependent extensions and invalid extensions combinations. E.g.: 'e' requires rv32 'e' can't be combined with 'f' nor 'd' 'q' requires rv64 - TODO items have also been marked with comments in the code. Reviewers: asb, kito-cheng Reviewed By: asb Subscribers: edward-jones, mgrang, zzheng, rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, shiva0217, cfe-commits Differential Revision: https://reviews.llvm.org/D45284 llvm-svn: 330880
* [driver][darwin] Do not infer -simulator environment for OS version env varsAlex Lorenz2018-04-251-3/+16
| | | | | | | | with non-simulator SDKs rdar://37955008 llvm-svn: 330878
* [analyzer] Enable analysis of WebKit "unified sources".Artem Dergachev2018-04-254-13/+14
| | | | | | | | | | | | | | | | | | | Normally the analyzer begins path-sensitive analysis from functions within the main file, even though the path is allowed to go through any functions within the translation unit. When a recent version of WebKit is compiled, the "unified sources" technique is used, that assumes #including multiple code files into a single main file. Such file would have no functions defined in it, so the analyzer wouldn't be able to find any entry points for path-sensitive analysis. This patch pattern-matches unified file names that are similar to those used by WebKit and allows the analyzer to find entry points in the included code files. A more aggressive/generic approach is being planned as well. Differential Revision: https://reviews.llvm.org/D45839 llvm-svn: 330876
* [Driver] Reland "Android triples are not aliases for other triples."Dan Albert2018-04-251-50/+76
| | | | | | | | | Fixed directory separators in tests to be compatible with both Windows and !Windows. This reverts commit aa423850afa4c16a53c4c492fe254dcad3d5a53e. llvm-svn: 330873
* [Driver] Fix implicit config files from prefixed symlinksMartin Storsjo2018-04-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If -no-canonical-prefixes isn't used, the clang executable name used is the one of the actual executable, not the name of the symlink that the user invoked. In these cases, the target prefix was overridden based on the clang executable name. (On the other hand the implicit -target option that such a symlink adds, is added as an actual command line parameter in tools/driver/driver.cop, before resolving the symlink and finding the actual clang executable. Use the original ClangNameParts (set from argv[0] in tools/driver/driver.cpp) if it seems to be initialized propery. All existing tests of this feature used -no-canonical-prefixes (possibly because it also makes the driver look in the directory of the symlink instead of the directory of the executable); add another one that uses --config-user-dir= to specify the directory instead. (For actual users of such symlinks, outisde of the test suite, the directory is probably the same for both.) This makes this feature work more like what the documentation describes. Differential Revision: https://reviews.llvm.org/D45964 llvm-svn: 330871
* [TargetInfo] Sort target features before passing them to the backendEli Friedman2018-04-251-0/+3
| | | | | | | | | | | | | | | Passing the features in random order will lead to unpredictable results when some of the features are related (like the architecture-version features on ARM). It might be possible to fix this particular case in the ARM target code, to avoid adding overlapping target features. But we should probably be sorting in any case: the behavior shouldn't depend on StringMap's hashing algorithm. Differential Revision: https://reviews.llvm.org/D46030 llvm-svn: 330861
* [ASTImporter] FriendDecl importing improvementsPeter Szecsi2018-04-252-5/+92
| | | | | | | | | | There are only a few cases of importing a frienddecl which is currently supported. This patch aims to improve the friend import process. Set FriendObjectKind in case of decls, insert friend into the friend chain correctly, checks structurally equivalent in a more advanced manner. Test cases added as well. llvm-svn: 330847
* [CodeComplete] Fix completion in the middle of ident in ctor lists.Ilya Biryukov2018-04-251-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The example that was broken before (^ designates completion points): class Foo { Foo() : fie^ld^() {} // no completions were provided here. int field; }; To fix it we don't cut off lexing after an identifier followed by code completion token is lexed. Instead we skip the rest of identifier and continue lexing. This is consistent with behavior of completion when completion token is right before the identifier. Reviewers: sammccall, aaron.ballman, bkramer, sepavloff, arphaman, rsmith Reviewed By: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D44932 llvm-svn: 330833
OpenPOWER on IntegriCloud