summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove unused variables. No functionality change.Benjamin Kramer2017-10-084-4/+0
| | | | llvm-svn: 315196
* Revert "For dllexport class templates, export specializations of member ↵Reid Kleckner2017-10-061-15/+0
| | | | | | | | functions (PR34849)" This reverts r315025, it caused http://crbug.com/772461 llvm-svn: 315111
* [ObjC] Don't warn on readwrite properties with custom setters thatAlex Lorenz2017-10-061-1/+5
| | | | | | | | override readonly properties from protocols rdar://34192541 llvm-svn: 315093
* [OPENMP] Do not capture local static variables.Alexey Bataev2017-10-061-0/+4
| | | | | | | | Previously we may erroneously try to capture locally declared static variables, which will lead to crash for target-based constructs. Patch fixes this problem. llvm-svn: 315076
* [OPENMP] Capture references to global variables.Alexey Bataev2017-10-061-1/+2
| | | | | | | | In C++11 variable to global variables are considered as constant expressions and these variables are not captured in the outlined regions. Patch allows capturing of such variables in the OpenMP regions. llvm-svn: 315074
* For dllexport class templates, export specializations of member functions ↵Hans Wennborg2017-10-051-0/+15
| | | | | | (PR34849) llvm-svn: 315025
* Fix two-phase name lookup for non-dependent overloaded operators.Richard Smith2017-10-052-11/+19
| | | | | | | | If we resolve an overloaded operator call to a specific function during template definition, don't perform ADL during template instantiation. Doing so finds overloads that we're not supposed to find. llvm-svn: 315005
* [OPENMP] Fix mapping|privatization of implicitly captured variables.Alexey Bataev2017-10-051-14/+37
| | | | | | | | If the `defaultmap(tofrom:scalar)` clause is specified, the scalars must be mapped with 'tofrom' modifiers, otherwise they must be captured as firstprivates. llvm-svn: 314995
* Fix 'section' warning behavior with tentatively-defined valuesErich Keane2017-10-041-1/+1
| | | | | | | | | As reported on cfe-commits, r314262 resulted in tentatively-defined variables not being excluded for the warning. Patch By: Elizabeth Andrews llvm-svn: 314939
* [OpenMP] Initial implementation of teams distribute code generationCarlo Bertolli2017-10-041-2/+2
| | | | | | | | https://reviews.llvm.org/D38371 This patch implements codegen for the combined 'teams distribute" OpenMP pragma and adds regression tests for all its clauses. llvm-svn: 314905
* We allow implicit function declarations as an extension in all C dialects. ↵Richard Smith2017-10-041-5/+3
| | | | | | Remove OpenCL special case. llvm-svn: 314872
* PR34822: Fix a collection of related bugs with our handling of C89 implicit ↵Richard Smith2017-10-041-15/+29
| | | | | | | | | | | | | | | | | function declarations. We were injecting the function into the wrong semantic context, resulting in it failing to be registered as a global for redeclaration lookup. As a consequence, we accepted invalid code since r310616. Fixing that resulted in the "out-of-scope declaration" diagnostic firing a lot more often. It turned out that warning codepath was non-conforming, because it did not cause us to inject the implicitly-declared function into the enclosing block scope. We now only warn if the type of the out-of-scope declaration doesn't match the type of an implicitly-declared function; in all other cases, we produce the normal warning for an implicitly-declared function. llvm-svn: 314871
* Suppress -Wmissing-braces warning when aggregate-initializing a struct with ↵Richard Smith2017-10-031-1/+30
| | | | | | | | | | a single field that is itself an aggregate. In C++, such initialization of std::array<T, N> types is guaranteed to work by the standard, is completely idiomatic, and the "suggested" alternative from Clang was technically invalid. llvm-svn: 314838
* [OPENMP] Allow use of declare target directive inside structAlexey Bataev2017-10-031-1/+5
| | | | | | | | | | declaration. Patch allows using of the `#pragma omp declare target`| `#pragma omp end declare target` directives inside the structures if we need to mark as declare target only some static members. llvm-svn: 314833
* [OpenCL] Fix checking of vector type castingYaxun Liu2017-10-031-3/+3
| | | | | | | | | | | | | | | | | | Currently clang allows the following code int a; int b = (const int) a; However it does not the following code int4 a; int4 b = (const int4) a; This is because Clang compares the qualified types instead of unqualified types for vector type casting, which causes the inconsistency. This patch fixes that. Differential Revision: https://reviews.llvm.org/D38463 llvm-svn: 314802
* PR33839: Fix -Wunused handling for structured binding declarations.Richard Smith2017-10-023-6/+26
| | | | | | | We warn about a structured binding declaration being unused only if none of its bindings are used. llvm-svn: 314733
* Revert "[Sema] Warn on attribute nothrow conflicting with language specifiers"Reid Kleckner2017-10-021-20/+1
| | | | | | | | | | | This reverts r314461. It is warning on user code that uses END_COM_MAP(), which expands to declare QueryInterface with conflicting exception specifers. I've spent a while trying to understand why, but haven't been able to extract a reduced test case. Let's revert and I'll keep trying. llvm-svn: 314689
* [OPENMP] Capture argument of `device` clause for target-basedAlexey Bataev2017-10-021-1/+11
| | | | | | | | | | directives. The argument of the `device` clause in target-based executable directives must be captured to support codegen for the `target` directives with the `depend` clauses. llvm-svn: 314686
* Dependent Address Space SupportAndrew Gozillon2017-10-025-36/+251
| | | | | | | | | | | | | | This patch relates to: https://reviews.llvm.org/D33666 This adds support for template parameters to be passed to the address_space attribute. The main goal is to add further flexibility to the attribute and allow for it to be used easily with templates. The main additions are a new type (DependentAddressSpaceType) alongside its TypeLoc and its mangling. As well as the logic required to support dependent address spaces which mainly resides in TreeTransform.h and SemaType.cpp. llvm-svn: 314649
* Test Commit.Andrew Gozillon2017-10-011-1/+0
| | | | llvm-svn: 314623
* Add a "vexing parse" warning for ambiguity between a variable declaration and aRichard Smith2017-09-291-0/+96
| | | | | | | | | | | | | | function-style cast. This fires for cases such as T(x); ... where 'x' was previously declared and T is a type. This construct declares a variable named 'x' rather than the (probably expected) interpretation of a function-style cast of 'x' to T. llvm-svn: 314570
* [Sema] Suppress warnings for C's zero initializerDaniel Marjamaki2017-09-291-2/+5
| | | | | | | | Patch by S. Gilles! Differential Revision: https://reviews.llvm.org/D28148 llvm-svn: 314499
* [X86][MS-InlineAsm] Extended support for variables / identifiers on memory / ↵Coby Tayree2017-09-291-28/+20
| | | | | | | | | | | immediate expressions Allow the proper recognition of Enum values and global variables inside ms inline-asm memory / immediate expressions, as they require some additional overhead and treated incorrect if doesn't early recognized. supersedes D33278, D35774 Differential Revision: https://reviews.llvm.org/D37413 llvm-svn: 314494
* [Sema] Put nullability fix-it after the end of the pointer.Volodymyr Sapsai2017-09-281-15/+22
| | | | | | | | | | | | | | | | | | Fixes nullability fix-it for `id<SomeProtocol>`. With this change nullability specifier is inserted after ">" instead of between "id" and "<". rdar://problem/34260995 Reviewers: jordan_rose, doug.gregor, ahatanak, arphaman Reviewed By: jordan_rose Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D38327 llvm-svn: 314473
* [Sema] Correct nothrow inherited by noexceptErich Keane2017-09-281-0/+3
| | | | | | | | | | | | | | | As reported in https://bugs.llvm.org/show_bug.cgi?id=33235, a noexcept function was unable to inherit from a nothrow defaulted constructor. Attribute "nothrow" is supposed to be semantically identical to noexcept, and in fact, a number of other places in the code treat them identically. This patch simply checks the RecordDecl for the correct attribute in the case where no other exception specifier was set. Differential Revision: https://reviews.llvm.org/D38209 llvm-svn: 314462
* [Sema] Warn on attribute nothrow conflicting with language specifiersErich Keane2017-09-281-1/+20
| | | | | | | | | | | | | | I discovered it was possible to create a 'nothrow' noexcept(false) function, which is both non-sensical as well as seemingly breaking. This patch warns if attribute nothrow is used with anything besides "noexcept". "noexcept(true)" isn't possible, because the noexcept decl isn't parsed until later. Differential Revision: https://reviews.llvm.org/D38205 llvm-svn: 314461
* Consolidate std::move() detection code. No behavior change.Nico Weber2017-09-283-19/+7
| | | | llvm-svn: 314427
* Look through parentheses.Akira Hatanaka2017-09-281-1/+1
| | | | | | | | | This fixes a bug where clang would emit instructions to reclaim a value that's going to be __bridge-casted to CF. rdar://problem/34687542 llvm-svn: 314370
* Add support for remembering origins to ExternalASTMergerSean Callanan2017-09-271-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ExternalASTMerger has hitherto relied on being able to look up any Decl through its named DeclContext chain. This works for many cases, but causes problems for function-local structs, which cannot be looked up in their containing FunctionDecl. An example case is void f() { { struct S { int a; }; } { struct S { bool b; }; } } It is not possible to lookup either of the two Ses individually (or even to provide enough information to disambiguate) after parsing is over; and there is typically no need to, since they are invisible to the outside world. However, ExternalASTMerger needs to be able to complete either S on demand. This led to an XFAIL on test/Import/local-struct, which this patch removes. The way the patch works is: It defines a new data structure, ExternalASTMerger::OriginMap, which clients are expected to maintain (default-constructing if the origin does not have an ExternalASTMerger servicing it) As DeclContexts are imported, if they cannot be looked up by name they are placed in the OriginMap. This allows ExternalASTMerger to complete them later if necessary. As DeclContexts are imported from an origin that already has its own OriginMap, the origins are forwarded – but only for those DeclContexts that are actually used. This keeps the amount of stored data minimal. The patch also applies several improvements from review: - Thoroughly documents the interface to ExternalASTMerger; - Adds optional logging to help track what's going on; and - Cleans up a bunch of braces and dangling elses. Differential Revision: https://reviews.llvm.org/D38208 llvm-svn: 314336
* Fix capitalization of a bunch of parameters in SemaDeclAttr [NFC]Erich Keane2017-09-271-44/+44
| | | | llvm-svn: 314267
* Emit section information for extern variables. Erich Keane2017-09-261-0/+10
| | | | | | | | | | | | | | | | | Currently, if _attribute_((section())) is used for extern variables, section information is not emitted in generated IR when the variables are used. This is expected since sections are not generated for external linkage objects. However NiosII requires this information as it uses special GP-relative accesses for any objects that use attribute section (.sdata). GCC keeps this attribute in middle-end. This change emits the section information for all targets. Patch By: Elizabeth Andrews Differential Revision:https://reviews.llvm.org/D36487 llvm-svn: 314262
* Fix uninitialized member found by msan build bot.Richard Smith2017-09-261-1/+1
| | | | llvm-svn: 314246
* Sema: rename SemaBuiltinVAStart to SemaBuiltinVAStartMicrosoftSaleem Abdulrasool2017-09-261-2/+2
| | | | | | | | | | | This function is used to perform semantic analysis on Microsoft style `__va_start`. Rename it to make this more explicit. `__va_start` is marked as `ALL_MS_LANGUAGES`, and requires Microsoft compatibility. Other GNU targets will use `__builtin_va_start` instead. NFC. Addresses post-commit review comments from David Majnemer. llvm-svn: 314241
* Resolve a defect in C++17 copy omission.Richard Smith2017-09-263-43/+133
| | | | | | | | | | | | When selecting constructors for initializing an object of type T from a single expression of class type U, also consider conversion functions of U that convert to T (rather than modeling such conversions as calling a conversion function and then calling a constructor). This approach is proposed as the resolution for the defect, and is also already implemented by GCC. llvm-svn: 314231
* [Sema] Corrected the warn-on-throw-from-noexcept behavior to include nothrowErich Keane2017-09-261-1/+1
| | | | | | | | | | Discovered that 'nothrow' (which is supposed to be an alias for noexcept) was not warning with a throw inside of it. This patch corrects the behavior previously created to add 'nothrow' to this list. Differential Revision: https://reviews.llvm.org/D38203 llvm-svn: 314229
* Sema: Windows/ARM __va_start is not const correctSaleem Abdulrasool2017-09-261-17/+27
| | | | | | | | | | The `__va_start` intrinsic for Windows ARM does not account for const correctness when performing a check. All local qualifiers are ignored when validating the invocation. This was exposed by building the swift stdlib against the Windows 10586 SDK for ARM. Simply expand out the check for the two parameters and ignore the qualifiers for the check. llvm-svn: 314226
* [OPENMP] Fix handling of implicit mapping of array sections.Alexey Bataev2017-09-261-2/+3
| | | | llvm-svn: 314220
* [OPENMP] Generate implicit map|firstprivate clauses for target-basedAlexey Bataev2017-09-261-32/+166
| | | | | | | | | | directives. If the variable is used in the target-based region but is not found in any private|mapping clause, then generate implicit firstprivate|map clauses for these implicitly mapped variables. llvm-svn: 314205
* [Sema] Null check in BuildDeclarationNameExprYi Kong2017-09-251-0/+2
| | | | | | | | | | Qualtype may point to null if we cannot infer its type yet. Fixes PR33843 Differential Revision: https://reviews.llvm.org/D38158 llvm-svn: 314124
* Don't warn about runtime behavior problems in variable initializers that weRichard Smith2017-09-231-3/+17
| | | | | | | | know are going to be constant-evaluated. Any relevant diagnostics should be produced by constant expression evaluation. llvm-svn: 314067
* Promote storage-only __fp16 vector operands to float vectors.Akira Hatanaka2017-09-231-2/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes a bug in the handling of storage-only __fp16 vectors where clang didn't promote __fp16 vector operands to float vectors. Conceptually, it performs the following transformation on the AST in CreateBuiltinBinOp and CreateBuiltinUnaryOp: (Before) typedef __fp16 half4 __attribute__ ((vector_size (8))); typedef float float4 __attribute__ ((vector_size (16))); half4 hv0, hv1, hv2, hv3; hv0 = hv1 + hv2 + hv3; (After) float4 t0 = (float4)hv1 + (float4)hv2; float4 t1 = t0 + (float4)hv3; hv0 = (half4)t1; Note that this commit fixes the bug for targets that set HalfArgsAndReturns to true (ARM and ARM64). Targets using intrinsics such as llvm.convert.to.fp16 to handle __fp16 are still broken. rdar://problem/20625184 Differential Revision: https://reviews.llvm.org/D32520 llvm-svn: 314056
* Set completion priority of destructors and operators to CCP_Unlikely.Ilya Biryukov2017-09-221-2/+13
| | | | | | | | | | | | | | | | | | | Summary: It will move destructors and operators to the end of completion list. Destructors and operators are currently very high on the completion list, as they have the same priority as member functions. However, they are clearly not something users usually choose in completion lists. Reviewers: arphaman, erikjv, bkramer, krasimir Reviewed By: arphaman Subscribers: eraman, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D38081 llvm-svn: 314019
* [clang] Fix printf fixit for objc specific typesAlexander Shaposhnikov2017-09-221-1/+1
| | | | | | | | | | | | | | | | | | For the triple thumbv7-apple-ios8.0.0 ssize_t is long and size_t is unsigned long, while NSInteger is int and NSUinteger is unsigned int. Following https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html Clang catches it and insert a cast to long, for example printf("%zd", getNSInteger()) will be replaced with printf("%zd", (long)getNSInteger()) but since the underlying type of ssize_t is long the specifier "%zd" is not getting replaced. This diff changes this behavior to enable replacing the specifier "%zd" with the correct one. Differential revision: https://reviews.llvm.org/D38159 Test plan: make check-all llvm-svn: 314011
* Give external linkage and mangling to lambdas inside inline variables and ↵Richard Smith2017-09-223-22/+30
| | | | | | | | | | | variable templates. This implements the proposed approach in https://github.com/itanium-cxx-abi/cxx-abi/issues/33 This reinstates r313827, reverted in r313856, with a fix for the 'out-of-bounds enumeration value' ubsan error in that change. llvm-svn: 313955
* Fix tracking of whether a destructor would be deleted.Richard Smith2017-09-221-1/+3
| | | | | | | | | | I've been unable to find any cases whose behavior is actually changed by this, but only because an implicitly deleted destructor also results in it being impossible to have a trivial (non-deleted) copy constructor, which the place where this really matters (choosing whether to pass a class in registers) happens to also check. llvm-svn: 313948
* Add support for attribute 'noescape'.Akira Hatanaka2017-09-225-4/+70
| | | | | | | | | | | | | | | | | | | | The attribute informs the compiler that the annotated pointer parameter of a function cannot escape and enables IRGen to attach attribute 'nocapture' to parameters that are annotated with the attribute. That is the only optimization that currently takes advantage of 'noescape', but there are other optimizations that will be added later that improves IRGen for ObjC blocks. This recommits r313722, which was reverted in r313725 because clang couldn't build compiler-rt. It failed to build because there were function declarations that were missing 'noescape'. That has been fixed in r313929. rdar://problem/19886775 Differential Revision: https://reviews.llvm.org/D32210 llvm-svn: 313945
* Suppress Wsign-conversion for enums with matching underlying typeErich Keane2017-09-211-1/+4
| | | | | | | | | | | | | | | As reported here: https://bugs.llvm.org/show_bug.cgi?id=34692 A non-defined enum with a backing type was always defaulting to being treated as a signed type. IN the case where it IS defined, the signed-ness of the actual items is used. This patch uses the underlying type's signed-ness in the non-defined case to test signed-comparision. Differential Revision: https://reviews.llvm.org/D38145 llvm-svn: 313907
* [Sema] Prevent InstantiateClass from checking unrelated exception specs.Volodymyr Sapsai2017-09-211-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Sema::InstantiateClass should check only exception specs added during class instantiation and ignore already present delayed specs. This fixes a case where we instantiate a class before parsing member initializers, check exceptions for a different class and fail to find a member initializer. Which is required for comparing exception specs for explicitly-defaulted and implicit default constructor. With the fix we are still checking exception specs but only after member initializers are present. Removing errors in crash-unparsed-exception.cpp is acceptable according to discussion in PR24000 because other compilers accept code in crash-unparsed-exception.cpp as valid. rdar://problem/34167492 Reviewers: davide, rsmith Reviewed By: rsmith Subscribers: dim, cfe-commits Differential Revision: https://reviews.llvm.org/D37881 llvm-svn: 313906
* [Sema] Fix using old initializer during switch statement transformation.Volodymyr Sapsai2017-09-211-2/+1
| | | | | | | | | | | | | | | | | | | | | It fixes a crash in CodeGen when we are trying to generate code for initializer expression created before template instantiation, like CallExpr '<dependent type>' |-UnresolvedLookupExpr '<overloaded function type>' lvalue (ADL) = 'parse' `-DeclRefExpr 'Buffer<N>' lvalue ParmVar 'buffer' 'Buffer<N>' rdar://problem/33888545 Reviewers: rsmith, ahatanak Reviewed By: ahatanak Subscribers: aemerson, kristof.beyls, cfe-commits Differential Revision: https://reviews.llvm.org/D38009 llvm-svn: 313896
* [fixup][Sema] Allow in C to define tags inside enumerations.Volodymyr Sapsai2017-09-211-1/+2
| | | | | | | | | | | | | | | | Fix for too aggressive error err_type_defined_in_enum introduced in r313386. Defining tags inside enumerations is prohibited in C++ but allowed in C. Reviewers: aaron.ballman, rnk, doug.gregor Reviewed By: rnk Subscribers: alberto_magni, cfe-commits Differential Revision: https://reviews.llvm.org/D38109 llvm-svn: 313894
OpenPOWER on IntegriCloud