summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Disable lambda-capture of decomposition declaration bindings for now, until CWGRichard Smith2016-08-151-15/+20
| | | | | | agrees on how they're supposed to work. llvm-svn: 278648
* P0217R3: code generation support for decomposition declarations.Richard Smith2016-08-151-2/+4
| | | | llvm-svn: 278642
* Explicitly generate a reference variable to hold the initializer for aRichard Smith2016-08-141-3/+22
| | | | | | | | tuple-like decomposition declaration. This significantly simplifies the semantics of BindingDecls for AST consumers (they can now always be evalated at the point of use). llvm-svn: 278640
* Fix Wdocumentation unknown parameter warningSimon Pilgrim2016-08-121-116/+114
| | | | llvm-svn: 278503
* Fix For pr28288 - Error message in shift of vector valuesAndrey Bokhanko2016-08-121-11/+5
| | | | | | | | | | This fixes an error in type checking of shift of vector values. Patch by Vladimir Yakovlev. Differential Revision: https://reviews.llvm.org/D21678 llvm-svn: 278501
* This patch implements PR#22821.Roger Ferrer Ibanez2016-08-124-1/+79
| | | | | | | | | | | | | | | | | | Taking the address of a packed member is dangerous since the reduced alignment of the pointee is lost. This can lead to memory alignment faults in some architectures if the pointer value is dereferenced. This change adds a new warning to clang emitted when taking the address of a packed member. A packed member is either a field/data member declared as attribute((packed)) or belonging to a struct/class declared as such. The associated flag is -Waddress-of-packed-member. Conversions (either implicit or via a valid casting) to pointer types with lower or equal alignment requirements (e.g. void* or char*) will silence the warning. Differential Revision: https://reviews.llvm.org/D20561 llvm-svn: 278483
* [Sema] Fix the wording of a comment. NFC.George Burgess IV2016-08-121-1/+1
| | | | llvm-svn: 278472
* [Sema] Fix a crash on variadic enable_if functions.George Burgess IV2016-08-121-1/+5
| | | | | | | | | | | | | Currently, when trying to evaluate an enable_if condition, we try to evaluate all arguments a user passes to a function. Given that we can't use variadic arguments from said condition anyway, not converting them is a reasonable thing to do. So, this patch makes us ignore any varargs when attempting to check an enable_if condition. We'd crash because, in order to convert an argument, we need its ParmVarDecl. Variadic arguments don't have ParmVarDecls. llvm-svn: 278471
* P0217R3: template instantiation support for decomposition declarations.Richard Smith2016-08-125-27/+46
| | | | llvm-svn: 278458
* Remove unused and undesirable reference from BindingDecl to DecompositionDecl.Richard Smith2016-08-123-14/+5
| | | | llvm-svn: 278448
* P0217R3: Constant expression evaluation for decomposition declarations.Richard Smith2016-08-123-6/+16
| | | | llvm-svn: 278447
* P0217R3: Perform semantic checks and initialization for the bindings in aRichard Smith2016-08-119-223/+867
| | | | | | | decomposition declaration for arrays, aggregate-like structs, tuple-like types, and (as an extension) for complex and vector types. llvm-svn: 278435
* [Sema] Add more strict check for sizeof diagnostics for bzeroBruno Cardoso Lopes2016-08-111-0/+7
| | | | | | | | | | Follow-up from r278264 after Joerg's feedback. Since bzero is not standard, be more strict: also check if the first argument is a pointer, which harden the check for when it does not come originally from a builtin. llvm-svn: 278379
* Reapply [Sema] Add sizeof diagnostics for bzeroBruno Cardoso Lopes2016-08-101-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Reapply r277787. For memset (and others) we can get diagnostics like: struct stat { int x; }; void foo(struct stat *stamps) { bzero(stamps, sizeof(stamps)); memset(stamps, 0, sizeof(stamps)); } t.c:7:28: warning: 'memset' call operates on objects of type 'struct stat' while the size is based on a different type 'struct stat *' [-Wsizeof-pointer-memaccess] memset(stamps, 0, sizeof(stamps)); ~~~~~~ ^~~~~~ t.c:7:28: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)? memset(stamps, 0, sizeof(stamps)); ^~~~~~ This patch implements the same class of warnings for bzero. Differential Revision: https://reviews.llvm.org/D22525 rdar://problem/18963514 llvm-svn: 278264
* [CUDA] Reject calls to __device__ functions from host variable global ↵Justin Lebar2016-08-101-28/+47
| | | | | | | | | | | | initializers. Reviewers: tra Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D23335 llvm-svn: 278196
* [CUDA] Print a "previous-decl" note when calling an illegal member fn.Justin Lebar2016-08-101-0/+1
| | | | | | | | | | | | | | | Summary: When we emit err_ref_bad_target, we should emit a "'method' declared here" note. We already do so in most places, just not in BuildCallToMemberFunction. Reviewers: tra Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D23240 llvm-svn: 278195
* [CUDA] Rename CheckCUDATarget to IsAllowedCUDACall. NFCJustin Lebar2016-08-102-5/+5
| | | | | | | | | | | | | | Summary: I want to reuse "CheckCUDAFoo" in a later patch. Also, I think IsAllowedCUDACall gets the point across more clearly. Reviewers: tra Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D23238 llvm-svn: 278193
* [CUDA] Minor comment nits.Justin Lebar2016-08-101-2/+2
| | | | llvm-svn: 278183
* Revert "[Attr] Add support for the `ms_hook_prologue` attribute."Charles Davis2016-08-081-8/+11
| | | | | | | This reverts commit r278050. It depends on r278048, which will be reverted. llvm-svn: 278052
* [Attr] Add support for the `ms_hook_prologue` attribute.Charles Davis2016-08-081-11/+8
| | | | | | | | | | | | | | | | | | | | | | | Summary: Based on a patch by Michael Mueller. This attribute specifies that a function can be hooked or patched. This mechanism was originally devised by Microsoft for hotpatching their binaries (which they're constantly updating to stay ahead of crackers, script kiddies, and other ne'er-do-wells on the Internet), but it's now commonly abused by Windows programs that want to hook API functions. It is for this reason that this attribute was added to GCC--hence the name, `ms_hook_prologue`. Depends on D19908. Reviewers: rnk, aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D19909 llvm-svn: 278050
* Pass information in a record instead of stack. NFCSerge Pavlov2016-08-083-75/+62
| | | | | | | | | Functions of Sema that work with building of nested name specifiers have too many parameters (BuildCXXNestedNameSpecifier already expects 10 arguments). With this change the information about identifier and its context is packed into a structure, which is then passes to the semantic functions. llvm-svn: 277976
* [Sema] Make switch fully covered again.Benjamin Kramer2016-08-061-1/+2
| | | | llvm-svn: 277920
* Move helpers into anonymous namespaces. NFC.Benjamin Kramer2016-08-061-0/+2
| | | | llvm-svn: 277918
* [NFC] Silence noisy -Wreturn-type warningsErik Pilkington2016-08-061-1/+1
| | | | llvm-svn: 277906
* Fix two false positives in -Wreturn-stack-addressRichard Trieu2016-08-051-0/+13
| | | | | | | | | | | If the return type is a pointer and the function returns the reference to a pointer, don't warn since only the value is returned, not the reference. If a reference function parameter appears in the reference chain, don't warn since binding happens at the caller scope, so addresses returned are not to local stack. This includes default arguments as well. llvm-svn: 277889
* [NFC][ObjC Availability] Refactor DiagnoseAvailabilityOfDeclErik Pilkington2016-08-053-91/+86
| | | | | | Differential revision: https://reviews.llvm.org/D23221 llvm-svn: 277887
* Fix false positive in -Wunsequenced and templates.Richard Trieu2016-08-051-1/+2
| | | | | | | | | | | | | | For builtin logical operators, there is a well-defined ordering of argument evaluation. For overloaded operator of the same type, there is no argument evaluation order, similar to other function calls. When both are present, uninstantiated templates with an operator&& is treated as an unresolved function call. Unresolved function calls are treated as normal function calls, and may result in false positives when the builtin logical operator is used. Have the unsequenced checker ignore dependent expressions to avoid this false positive. The check also happens in template instantiations to catch when the overloaded operator is used. llvm-svn: 277866
* [SemaOpenMP] Some miscellaneous cleanupsDavid Majnemer2016-08-051-142/+139
| | | | | | | | Clean up some typos, follow the coding style a little more rigorously. No functionality change is intended. llvm-svn: 277840
* Revert "[Sema] Add sizeof diagnostics for bzero"Bruno Cardoso Lopes2016-08-051-5/+3
| | | | | | This reverts commit r277787, which caused PR28870. llvm-svn: 277830
* [OpenMP] Sema and parsing for 'teams distribute' pragmaKelvin Li2016-08-052-4/+130
| | | | | | | | This patch is to implement sema and parsing for 'teams distribute' pragma. Differential Revision: https://reviews.llvm.org/D23189 llvm-svn: 277818
* Allow -1 to assign max value to unsigned bitfields.Richard Trieu2016-08-051-0/+6
| | | | | | | | Silence the -Wbitfield-constant-conversion warning for when -1 or other negative values are assigned to unsigned bitfields, provided that the bitfield is wider than the minimum number of bits needed to encode the negative value. llvm-svn: 277796
* [Sema] Add sizeof diagnostics for bzeroBruno Cardoso Lopes2016-08-041-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | For memset (and others) we can get diagnostics like: struct stat { int x; }; void foo(struct stat *stamps) { bzero(stamps, sizeof(stamps)); memset(stamps, 0, sizeof(stamps)); } t.c:7:28: warning: 'memset' call operates on objects of type 'struct stat' while the size is based on a different type 'struct stat *' [-Wsizeof-pointer-memaccess] memset(stamps, 0, sizeof(stamps)); ~~~~~~ ^~~~~~ t.c:7:28: note: did you mean to dereference the argument to 'sizeof' (and multiply it by the number of elements)? memset(stamps, 0, sizeof(stamps)); ^~~~~~ This patch implements the same class of warnings for bzero. Differential Revision: https://reviews.llvm.org/D22525 rdar://problem/18963514 llvm-svn: 277787
* [ObjC Availability] Fix partial-availability false positive introduced in ↵Erik Pilkington2016-08-011-1/+1
| | | | | | | | | | r277058 Thanks to Nico Weber for pointing this out! Differential revision: https://reviews.llvm.org/D23024 llvm-svn: 277378
* Reapply r276069 with workaround for MSVC 2013Hubert Tong2016-07-304-7/+10
| | | | llvm-svn: 277286
* Reapply r277058: "[ObjC] Consider availability of context when emitting ↵Erik Pilkington2016-07-292-7/+36
| | | | | | availability warnings" llvm-svn: 277175
* [GCC] Support for __final specifierAndrey Bokhanko2016-07-291-0/+2
| | | | | | | | | | | | | | As reported in bug 28473, GCC supports "final" functionality in pre-C++11 code using the __final keyword. Clang currently supports the "final" keyword in accordance with the C++11 specification, however it ALSO supports it in pre-C++11 mode, with a warning. This patch adds the "__final" keyword for compatibility with GCC in GCC Keywords mode (so it is enabled with existing flags), and issues a warning on its usage (suggesting switching to the C++11 keyword). This patch also adds a regression test for the functionality described. I believe this patch has minimal impact, as it simply adds a new keyword for existing behavior. This has been validated with check-clang to avoid regressions. Patch is created in reference to revisions 276665. Patch by Erich Keane. Differential Revision: https://reviews.llvm.org/D22919 llvm-svn: 277134
* Revert "[ObjC] Consider availability of context when emitting availability ↵Erik Pilkington2016-07-282-36/+7
| | | | | | | | | | warnings" Reverting r277058, while I fugure out why it broke internal bots. This reverts commit e514ffa8b657416c6784bbe6da9f5de19365103d. llvm-svn: 277070
* [ObjC] Consider availability of context when emitting availability warningsErik Pilkington2016-07-282-7/+36
| | | | | | | | | | This means that a function marked with an availability attribute can safely refer to a declaration that is greater than the deployment target, but less then or equal to the context availability without -Wpartial-availability firing. Differential revision: https://reviews.llvm.org/D22697 llvm-svn: 277058
* [OpenCL] Generate opaque type for sampler_t and function call for the ↵Yaxun Liu2016-07-282-8/+88
| | | | | | | | | | | | | | | | initializer Currently Clang use int32 to represent sampler_t, which have been a source of issue for some backends, because in some backends sampler_t cannot be represented by int32. They have to depend on kernel argument metadata and use IPA to find the sampler arguments and global variables and transform them to target specific sampler type. This patch uses opaque pointer type opencl.sampler_t* for sampler_t. For each use of file-scope sampler variable, it generates a function call of __translate_sampler_initializer. For each initialization of function-scope sampler variable, it generates a function call of __translate_sampler_initializer. Each builtin library can implement its own __translate_sampler_initializer(). Since the real sampler type tends to be architecture dependent, allowing it to be initialized by a library function simplifies backend design. A typical implementation of __translate_sampler_initializer could be a table lookup of real sampler literal values. Since its argument is always a literal, the returned pointer is known at compile time and easily optimized to finally become some literal values directly put into image read instructions. This patch is partially based on Alexey Sotkin's work in Khronos Clang (https://github.com/KhronosGroup/SPIR/commit/3d4eec61623502fc306e8c67c9868be2b136e42b). Differential Revision: https://reviews.llvm.org/D21567 llvm-svn: 277024
* [OpenMP] Code generation for the is_device_ptr clauseSamuel Antao2016-07-281-25/+99
| | | | | | | | | | | | Summary: This patch adds support for the is_device_ptr clause. It expands SEMA to use the mappable expression logic that can only be tested with code generation in place and check conflicts with other data sharing related clauses using the mappable expressions infrastructure. Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev Subscribers: caomhin, cfe-commits Differential Revision: https://reviews.llvm.org/D22788 llvm-svn: 276978
* [OpenMP] Codegen for use_device_ptr clause.Samuel Antao2016-07-281-8/+57
| | | | | | | | | | | | Summary: This patch adds support for the use_device_ptr clause. It includes changes in SEMA that could not be tested without codegen, namely, the use of the first private logic and mappable expressions support. Reviewers: hfinkel, carlo.bertolli, arpith-jacob, kkwli0, ABataev Subscribers: caomhin, cfe-commits Differential Revision: https://reviews.llvm.org/D22691 llvm-svn: 276977
* [Sema] Teach getCurrentThisType to reconize lambda in in-class initializerErik Pilkington2016-07-271-22/+16
| | | | | | | | Fixes PR27994, a crash on valid. Differential revision: https://reviews.llvm.org/D21145 llvm-svn: 276900
* Fix unnecessary default switch warningSimon Pilgrim2016-07-271-1/+1
| | | | llvm-svn: 276889
* Implement filtering for code completion of identifiers.Vassil Vassilev2016-07-271-0/+25
| | | | | | | | Patch by Cristina Cristescu and Axel Naumann! Agreed on post commit review (D17820). llvm-svn: 276878
* [OpenMP] diagnose orphaned teams constructKelvin Li2016-07-261-6/+14
| | | | | | | | | | The OpenMP spec mandates that 'a teams construct must be contained within a target construct'. Currently, this scenario is not diagnosed. This patch is to add check for orphaned teams construct and issue an error message. Differential Revision: https://reviews.llvm.org/D22785 llvm-svn: 276726
* [Sema][ObjC] Compute the nullability of a conditional expression basedAkira Hatanaka2016-07-251-1/+1
| | | | | | | | | | | | on the nullabilities of its operands. This commit is a follow-up to r276076 and enables computeConditionalNullability to compute the merged nullability when the operands are objective-c pointers. rdar://problem/22074116 llvm-svn: 276696
* [Sema] Replace mem_fn with lambdas. NFC.George Burgess IV2016-07-242-7/+11
| | | | | | | | | I'm told that some optimizers like lambdas a lot more than mem_fn. Given that the readability difference is basically nil, and we seem to use lambdas basically everywhere else, it seems sensible to just use lambdas. llvm-svn: 276577
* [X86] Block pbroadcastq instructions on 32-bit targets instead of pbroadcastb.Craig Topper2016-07-241-3/+3
| | | | | | Thanks to Simon Pilgrim for catching the mistake. llvm-svn: 276564
* P0217R3: Parsing support and framework for AST representation of C++1zRichard Smith2016-07-225-26/+289
| | | | | | | | | | | decomposition declarations. There are a couple of things in the wording that seem strange here: decomposition declarations are permitted at namespace scope (which we partially support here) and they are permitted as the declaration in a template (which we reject). llvm-svn: 276492
* Add .rgba syntax extension to ext_vector_type typesPirama Arumuga Nainar2016-07-221-1/+29
| | | | | | | | | | | | | | | | | | Summary: This patch enables .rgba accessors to ext_vector_type types and adds tests for syntax validation and code generation. 'a' and 'b' can appear either in the point access mode or the numeric access mode (for indices 10 and 11). To disambiguate between the two usages, the accessor type is explicitly passed to relevant methods. Reviewers: rsmith Subscribers: Anastasia, bader, srhines, cfe-commits Differential Revision: http://reviews.llvm.org/D20602 llvm-svn: 276455
OpenPOWER on IntegriCloud