summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Revert r266415, it broke parsing SDK headers (PR27367).Nico Weber2016-04-156-35/+15
| | | | llvm-svn: 266431
* Remove include duplicate. NFC.Alexey Bader2016-04-151-1/+0
| | | | llvm-svn: 266428
* [MSVC Compat] Implementation of __unaligned (MS extension) as a type qualifierAndrey Bokhanko2016-04-156-15/+35
| | | | | | | | | | | This patch implements __unaligned as a type qualifier; before that, it was modeled as an attribute. Proper mangling of __unaligned is implemented as well. Some OpenCL code/tests are tangenially affected, as they relied on existing number and sizes of type qualifiers. Differential Revision: http://reviews.llvm.org/D18596 llvm-svn: 266415
* In vector comparisons, handle scalar LHS just as we handle scalar RHSReid Kleckner2016-04-141-9/+11
| | | | | | | | | | | | Summary: Fixes PR27258 Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19123 llvm-svn: 266366
* [MSVC] Fix check for wchar_t type in case of -fno-wcharDmitry Polukhin2016-04-141-1/+2
| | | | | | | | | | | The example below should work identically with and without compiler native wchar_t support. void foo(wchar_t * t = L""); Differential Revision: http://reviews.llvm.org/D19056 llvm-svn: 266287
* ObjC kindof: order the methods in global pool relative to availability.Manman Ren2016-04-131-12/+30
| | | | | | | | | | | | | | r265877 tries to put methods that are deprecated or unavailable to the front of the global pool to emit diagnostics, but it breaks some of our existing codes that depend on choosing a certain method for id lookup. This commit orders the methods with the same declaration with respect to the availability, but do not order methods with different declaration. rdar://25707511 llvm-svn: 266264
* [SemaObjC] Properly handle mix between type arguments and protocols.Bruno Cardoso Lopes2016-04-131-5/+13
| | | | | | | | | | | | | | | | | | | | | | | Under certain conditions clang currently fails to properly diagnostic ObjectC parameter list when type args and protocols are mixed in the same list. This happens when the first item in the parameter list is a (1) protocol, (2) unknown type or (3) a list of protocols/unknown types up to the first type argument. Fix the problem to report the proper error, example: NSArray<M, NSValue *, NSURL, NSArray <id <M>>> *foo = @[@"a"]; NSNumber *bar = foo[0]; NSLog(@"%@", bar); $ clang ... x.m:7:13: error: angle brackets contain both a type ('NSValue') and a protocol ('M') NSArray<M, NSValue *, NSURL, NSArray <id <M>>> *foo = @[@"a"]; ~ ^ Differential Revision: http://reviews.llvm.org/D18997 rdar://problem/22204367 llvm-svn: 266245
* Make sure CheckDestructor gets called on dllimported classes if the vtable ↵Hans Wennborg2016-04-131-7/+14
| | | | | | is used (PR27319) llvm-svn: 266242
* AArch64: allow 64-bit access to sysregs.Tim Northover2016-04-131-1/+1
| | | | | | | | Although all the registers are actually 32-bits, I think we have to assume the high 32-bits could be RES0 (the ARM ARM is unclear). If so, reading as a 32-bit register can require extra zero extension operations. llvm-svn: 266212
* Reverting r266199; it causes build bot failures.Aaron Ballman2016-04-131-274/+272
| | | | | | | http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/3255 http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/3517 llvm-svn: 266201
* Add functions declared in ctype.h to builtin function database. All ↵Aaron Ballman2016-04-131-272/+274
| | | | | | | | functions are annotated with nothrow and pure attribute, which enables better optimization. Patch by Taewook Oh. llvm-svn: 266199
* [OPENMP 4.0] Fixed DSA analysis for taskloop directives.Alexey Bataev2016-04-131-30/+27
| | | | | | | Patch make clang to perform analysis for task-based directives also for taskloop-based directives. llvm-svn: 266198
* Enable support for __float128 in ClangNemanja Ivanovic2016-04-138-25/+107
| | | | | | | | | | | | | | | | This patch corresponds to review: http://reviews.llvm.org/D15120 It adds support for the __float128 keyword, literals and a target feature to enable it. This support is disabled by default on all targets and any target that has support for this type is free to add it. Based on feedback that I've received from target maintainers, this appears to be the right thing for most targets. I have not heard from the maintainers of X86 which I believe supports this type. I will subsequently investigate the impact of enabling this on X86. llvm-svn: 266186
* [OpenCL] Move OpenCLImageTypes.def from clangAST to clangBasic library.Alexey Bader2016-04-134-6/+6
| | | | | | | | | | Putting OpenCLImageTypes.def to clangAST library violates layering requirement: "It's not OK for a Basic/ header to include an AST/ header". This fixes the modules build. Differential revision: http://reviews.llvm.org/D18954 Reviewers: Richard Smith, Vassil Vassilev. llvm-svn: 266180
* ObjC class properties: add diagnostics for unimplemented class properties.Manman Ren2016-04-121-42/+62
| | | | | | rdar://24711047 llvm-svn: 266146
* PR19957: [OpenCL] Incorrectly accepts implicit address space conversion with ↵Yaxun Liu2016-04-121-9/+66
| | | | | | | | | | | | ternary operator. Generates addrspacecast instead of bitcast for ternary operator when necessary, and diagnose ternary operator with incompatible second and third operands. https://llvm.org/bugs/show_bug.cgi?id=19957 Differential Revision: http://reviews.llvm.org/D17412 llvm-svn: 266111
* [OPENMP 4.0] Support for 'linear' clause in 'declare simd' directive.Alexey Bataev2016-04-122-51/+213
| | | | | | | | | | The linear clause declares one or more list items to be private to a SIMD lane and to have a linear relationship with respect to the iteration space of a loop. 'linear' '(' <linear-list> [ ':' <linear-step> ] ')' When a linear-step expression is specified in a linear clause it must be either a constant integer expression or an integer-typed parameter that is specified in a uniform clause on the directive. The special this pointer can be used as if was one of the arguments to the function in any of the linear, aligned, or uniform clauses. llvm-svn: 266056
* [OPENMP 4.0] Support for 'aligned' clause in 'declare simd' directive.Alexey Bataev2016-04-122-7/+88
| | | | | | | | | The aligned clause declares that the object to which each list item points is aligned to the number of bytes expressed in the optional parameter of the aligned clause. 'aligned' '(' <argument-list> [ ':' <alignment> ] ')' The optional parameter of the aligned clause, alignment, must be a constant positive integer expression. If no optional parameter is specified, implementation-defined default alignments for SIMD instructions on the target platforms are assumed. The special this pointer can be used as if was one of the arguments to the function in any of the linear, aligned, or uniform clauses. llvm-svn: 266052
* [OPENMP 4.0] Support for 'uniform' clause in 'declare simd' directive.Alexey Bataev2016-04-122-16/+64
| | | | | | | | | OpenMP 4.0 defines clause 'uniform' in 'declare simd' directive: 'uniform' '(' <argument-list> ')' The uniform clause declares one or more arguments to have an invariant value for all concurrent invocations of the function in the execution of a single SIMD loop. The special this pointer can be used as if was one of the arguments to the function in any of the linear, aligned, or uniform clauses. llvm-svn: 266041
* Remove redundant conditions of the form (A || (!A && B)) -> (A || B)Benjamin Kramer2016-04-111-2/+1
| | | | | | Found by cppcheck! PR27286 PR27287 PR27288 PR27289 llvm-svn: 265918
* [GCC] Attribute ifunc support in clangDmitry Polukhin2016-04-112-4/+29
| | | | | | | | | | | This patch add support for GCC attribute((ifunc("resolver"))) for targets that use ELF as object file format. In general ifunc is a special kind of function alias with type @gnu_indirect_function. LLVM patch http://reviews.llvm.org/D15525 Differential Revision: http://reviews.llvm.org/D15524 llvm-svn: 265917
* ObjC kindof: check the context when inserting methods to global pool.Manman Ren2016-04-091-1/+38
| | | | | | | | | | | | | | | | To make kindof lookup work, we need to insert methods with different context into the global pool, even though they have the same siganture. Since diagnosis of availability is performed on the best candidate, which is often the first candidate from the global pool, we prioritize the methods that are unavaible or deprecated to the head of the list. Since we now have more methods in the global pool, we need to watch out for performance impact. rdar://25635831 llvm-svn: 265877
* [Concepts] Implement subsection [dcl.spec.concept]p7 of the Concepts TSNathan Wilson2016-04-092-0/+49
| | | | | | | | | | | | Summary: A program shall not declare an explicit instantiation (14.8.2), an explicit specialization (14.8.3), or a partial specialization of a concept definition. Reviewers: rsmith, hubert.reinterpretcast, faisalv, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18221 llvm-svn: 265868
* [modules] Handle merged fields in designated initializers.Richard Smith2016-04-081-3/+5
| | | | llvm-svn: 265838
* [OpenCL] Complete image types support.Alexey Bader2016-04-085-20/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I. Current implementation of images is not conformant to spec in the following points: 1. It makes no distinction with respect to access qualifiers and therefore allows to use images with different access type interchangeably. The following code would compile just fine: void write_image(write_only image2d_t img); kernel void foo(read_only image2d_t img) { write_image(img); } // Accepted code which is disallowed according to s6.13.14. 2. It discards access qualifier on generated code, which leads to generated code for the above example: call void @write_image(%opencl.image2d_t* %img); In OpenCL2.0 however we can have different calls into write_image with read_only and wite_only images. Also generally following compiler steps have no easy way to take different path depending on the image access: linking to the right implementation of image types, performing IR opts and backend codegen differently. 3. Image types are language keywords and can't be redeclared s6.1.9, which can happen currently as they are just typedef names. 4. Default access qualifier read_only is to be added if not provided explicitly. II. This patch corrects the above points as follows: 1. All images are encapsulated into a separate .def file that is inserted in different points where image handling is required. This avoid a lot of code repetition as all images are handled the same way in the code with no distinction of their exact type. 2. The Cartesian product of image types and image access qualifiers is added to the builtin types. This simplifies a lot handling of access type mismatch as no operations are allowed by default on distinct Builtin types. Also spec intended access qualifier as special type qualifier that are combined with an image type to form a distinct type (see statement above - images can't be created w/o access qualifiers). 3. Improves testing of images in Clang. Author: Anastasia Stulova Reviewers: bader, mgrang. Subscribers: pxli168, pekka.jaaskelainen, yaxunl. Differential Revision: http://reviews.llvm.org/D17821 llvm-svn: 265783
* Replace Sema-level implementation of -fassume-sane-operator-new with aRichard Smith2016-04-071-12/+3
| | | | | | | | | | | | | | CodeGen-level implementation. Instead of adding an attribute to clang's FunctionDecl, add the IR attribute directly. This means a module built with this flag is now compatible with code built without it and vice versa. This change also results in the 'noalias' attribute no longer being added to calls to operator new in the IR; it's now only added to the declaration. It also fixes a bug where we failed to add the attribute to the 'nothrow' versions (because we didn't implicitly declare them, there was no good time to inject a fake attribute). llvm-svn: 265728
* [ObjC kindof] Use type bound to filter out the candidate methods.Manman Ren2016-04-072-8/+45
| | | | | | rdar://21306753 llvm-svn: 265712
* NFC: simplify code in BuildInstanceMessage.Manman Ren2016-04-073-57/+94
| | | | | | | | | | | | | | | | Instead of searching the global pool multiple times: in LookupFactoryMethodInGlobalPool, LookupInstanceMethodInGlobalPool, CollectMultipleMethodsInGlobalPool, and AreMultipleMethodsInGlobalPool, we now collect the method candidates in CollectMultipleMethodsInGlobalPool only, and other functions will use the collected method set. This commit adds parameter "Methods" to AreMultipleMethodsInGlobalPool, and SelectBestMethod. It also changes the implementation of CollectMultipleMethodsInGlobalPool to collect the desired kind first, if none is found, to collect the other kind. This avoids the need to call both LookupFactoryMethodInGlobalPool and LookupInstanceMethodInGlobalPool. llvm-svn: 265711
* [OPENMP 4.0] Parsing/sema analysis for 'simdlen' clause in 'declare simd'Alexey Bataev2016-04-072-2/+33
| | | | | | | | | | | | construct. OpenMP 4.0 defines '#pragma omp declare simd' construct that may have associated 'simdlen' clause with constant positive expression as an argument: simdlen(<const_expr>) Patch adds parsin and semantic analysis for simdlen clause. llvm-svn: 265668
* Diagnose template alias declarations in local classes.Richard Smith2016-04-061-0/+4
| | | | | | Patch by Erik Pilkington! llvm-svn: 265571
* [OPENMP] Parsing and Sema support for 'omp declare target' directiveDmitry Polukhin2016-04-063-0/+153
| | | | | | | | | | | | | | | | | | | | Add parsing, sema analysis for 'declare target' construct for OpenMP 4.0 (4.5 support will be added in separate patch). The declare target directive specifies that variables, functions (C, C++ and Fortran), and subroutines (Fortran) are mapped to a device. The declare target directive is a declarative directive. In Clang declare target is implemented as implicit attribute for the declaration. The syntax of the declare target directive is as follows: #pragma omp declare target declarations-definition-seq #pragma omp end declare target Based on patch from Michael Wong http://reviews.llvm.org/D15321 llvm-svn: 265530
* Fix a crash on invalid with template handlingRichard Trieu2016-04-051-6/+12
| | | | | | | | This is a fix for https://llvm.org/bugs/show_bug.cgi?id=25561 which was a crash on invalid. Change the handling of invalid decls to have a catch-all case to prevent unexpecting decls from triggering an assertion. llvm-svn: 265467
* [Sema] Delete FIXME that has been fixed. NFC.George Burgess IV2016-04-041-2/+0
| | | | llvm-svn: 265341
* [OPENMP 4.0] Support for 'inbranch|noinbranch' clauses in 'declareAlexey Bataev2016-04-041-4/+4
| | | | | | | | | simd'. Added parsing/semantic analysis for 'inbranch|notinbranch' clauses of '#pragma omp declare simd' construct. llvm-svn: 265287
* [Objective-C] Introduce objc_runtime_visible attribute.Douglas Gregor2016-04-012-0/+20
| | | | | | | | | | | | | | | | | | | | The objc_runtime_visible attribute deals with an odd corner case where a particular Objective-C class is known to the Objective-C runtime (and, therefore, accessible by name) but its symbol has been hidden for some reason. For such classes, teach CodeGen to use objc_lookUpClass to retrieve the Class object, rather than referencing the class symbol directly. Classes annotated with objc_runtime_visible have two major limitations that fall out from places where Objective-C metadata needs to refer to the class (or metaclass) symbol directly: * One cannot implement a subclass of an objc_runtime_visible class. * One cannot implement a category on an objc_runtime_visible class. Implements rdar://problem/25494092. llvm-svn: 265201
* [OpenCL] Moved nosvm attribute handling in Sema to other OpenCL attrsAnastasia Stulova2016-04-011-3/+3
| | | | llvm-svn: 265146
* [OPENMP] Avoid useless recursive calls in getDSA if it is called in a loop, NFCDmitry Polukhin2016-04-011-5/+5
| | | | llvm-svn: 265123
* [OPENMP 4.5] Allow data members as loop counters in loop-basedAlexey Bataev2016-04-011-166/+229
| | | | | | | | | | directives. OpenMP 4.5 allows privatization of non-static data members in non-static member functions. Patch allows to use and implicit privatization of data members used as counters in loop-based directives. llvm-svn: 265121
* [OpenCL] Added nosvm attribute for OpenCL v2.0.Anastasia Stulova2016-03-312-1/+13
| | | | | | | | | | | | | It is not widely used and removed from OpenCL v2.1. This change modifies Clang to parse the attribute for OpenCL but ignores it afterwards. Patch by Liu Yaxun (Sam)! Differential Revision: http://reviews.llvm.org/D17861 llvm-svn: 265006
* Fix -Wdynamic-class-memaccess to skip invalid classes.Richard Trieu2016-03-311-1/+1
| | | | | | | | | This warning sometimes will infinitely recurse on CXXRecordDecl's from ill-formed recursive classes that have fields of themselves. Skip processing these classes to prevent this from happening. Fixes https://llvm.org/bugs/show_bug.cgi?id=27142 llvm-svn: 264991
* [Sema] Fix PR27122: ICE with enable_if+ill-formed call.George Burgess IV2016-03-311-1/+16
| | | | | | | | | | | | | | | | | | | | | | | In some cases, when we encounter a direct function call with an incorrect number of arguments, we'll emit a diagnostic, and pretend that the call to the function was valid. For example, in C: int foo(); int a = foo(1); Prior to this patch, we'd get an ICE if foo had an enable_if attribute, because CheckEnableIf assumes that the number of arguments it gets passed is valid for the function it's passed. Now, we check that the number of args looks valid prior to checking enable_if conditions. This fix was not done inside of CheckEnableIf because the problem presently can only occur in one caller of CheckEnableIf (ActOnCallExpr). Additionally, checking inside of CheckEnableIf would make us emit multiple diagnostics for the same error (one "enable_if failed", one "you gave this function the wrong number of arguments"), which seems worse than just complaining about the latter. llvm-svn: 264975
* Fix deduction of __atomic_load's parameter types.Eric Fiselier2016-03-301-10/+13
| | | | | | | | | | | | | | Summary: __atomic_load's allows it's first argument to be a pointer to a const type. However the second argument is an output parameter and must be a pointer to non-const. This patch fixes the signature of __atomic_load generated by clang so that it respects the above requirements. Reviewers: rsmith, majnemer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13420 llvm-svn: 264967
* [CUDA] Make unattributed constexpr functions implicitly host+device.Justin Lebar2016-03-303-3/+55
| | | | | | | | | | | | | | | | | | | | | | | | With this patch, by a constexpr function is implicitly host+device unless: a) it's a variadic function (variadic functions are not allowed on the device side), or b) it's preceeded by a __device__ overload in a system header. The restriction on overloading __host__ __device__ functions on the basis of their CUDA attributes remains in place, but we use (b) to allow us to define __device__ overloads for constexpr functions in cmath, which would otherwise be __host__ __device__ and thus not overloadable. You can disable this behavior with -fno-cuda-host-device-constexpr. Reviewers: tra, rnk, rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18380 llvm-svn: 264964
* [Sema] s/UseUsingDeclRules/UseMemberUsingDeclRules/Justin Lebar2016-03-301-3/+3
| | | | | | | | | | | | | | | Summary: IsOverload has a param named UseUsingDeclRules. But as far as I can tell, it should be called UseMemberUsingDeclRules. That is, it only applies to "using" declarations inside classes or structs. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18538 llvm-svn: 264920
* [OPENMP 4.0] Initial support for '#pragma omp declare simd' directive.Alexey Bataev2016-03-301-0/+28
| | | | | | | | | | | | | | | | Initial parsing/sema/serialization/deserialization support for '#pragma omp declare simd' directive. The 'declare simd' construct can be applied to a function to enable the creation of one or more versions that can process multiple arguments using SIMD instructions from a single invocation from a SIMD loop. If the function has any declarations, then the declare simd construct for any declaration that has one must be equivalent to the one specified for the definition. Otherwise, the result is unspecified. This pragma can be applied many times to the same declaration. Internally this pragma is represented as an attribute. But we need special processing for this pragma because it must be used before function declaration, this directive is applied to. Differential Revision: http://reviews.llvm.org/D10599 llvm-svn: 264853
* For MS ABI, emit dllexport friend functions defined inline in classStephan Bergmann2016-03-301-2/+2
| | | | | | | | | | | | | | ...as that is apparently what MSVC does. This is an updated version of r263738, which had to be reverted in r263740 due to test failures. The original version had erroneously emitted functions that are defined in class templates, too (see the updated "Handle friend functions" code in EmitDeferredDecls, lib/CodeGen/ModuleBuilder.cpp). (The updated tests needed to be split out into their own dllexport-ms-friend.cpp because of the CHECK-NOTs which would have interfered with subsequent CHECK-DAGs in dllexport.cpp.) Differential Revision: http://reviews.llvm.org/D18430 llvm-svn: 264841
* [OpenCL] Fix pipe builtin bugsXiuli Pan2016-03-301-6/+8
| | | | | | | | | | | | | | | Summary: 1. Diag should be output if types are not the same. 2. Should compare using canonical type. 3. Refine the diag to be more clear. Reviewers: yaxunl, Anastasia Subscribers: MatsPetersson, pekka.jaaskelainen, cfe-commits Differential Revision: http://reviews.llvm.org/D17955 llvm-svn: 264825
* [Sema] Handle UTF-8 invalid format string specifiersBruno Cardoso Lopes2016-03-291-6/+37
| | | | | | | | | | | | | | | | | Improve invalid format string specifier handling by printing out invalid specifiers characters with \x, \u and \U. Previously clang would print gargabe whenever the character is unprintable. Example, before: NSLog(@"%\u25B9"); => warning: invalid conversion specifier ' [-Wformat-invalid-specifier] after: NSLog(@"%\u25B9"); => warning: invalid conversion specifier '\u25b9' [-Wformat-invalid-specifier] Differential Revision: http://reviews.llvm.org/D18296 rdar://problem/24672159 llvm-svn: 264752
* [CUDA] Fix order of overloading preferences in comment.Justin Lebar2016-03-291-1/+1
| | | | llvm-svn: 264741
* [CUDA] Remove three obsolete CUDA cc1 flags.Justin Lebar2016-03-294-91/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: * -fcuda-target-overloads Previously unconditionally set to true by the driver. Necessary for correct functioning of the compiler -- our CUDA headers wrapper won't compile without this. * -fcuda-disable-target-call-checks Previously unconditionally set to true by the driver. Necessary to compile almost any external CUDA code -- almost all libraries assume that host+device code can call host or device functions. * -fcuda-allow-host-calls-from-host-device No effect when target overloading is enabled. Reviewers: tra Subscribers: rsmith, cfe-commits Differential Revision: http://reviews.llvm.org/D18416 llvm-svn: 264739
OpenPOWER on IntegriCloud