summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* [AArch64] Add support for Transactional Memory Extension (TME)Momchil Velikov2019-07-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Re-commit r366322 after some fixes TME is a future architecture technology, documented in https://developer.arm.com/architectures/cpu-architecture/a-profile/exploration-tools https://developer.arm.com/docs/ddi0601/a More about the future architectures: https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/new-technologies-for-the-arm-a-profile-architecture This patch adds support for the TME instructions TSTART, TTEST, TCOMMIT, and TCANCEL and the target feature/arch extension "tme". It also implements TME builtin functions, defined in ACLE Q2 2019 (https://developer.arm.com/docs/101028/latest) Differential Revision: https://reviews.llvm.org/D64416 Patch by Javed Absar and Momchil Velikov llvm-svn: 367428
* [Fix] Customize warnings for missing built-in typesJohannes Doerfert2019-07-311-3/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we detect a built-in declaration for which we cannot derive a type matching the pattern in the Builtins.def file, we currently emit a warning that the respective header is needed. However, this is not necessarily the behavior we want as it has no connection to the location of the declaration (which can actually be in the header in question). Instead, this warning is generated - if we could not build the type for the pattern on file (for some reason). Here we should make the reason explicit. The actual problem is otherwise circumvented as the warning is misleading, see [0] for an example. - if we could not build the type for the pattern because we do not have a type on record, possible since D55483, we should not emit any warning. See [1] for a legitimate problem. This patch address both cases. For the "setjmp" family a new warning is introduced and for built-ins without type on record, so far "pthread_create", we do not emit the warning anymore. Also see: PR40692 [0] https://lkml.org/lkml/2019/1/11/718 [1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235583 Differential Revision: https://reviews.llvm.org/D58091 llvm-svn: 367387
* [Sema] Actually map a variable template specialization from pattern to ↵Erik Pilkington2019-07-302-29/+27
| | | | | | | | | | | | | instantiation We were previously just using a specialization in the class template instead of creating a new specialization in the class instantiation. Fixes llvm.org/PR42779. Differential revision: https://reviews.llvm.org/D65359 llvm-svn: 367367
* [NFC] avoid AlignedCharArray in clangJF Bastien2019-07-293-11/+8
| | | | | | As discussed in D65249, don't use AlignedCharArray or std::aligned_storage. Just use alignas(X) char Buf[Size];. This will allow me to remove AlignedCharArray entirely, and works on the current minimum version of Visual Studio. llvm-svn: 367274
* Give the 'signed/unsigned wchar_t' extension a warning flag, and followRichard Smith2019-07-291-2/+2
| | | | | | GCC 9 in promoting it to an error by default. llvm-svn: 367255
* When determining whether a lambda-expression is implicitly constexpr,Richard Smith2019-07-293-111/+227
| | | | | | | | | | | | check the formal rules rather than seeing if the normal checks produce a diagnostic. This fixes the handling of C++2a extensions in lambdas in C++17 mode, as well as some corner cases in earlier language modes where we issue diagnostics for things other than not satisfying the formal constexpr requirements. llvm-svn: 367254
* [OpenCL] Rename builtin definition classesSven van Haastregt2019-07-291-60/+63
| | | | | | | | | Factor out some of the renames from D63434 and D63442, and generate half type convert_ builtins. Patch by Pierre Gondois and Sven van Haastregt. llvm-svn: 367229
* [Sema] Fix -Wuninitialized for struct assignment from GNU C statement expressionNathan Huckleberry2019-07-261-3/+6
| | | | | | | | | | | | | | | | | | | Summary: Do not automatically report self references of structs in statement expression as warnings. Instead wait for uninitialized cfg analysis. https://bugs.llvm.org/show_bug.cgi?id=42604 Reviewers: aaron.ballman, rsmith, nickdesaulniers Reviewed By: aaron.ballman, nickdesaulniers Subscribers: nathanchance, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64678 llvm-svn: 367134
* Revert "[Sema] Diagnose default-initialization, destruction, and copying of"Akira Hatanaka2019-07-264-352/+34
| | | | | | | | | | | | | | | This reverts commit r365985. Prior to r365985, clang used to mark C union fields that have non-trivial ObjC ownership qualifiers as unavailable if the union was declared in a system header. r365985 stopped doing so, which caused the swift compiler to crash when it tried to import a non-trivial union. I have a patch that fixes the crash (https://reviews.llvm.org/D65256), but I'm temporarily reverting the original patch until we can decide on whether it's taking the right approach. llvm-svn: 367076
* [Sema] add -Walloca to flag uses of `alloca`George Burgess IV2019-07-251-0/+4
| | | | | | | | | | | | | This CL adds an optional warning to diagnose uses of the `__builtin_alloca` family of functions. The use of these functions is discouraged by many, so it seems like a good idea to allow clang to warn about it. Patch by Elaina Guan! Differential Revision: https://reviews.llvm.org/D64883 llvm-svn: 367067
* Add lifetime categories attributesMatthias Gehre2019-07-251-2/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is the first part of work announced in "[RFC] Adding lifetime analysis to clang" [0], i.e. the addition of the [[gsl::Owner(T)]] and [[gsl::Pointer(T)]] attributes, which will enable user-defined types to participate in the lifetime analysis (which will be part of the next PR). The type `T` here is called "DerefType" in the paper, and denotes the type that an Owner owns and a Pointer points to. E.g. `std::vector<int>` should be annotated with `[[gsl::Owner(int)]]` and a `std::vector<int>::iterator` with `[[gsl::Pointer(int)]]`. [0] http://lists.llvm.org/pipermail/cfe-dev/2018-November/060355.html Reviewers: gribozavr Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63954 llvm-svn: 367040
* Allow prefetching from non-zero address spacesJF Bastien2019-07-251-2/+3
| | | | | | | | | | | | | | | Summary: This is useful for targets which have prefetch instructions for non-default address spaces. <rdar://problem/42662136> Subscribers: nemanjai, javed.absar, hiraditya, kbarton, jkorous, dexonsmith, cfe-commits, llvm-commits, RKSimon, hfinkel, t.p.northover, craig.topper, anemet Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D65254 llvm-svn: 367032
* Implement P1771Erich Keane2019-07-252-16/+46
| | | | | | | | | | | | | As passed in the Cologne meeting and treated by Core as a DR, [[nodiscard]] was applied to constructors so that they can be diagnosed in cases where the user forgets a variable name for a type. The intent is to enable the library to start using this on the constructors of scope_guard/lock_guard. Differential Revision: https://reviews.llvm.org/D64914 llvm-svn: 367027
* [Clang] New loop pragma vectorize_predicateSjoerd Meijer2019-07-251-2/+10
| | | | | | | | | | | | | | | | | | | This adds a new vectorize predication loop hint: #pragma clang loop vectorize_predicate(enable) that can be used to indicate to the vectoriser that all (load/store) instructions should be predicated (masked). This allows, for example, folding of the remainder loop into the main loop. This patch will be followed up with D64916 and D65197. The former is a refactoring in the loopvectorizer and the groundwork to make tail loop folding a more general concept, and in the latter the actual tail loop folding transformation will be implemented. Differential Revision: https://reviews.llvm.org/D64744 llvm-svn: 366989
* Revert "[Sema] Enable -Wimplicit-float-conversion for integral to floating ↵Petr Hosek2019-07-251-49/+0
| | | | | | | | | | | point precision loss" This reverts commit r366972 which broke the following tests: Clang :: CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp Clang :: CXX/dcl.decl/dcl.init/dcl.init.list/p7-cxx11-nowarn.cpp llvm-svn: 366979
* [Sema] Enable -Wimplicit-float-conversion for integral to floating point ↵Ziang Wan2019-07-251-0/+49
| | | | | | | | | | | | | | | precision loss Issue an warning when the code tries to do an implicit int -> float conversion, where the float type ha a narrower significant than the float type. The new warning is controlled by flag -Wimplicit-int-float-conversion, under -Wimplicit-float-conversion and -Wconversion. Differential Revision: https://reviews.llvm.org/D64666 llvm-svn: 366972
* [clang][NFCI] Fix random typosJan Korous2019-07-231-1/+1
| | | | llvm-svn: 366823
* [OpenCL] Improve destructor support in C++ for OpenCLMarco Antognini2019-07-222-28/+26
| | | | | | | This re-applies r366422 with a fix for Bug PR42665 and a new regression test. llvm-svn: 366670
* Fix cppcheck reduce scope variable warnings. NFCISimon Pilgrim2019-07-201-3/+3
| | | | | | Move a couple of variables inside the block where they are actually needed. llvm-svn: 366635
* [c++20] P1161R3: a[b,c] is deprecated.Richard Smith2019-07-201-0/+9
| | | | llvm-svn: 366630
* Implement P1301R4, which allows specifying an optional message on the ↵Aaron Ballman2019-07-202-9/+34
| | | | | | | | [[nodiscard]] attribute. This also bumps the attribute feature test value and introduces the notion of a C++2a extension warning. llvm-svn: 366626
* Disallow most calling convention attributes on PS4Sunil Srivastava2019-07-191-0/+5
| | | | | | | | PS4 now only allows "cdecl", and its equivalent on PS4, "sysv_abi". Differential Revision: https://reviews.llvm.org/D64780 llvm-svn: 366617
* [OPENMP]Fix sharing of threadprivate variables with TLS support.Alexey Bataev2019-07-181-0/+7
| | | | | | | | | If the threadprivate variable is used in the copyin clause on inner parallel directive with TLS support, we capture this variable in all outer OpenMP scopes. It leads to the fact that in all scopes we're working with the original variable, not the threadprivate copies. llvm-svn: 366483
* [OPENMP]Provide correct data sharing attributes for loop controlAlexey Bataev2019-07-181-45/+55
| | | | | | | | | | | | variables. Loop control variables are private in loop-based constructs and we shall take this into account when generate the code for inner constructs. Currently, those variables are reported as shared in many cases. Moved the analysis of the data-sharing attributes of the loop control variable to an early semantic stage to correctly handle their attributes. llvm-svn: 366474
* Revert r366422: [OpenCL] Improve destructor support in C++ for OpenCLIlya Biryukov2019-07-182-26/+28
| | | | | | | | Reason: this commit causes crashes in the clang compiler when building LLVM Support with libc++, see https://bugs.llvm.org/show_bug.cgi?id=42665 for details. llvm-svn: 366429
* [OpenCL] Improve destructor support in C++ for OpenCLMarco Antognini2019-07-182-28/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch does mainly three things: 1. It fixes a false positive error detection in Sema that is similar to D62156. The error happens when explicitly calling an overloaded destructor for different address spaces. 2. It selects the correct destructor when multiple overloads for address spaces are available. 3. It inserts the expected address space cast when invoking a destructor, if needed, and therefore fixes a crash due to the unmet assertion in llvm::CastInst::Create. The following is a reproducer of the three issues: struct MyType { ~MyType() {} ~MyType() __constant {} }; __constant MyType myGlobal{}; kernel void foo() { myGlobal.~MyType(); // 1 and 2. // 1. error: cannot initialize object parameter of type // '__generic MyType' with an expression of type '__constant MyType' // 2. error: no matching member function for call to '~MyType' } kernel void bar() { // 3. The implicit call to the destructor crashes due to: // Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed. // in llvm::CastInst::Create. MyType myLocal; } The added test depends on D62413 and covers a few more things than the above reproducer. Subscribers: yaxunl, Anastasia, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64569 llvm-svn: 366422
* [OpenCL] Update comments/diagnostics to refer to C++ for OpenCLAnastasia Stulova2019-07-185-13/+11
| | | | | | | | | Clang doesn't implement OpenCL C++, change the comments to reflect that. Differential Revision: https://reviews.llvm.org/D64867 llvm-svn: 366421
* [OpenCL][PR42033] Fix addr space deduction with template parametersAnastasia Stulova2019-07-183-9/+7
| | | | | | | | | | | | | | | If dependent types appear in pointers or references we allow addr space deduction because the addr space in template argument will belong to the pointee and not the pointer or reference itself. We also don't diagnose addr space on a function return type after template instantiation. If any addr space for the return type was provided on a template parameter this will be diagnosed during the parsing of template definition. Differential Revision: https://reviews.llvm.org/D62584 llvm-svn: 366417
* [CodeComplete] Fix ASTUnit cached completion of macros from preamble, broken ↵Sam McCall2019-07-181-4/+2
| | | | | | | | | | | | | | | | | | in r342528 Summary: The problem is the default LoadExternal with no completer, which happens when loading global results. Reviewers: ilya-biryukov, nik Subscribers: arphaman, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64864 llvm-svn: 366409
* Renamed and changed the wording of warn_cconv_ignoredSunil Srivastava2019-07-173-4/+4
| | | | | | | | As discussed in D64780 the wording of this warning message is being changed to say 'is not supported' instead of 'ignored', and the diag ID itself is being changed to warn_cconv_not_supported. llvm-svn: 366368
* Revert [AArch64] Add support for Transactional Memory Extension (TME)Momchil Velikov2019-07-171-1/+0
| | | | | | This reverts r366322 (git commit 4b8da3a503e434ddbc08ecf66582475765f449bc) llvm-svn: 366355
* [OPENMP]Fix crash in LoopCounterRefChecker when MemberExpr is not Var or FieldMike Rice2019-07-171-1/+2
| | | | | | | | | | checkDecl is only valid for VarDecls or FieldDecls, since getCanonicalDecl expects only these. Prevent other Decl kinds (such as CXXMethodDecls and EnumConstantDecls) from entering and asserting. Differential Revision: https://reviews.llvm.org/D64842 llvm-svn: 366336
* [AArch64] Add support for Transactional Memory Extension (TME)Momchil Velikov2019-07-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | TME is a future architecture technology, documented in https://developer.arm.com/architectures/cpu-architecture/a-profile/exploration-tools https://developer.arm.com/docs/ddi0601/a More about the future architectures: https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/new-technologies-for-the-arm-a-profile-architecture This patch adds support for the TME instructions TSTART, TTEST, TCOMMIT, and TCANCEL and the target feature/arch extension "tme". It also implements TME builtin functions, defined in ACLE Q2 2019 (https://developer.arm.com/docs/101028/latest) Patch by Javed Absar and Momchil Velikov Differential Revision: https://reviews.llvm.org/D64416 llvm-svn: 366322
* [OpenCL][Sema] Minor refactoring and constraint checkingMarco Antognini2019-07-171-9/+4
| | | | | | | | | | | | | | Summary: Simplify code a bit and add assertion to address post-landing comments from D64083. Subscribers: yaxunl, Anastasia, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64804 llvm-svn: 366306
* [OpenCL] Fixing sampler initialisations for C++ mode.Neil Hickey2019-07-162-3/+7
| | | | | | | | Allow conversions between integer and sampler type. Differential Revision: https://reviews.llvm.org/D64791 llvm-svn: 366212
* [SemaTemplate] Fix uncorrected typos after pack expansionSam McCall2019-07-161-0/+1
| | | | | | | | | | | | | | | | Summary: This case is particularly important for clangd, as it is triggered after inserting the snippet for variadic functions. Reviewers: kadircet, ilya-biryukov Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D64677 llvm-svn: 366200
* Fix parameter name comments using clang-tidy. NFC.Rui Ueyama2019-07-1621-86/+86
| | | | | | | | | | | | | | | | | | | | | This patch applies clang-tidy's bugprone-argument-comment tool to LLVM, clang and lld source trees. Here is how I created this patch: $ git clone https://github.com/llvm/llvm-project.git $ cd llvm-project $ mkdir build $ cd build $ cmake -GNinja -DCMAKE_BUILD_TYPE=Debug \ -DLLVM_ENABLE_PROJECTS='clang;lld;clang-tools-extra' \ -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DLLVM_ENABLE_LLD=On \ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../llvm $ ninja $ parallel clang-tidy -checks='-*,bugprone-argument-comment' \ -config='{CheckOptions: [{key: StrictMode, value: 1}]}' -fix \ ::: ../llvm/lib/**/*.{cpp,h} ../clang/lib/**/*.{cpp,h} ../lld/**/*.{cpp,h} llvm-svn: 366177
* [OpenCL] Make TableGen'd builtin tables and helper functions staticTom Stellard2019-07-151-1/+1
| | | | | | | | | | | | | | Reviewers: Pierre, Anastasia Reviewed By: Anastasia Subscribers: yaxunl, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64608 llvm-svn: 366143
* [OpenCL] Deduce addr space for pointee of dependent types in instantiation.Anastasia Stulova2019-07-151-0/+17
| | | | | | | | | | Since pointee doesn't require context sensitive addr space deduction it's easier to handle pointee of dependent types during templ instantiation. Differential Revision: https://reviews.llvm.org/D64400 llvm-svn: 366063
* Fix uninitialized variable analyzer warning. NFCI.Simon Pilgrim2019-07-141-1/+1
| | | | llvm-svn: 366029
* Remove extra ';' to silent compiler warning.Michael Liao2019-07-131-2/+3
| | | | | | - Plus extra style formatting. llvm-svn: 366010
* [Sema] Diagnose default-initialization, destruction, and copying ofAkira Hatanaka2019-07-134-34/+351
| | | | | | | | | | | | | | | | | | | | | | | | | | | non-trivial C union types This patch diagnoses uses of non-trivial C unions and structs/unions containing non-trivial C unions in the following contexts, which require default-initialization, destruction, or copying of the union objects, instead of disallowing fields of non-trivial types in C unions, which is what we currently do: - function parameters. - function returns. - assignments. - compound literals. - block captures except capturing of `__block` variables by non-escaping blocks. - local and global variable definitions. - lvalue-to-rvalue conversions of volatile types. See the discussion in https://reviews.llvm.org/D62988 for more background. rdar://problem/50679094 Differential Revision: https://reviews.llvm.org/D63753 llvm-svn: 365985
* [SystemZ] Add support for new cpu architecture - arch13Ulrich Weigand2019-07-121-0/+2
| | | | | | | | | | | | | | | | | This patch series adds support for the next-generation arch13 CPU architecture to the SystemZ backend. This includes: - Basic support for the new processor and its features. - Support for low-level builtins mapped to new LLVM intrinsics. - New high-level intrinsics in vecintrin.h. - Indicate support by defining __VEC__ == 10303. Note: No currently available Z system supports the arch13 architecture. Once new systems become available, the official system name will be added as supported -march name. llvm-svn: 365933
* Delete dead storesFangrui Song2019-07-121-1/+0
| | | | llvm-svn: 365901
* [OPENMP]Improve handling of analysis of unsupported VLAs in reductions.Alexey Bataev2019-07-111-4/+8
| | | | | | | | | Fixed the processing of the unsupported VLAs in the reduction clauses. Used targetDiag if the diagnostics can be delayed and emit it immediately if the target does not support VLAs and we're parsing target directive with the reduction clauses. llvm-svn: 365821
* [Concepts] Concept definitions (D40381)Saar Raz2019-07-105-6/+101
| | | | | | | First in a series of patches to land C++2a Concepts support. This patch adds AST and parsing support for concept-declarations. llvm-svn: 365699
* Loop pragma parsing. NFC.Sjoerd Meijer2019-07-101-40/+30
| | | | | | | | | I would like to add some pragma handling here, but couldn't resist a little NFC and tidy up first. Differential Revision: https://reviews.llvm.org/D64471 llvm-svn: 365629
* [MS] Treat ignored explicit calling conventions as an explicit __cdeclReid Kleckner2019-07-091-4/+18
| | | | | | | | | | | | | | | The CCCR_Ignore action is only used for Microsoft calling conventions, mainly because MSVC does not warn when a calling convention would be ignored by the current target. This behavior is actually somewhat important, since windows.h uses WINAPI (which expands to __stdcall) widely. This distinction didn't matter much before the introduction of __vectorcall to x64 and the ability to make that the default calling convention with /Gv. Now, we can't just ignore __stdcall for x64, we have to treat it as an explicit __cdecl annotation. Fixes PR42531 llvm-svn: 365579
* [ObjC] Add a warning for implicit conversions of a constant non-boolean ↵Erik Pilkington2019-07-091-0/+28
| | | | | | | | | | value to BOOL rdar://51954400 Differential revision: https://reviews.llvm.org/D63912 llvm-svn: 365518
* [OpenCL][Sema] Improve address space support for blocksMarco Antognini2019-07-091-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch ensures that the following code is compiled identically with -cl-std=CL2.0 and -fblocks -cl-std=c++. kernel void test(void) { void (^const block_A)(void) = ^{ return; }; } A new test is not added because cl20-device-side-enqueue.cl will cover this once blocks are further improved for C++ for OpenCL. The changes to Sema::PerformImplicitConversion are based on the parts of Sema::CheckAssignmentConstraints on block pointer conversions. Reviewers: rjmccall, Anastasia Subscribers: yaxunl, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64083 llvm-svn: 365500
OpenPOWER on IntegriCloud