summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* When instantiating a deduction guide, transform its name.Richard Smith2017-12-211-3/+7
| | | | | | Otherwise it will serve as a deduction guide for the wrong class template. llvm-svn: 321297
* Add support for ObjectFormat to TargetSpecificAttrErich Keane2017-12-201-6/+0
| | | | | | | | | | | | | | | | Looking through the code, I saw a FIXME on IFunc to switch it to a target specific attribute. In looking through it, i saw that the no-longer-appropriately-named TargetArch didn't support ObjectFormat checking. This patch changes the name of TargetArch to TargetSpecific (since it checks much more than just Arch), makes "Arch" optional, adds support for ObjectFormat, better documents the TargetSpecific type, and changes IFunc over to a TargetSpecificAttr. Differential Revision: https://reviews.llvm.org/D41303 llvm-svn: 321201
* [Frontend] Handle skipped bodies in template instantiationsIlya Biryukov2017-12-202-11/+18
| | | | | | | | | | | | | | | | | | Summary: - Fixed an assert in Sema::InstantiateFunctionDefinition and added support for instantiating a function template with skipped body. - Properly call setHasSkippedBody for FunctionTemplateDecl passed to Sema::ActOnSkippedFunctionBody. Reviewers: sepavloff, bkramer Reviewed By: sepavloff Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D41237 llvm-svn: 321174
* Add explicit break (PR35700).Adrian Prantl2017-12-191-0/+1
| | | | llvm-svn: 321116
* Silence a bunch of implicit fallthrough warningsAdrian Prantl2017-12-1914-28/+31
| | | | llvm-svn: 321115
* Refactor overridden methods iteration to avoid double lookups.Benjamin Kramer2017-12-173-28/+15
| | | | | | Convert most uses to range-for loops. No functionality change intended. llvm-svn: 320954
* Don't trigger -Wuser-defined-literals for system headersDimitry Andric2017-12-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In D41064, I proposed adding `#pragma clang diagnostic ignored "-Wuser-defined-literals"` to some of libc++'s headers, since these warnings are now triggered by clang's new `-std=gnu++14` default: ``` $ cat test.cpp #include <string> $ clang -std=c++14 -Wsystem-headers -Wall -Wextra -c test.cpp In file included from test.cpp:1: In file included from /usr/include/c++/v1/string:470: /usr/include/c++/v1/string_view:763:29: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals] basic_string_view<char> operator "" sv(const char *__str, size_t __len) ^ /usr/include/c++/v1/string_view:769:32: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals] basic_string_view<wchar_t> operator "" sv(const wchar_t *__str, size_t __len) ^ /usr/include/c++/v1/string_view:775:33: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals] basic_string_view<char16_t> operator "" sv(const char16_t *__str, size_t __len) ^ /usr/include/c++/v1/string_view:781:33: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals] basic_string_view<char32_t> operator "" sv(const char32_t *__str, size_t __len) ^ In file included from test.cpp:1: /usr/include/c++/v1/string:4012:24: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals] basic_string<char> operator "" s( const char *__str, size_t __len ) ^ /usr/include/c++/v1/string:4018:27: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals] basic_string<wchar_t> operator "" s( const wchar_t *__str, size_t __len ) ^ /usr/include/c++/v1/string:4024:28: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals] basic_string<char16_t> operator "" s( const char16_t *__str, size_t __len ) ^ /usr/include/c++/v1/string:4030:28: warning: user-defined literal suffixes not starting with '_' are reserved [-Wuser-defined-literals] basic_string<char32_t> operator "" s( const char32_t *__str, size_t __len ) ^ 8 warnings generated. ``` Both @aaron.ballman and @mclow.lists felt that adding this workaround to the libc++ headers was the wrong way, and it should be fixed in clang instead. Here is a proposal to do just that. I verified that this suppresses the warning, even when -Wsystem-headers is used, and that the warning is still emitted for a declaration outside of system headers. Reviewers: aaron.ballman, mclow.lists, rsmith Reviewed By: aaron.ballman Subscribers: mclow.lists, aaron.ballman, andrew, emaste, cfe-commits Differential Revision: https://reviews.llvm.org/D41080 llvm-svn: 320755
* [ThreadSafetyAnalysis] Fix isCapabilityExprYi Kong2017-12-141-5/+4
| | | | | | | | | | | | There are many more expr types that can be a capability expr, like CXXThisExpr, CallExpr, MemberExpr. Instead of enumerating all of them, just check typeHasCapability for any type given. Also add & and * operators to allowed unary operators. Differential Revision: https://reviews.llvm.org/D41224 llvm-svn: 320753
* When attempting to complete an incomplete array bound type in an expression,Richard Smith2017-12-141-18/+20
| | | | | | | | | | update the type from the definition even if we didn't instantiate a definition. We may have instantiated the definition in an earlier stage of semantic analysis, after creating the DeclRefExpr but before we reach a point where a complete expression type is required. llvm-svn: 320709
* [c++20] P0515R3: Parsing support and basic AST construction for operator <=>.Richard Smith2017-12-144-19/+52
| | | | | | | | | | | | | | | Adding the new enumerator forced a bunch more changes into this patch than I would have liked. The -Wtautological-compare warning was extended to properly check the new comparison operator, clang-format needed updating because it uses precedence levels as weights for determining where to break lines (and several operators increased their precedence levels with this change), thread-safety analysis needed changes to build its own IL properly for the new operator. All "real" semantic checking for this operator has been deferred to a future patch. For now, we use the relational comparison rules and arbitrarily give the builtin form of the operator a return type of 'void'. llvm-svn: 320707
* [OPENMP] Initial codegen for `target teams distribute simd` directive.Alexey Bataev2017-12-131-4/+15
| | | | | | | Host + generic device codegen for `target teams distribute simd` directive. llvm-svn: 320608
* [OPENMP] Support `reduction` clause on target-based directives.Alexey Bataev2017-12-131-3/+7
| | | | | | | OpenMP 5.0 added support for `reduction` clause in target-based directives. Patch adds this support to clang. llvm-svn: 320596
* [OPENMP] Fix handling of clauses in clause parsing mode.Alexey Bataev2017-12-131-2/+6
| | | | | | | The compiler may generate incorrect code if we try to capture the variable in clause parsing mode. llvm-svn: 320590
* [Sema] Ignore decls in namespaces when global decls are not wanted.Eric Liu2017-12-131-4/+7
| | | | | | | | | | | | | | Summary: ... in qualified code completion and decl lookup. Reviewers: ilya-biryukov, arphaman Reviewed By: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D40562 llvm-svn: 320563
* [OpenMP] Diagnose function name on the link clauseKelvin Li2017-12-121-2/+13
| | | | | | | | | | | This patch is to add diagnose when a function name is specified on the link clause. According to the OpenMP spec, only the list items that exclude the function name are allowed on the link clause. Differential Revision: https://reviews.llvm.org/D40968 llvm-svn: 320521
* Revert a part of 320489 that was submitted unintentionally.Erich Keane2017-12-121-2/+1
| | | | llvm-svn: 320493
* Fix ICE when __has_unqiue_object_representations called with invalid declErich Keane2017-12-121-1/+2
| | | | llvm-svn: 320489
* [SemaCodeComplete] Allow passing out scope specifiers in qualified-id ↵Eric Liu2017-12-121-7/+19
| | | | | | | | | | | | | | completions via completion context. Reviewers: ilya-biryukov, arphaman Reviewed By: arphaman Subscribers: nik, cfe-commits Differential Revision: https://reviews.llvm.org/D40563 llvm-svn: 320471
* PR35586: Relax two asserts that are overly restrictiveErich Keane2017-12-111-2/+4
| | | | | | | | | The two asserts are too aggressive. In C++ mode, an enum is NOT considered an integral type, but an enum value is allowed to be an enum. This patch relaxes the two asserts to allow the enum value as well (as typechecking does). llvm-svn: 320411
* P0620 follow-up: deducing `auto` from braced-init-list in new exprZhihao Yuan2017-12-111-5/+12
| | | | | | | | | | | | | | | | | | | Summary: This is a side-effect brought in by p0620r0, which allows other placeholder types (derived from `auto` and `decltype(auto)`) to be usable in a `new` expression with a single-clause //braced-init-list// as its initializer (8.3.4 [expr.new]/2). N3922 defined its semantics. References: http://wg21.link/p0620r0 http://wg21.link/n3922 Reviewers: rsmith, aaron.ballman Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D39451 llvm-svn: 320401
* [Sema] Fix crash in unused-lambda-capture warning for VLAsMalcolm Parsons2017-12-111-0/+3
| | | | | | | | | | | | | | | | | | | | Summary: Clang was crashing when diagnosing an unused-lambda-capture for a VLA because From.getVariable() is null for the capture of a VLA bound. Warning about the VLA bound capture is not helpful, so only warn for the VLA itself. Fixes: PR35555 Reviewers: aaron.ballman, dim, rsmith Reviewed By: aaron.ballman, dim Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41016 llvm-svn: 320396
* [CodeGen][X86] Fix handling of __fp16 vectors.Akira Hatanaka2017-12-091-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes a bug in IRGen where it generates completely broken code for __fp16 vectors on X86. For example when the following code is compiled: half4 hv0, hv1, hv2; // these are vectors of __fp16. void foo221() { hv0 = hv1 + hv2; } clang generates the following IR, in which two i16 vectors are added: @hv1 = common global <4 x i16> zeroinitializer, align 8 @hv2 = common global <4 x i16> zeroinitializer, align 8 @hv0 = common global <4 x i16> zeroinitializer, align 8 define void @foo221() { %0 = load <4 x i16>, <4 x i16>* @hv1, align 8 %1 = load <4 x i16>, <4 x i16>* @hv2, align 8 %add = add <4 x i16> %0, %1 store <4 x i16> %add, <4 x i16>* @hv0, align 8 ret void } To fix the bug, this commit uses the code committed in r314056, which modified clang to promote and truncate __fp16 vectors to and from float vectors in the AST. It also fixes another IRGen bug where a short value is assigned to an __fp16 variable without any integer-to-floating-point conversion, as shown in the following example: __fp16 a; short b; void foo1() { a = b; } @b = common global i16 0, align 2 @a = common global i16 0, align 2 define void @foo1() #0 { %0 = load i16, i16* @b, align 2 store i16 %0, i16* @a, align 2 ret void } rdar://problem/20625184 Differential Revision: https://reviews.llvm.org/D40112 llvm-svn: 320215
* Remove creation of out-of-bounds value of enumeration type (resulting in UB).Richard Smith2017-12-083-8/+8
| | | | | | | Also remove unnecessary initialization of out-parameters with this value, so that MSan is able to catch errors appropriately. llvm-svn: 320212
* Unify implementation of our two different flavours of -Wtautological-compare,Richard Smith2017-12-081-200/+159
| | | | | | | | | | | | | | | | | | | | | | | | | and fold together into a single function. In so doing, fix a handful of remaining bugs where we would report false positives or false negatives if we promote a signed value to an unsigned type for the comparison. This re-commits r320122 and r320124, minus two changes: * Comparisons between a constant and a non-constant expression of enumeration type never warn, not even if the constant is out of range. We should be warning about the creation of such a constant, not about its use. * We do not use more precise bit-widths for comparisons against bit-fields. The more precise diagnostics probably are the right thing, but we should consider moving them under their own warning flag. Other than the refactoring, this patch should only change the behavior for the buggy cases (where the warnings didn't take into account that promotion from signed to unsigned can leave a range of inaccessible values in the middle of the promoted type). llvm-svn: 320211
* Revert "Unify implementation of our two different flavours of ↵Hans Wennborg2017-12-081-155/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | -Wtautological-compare." > Unify implementation of our two different flavours of -Wtautological-compare. > > In so doing, fix a handful of remaining bugs where we would report false > positives or false negatives if we promote a signed value to an unsigned type > for the comparison. This caused a new warning in Chromium: ../../base/trace_event/trace_log.cc:1545:29: error: comparison of constant 64 with expression of type 'unsigned int' is always true [-Werror,-Wtautological-constant-out-of-range-compare] DCHECK(handle.event_index < TraceBufferChunk::kTraceBufferChunkSize); ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The 'unsigned int' is really a 6-bit bitfield, which is why it's always less than 64. I thought we didn't use to warn (with out-of-range-compare) when comparing against the boundaries of a type? llvm-svn: 320162
* [OPENMP] Initial codegen for `target teams distribute` directive.Alexey Bataev2017-12-082-6/+28
| | | | | | Host + default devices codegen for `target teams distribute` directive. llvm-svn: 320149
* Revert r320124 "Fold together the in-range and out-of-range portions of ↵Hans Wennborg2017-12-081-35/+98
| | | | | | | | | | | | | | | | | | | | -Wtautological-compare." This broke Chromium: ../../base/trace_event/trace_log.cc:1545:29: error: comparison of constant 64 with expression of type 'unsigned int' is always true [-Werror,-Wtautological-constant-out-of-range-compare] DCHECK(handle.event_index < TraceBufferChunk::kTraceBufferChunkSize); ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The 'unsigned int' is really a 6-bit bitfield, which is why it's always less than 63. Did this use to fall under the "in-range" case before? I thought we didn't use to warn when comparing against the boundaries of a type. llvm-svn: 320133
* Fold together the in-range and out-of-range portions of -Wtautological-compare.Richard Smith2017-12-081-98/+35
| | | | llvm-svn: 320124
* Unify implementation of our two different flavours of -Wtautological-compare.Richard Smith2017-12-081-145/+155
| | | | | | | | In so doing, fix a handful of remaining bugs where we would report false positives or false negatives if we promote a signed value to an unsigned type for the comparison. llvm-svn: 320122
* [OPENMP] Do not capture private variables in the target regions.Alexey Bataev2017-12-071-2/+4
| | | | | | | | Private variables are completely redefined in the outlined regions, so we don't need to capture them. Patch adds this behavior to the target-based regions. llvm-svn: 320078
* [ARM] ACLE parallel arithmetic and DSP style multiplicationsSjoerd Meijer2017-12-071-8/+13
| | | | | | | | | | | This is a follow up of r302131, in which we forgot to add SemaChecking tests. Adding these tests revealed two problems which have been fixed: - added missing intrinsic __qdbl, - properly range checking ssat16 and usat16. Differential Revision: https://reviews.llvm.org/D40888 llvm-svn: 320019
* Ignore pointers to incomplete types when diagnosing misaligned addressesRoger Ferrer Ibanez2017-12-071-2/+3
| | | | | | | | | This is a fix for PR35509 in which we crash because we attempt to compute the alignment of an incomplete type. Differential Revision: https://reviews.llvm.org/D40895 llvm-svn: 320017
* Allow conditions to be decomposed with structured bindingsZhihao Yuan2017-12-071-5/+9
| | | | | | | | | | | | | | | | | | | | | Summary: This feature was discussed but not yet proposed. It allows a structured binding to appear as a //condition// if (auto [ok, val] = f(...)) So the user can save an extra //condition// if the statement can test the value to-be-decomposed instead. Formally, it makes the value of the underlying object of the structured binding declaration also the value of a //condition// that is an initialized declaration. Considering its logicality which is entirely evident from its trivial implementation, I think it might be acceptable to land it as an extension for now before I write the paper. Reviewers: rsmith, faisalv, aaron.ballman Reviewed By: rsmith Subscribers: aaron.ballman, cfe-commits Differential Revision: https://reviews.llvm.org/D39284 llvm-svn: 320011
* Test commit accessZhihao Yuan2017-12-071-1/+1
| | | | llvm-svn: 320008
* Remove old concepts parsing codeHubert Tong2017-12-074-237/+1
| | | | | | | | | | | | | | | | | | Summary: This is so we can implement concepts per P0734R0. Relevant failing test cases are disabled. Reviewers: hubert.reinterpretcast, rsmith, saar.raz, nwilson Reviewed By: saar.raz Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D40380 Patch by Changyu Li! llvm-svn: 319992
* Delete special-case "out-of-range" handling for bools, and just use the normalRichard Smith2017-12-061-115/+61
| | | | | | | | | | | codepath plus the new "minimum / maximum value of type" diagnostic to get the same effect. Move the warning for an in-range but tautological comparison of a constant (0 or 1) against a bool out of -Wtautological-constant-out-of-range-compare into the more-appropriate -Wtautological-constant-compare. llvm-svn: 319942
* [OPENMP] Initial codegen for `teams distribute simd` directive.Alexey Bataev2017-12-061-3/+15
| | | | | | Host + default devices codegen for `teams distribute simd` directive. llvm-svn: 319896
* Fix a bunch of wrong "tautological unsigned enum compare" diagnostics in C++.Richard Smith2017-12-061-3/+4
| | | | | | | An enumeration with a fixed underlying type can have any value in its underlying type, not just those spanned by the values of its enumerators. llvm-svn: 319875
* P0722R2: The first parameter in an implicit call to a destroying operatorRichard Smith2017-12-051-0/+9
| | | | | | delete should be a cv-unqualified pointer to the deleted object. llvm-svn: 319858
* [OPENMP] Fix implicit mapping analysis.Alexey Bataev2017-12-051-30/+47
| | | | | | | Fixed processing of implicitly mapped objects in target-based executable directives. llvm-svn: 319814
* [OPENMP] Remove non-required parameters for distribute simd outlinedAlexey Bataev2017-12-051-2/+2
| | | | | | region, NFC. llvm-svn: 319800
* [OPENMP] Fix assert fail after target implicit map checks.Alexey Bataev2017-12-051-36/+23
| | | | | | | | If the error is generated during analysis of implicitly or explicitly mapped variables, it may cause compiler crash because of incorrect analysis. llvm-svn: 319774
* Generalize "static data member instantiated" notification to cover variable ↵Richard Smith2017-12-055-80/+59
| | | | | | | | | templates too. While here, split the "point of instantiation changed" notification out from it; these two really are orthogonal changes. llvm-svn: 319727
* [OpenMP] Initial implementation of code generation for pragma 'teams ↵Carlo Bertolli2017-12-041-3/+15
| | | | | | | | | | distribute parallel for simd' on host https://reviews.llvm.org/D40795 This includes regression tests for all associated clauses. llvm-svn: 319696
* Now that C++17 is official (https://www.iso.org/standard/68564.html), start ↵Aaron Ballman2017-12-0416-60/+60
| | | | | | changing the C++1z terminology over to C++17. NFC intended, these are all mechanical changes. llvm-svn: 319688
* [OPENMP] Codegen for `distribute simd` directive.Alexey Bataev2017-12-041-2/+12
| | | | | | Initial codegen support for `distribute simd` directive. llvm-svn: 319661
* PR35456: Track definedness of variable template specializations separately fromRichard Smith2017-12-021-0/+9
| | | | | | | | | | whether they have an initializer. We cannot distinguish between a declaration of a variable template specialization and a definition of one that lacks an initializer without this, and would previously mistake the latter for the former. llvm-svn: 319605
* [c++17] When deducing the type of a non-type template parameter from the typeRichard Smith2017-12-011-2/+3
| | | | | | | | | of its argument, perform function-to-pointer and array-to-pointer decay on the parameter type first. Otherwise deduction will fail, as the type of the argument will be decayed. llvm-svn: 319584
* [OPENMP] Do not allow variables to be first|last-privates inAlexey Bataev2017-12-011-10/+5
| | | | | | | | distribute directives. OpenMP standard does not allow to mark the variables as firstprivate and lastprivate at the same time in distribute-based directives. Patch fixes this problem. llvm-svn: 319560
* Disallow a cleanup attribute from appertaining to a parameter (the attribute ↵Aaron Ballman2017-12-011-7/+1
| | | | | | only appertains to local variables and is silently a noop on parameters). This repurposes the unused (and syntactically incorrect) NormalVar attribute subject. llvm-svn: 319555
OpenPOWER on IntegriCloud