summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* SemaDeclObjC.cpp: Escape '@' in the comment. [-Wdocumentation]NAKAMURA Takumi2015-06-201-1/+1
| | | | llvm-svn: 240209
* [modules] When determining whether a definition of a class is visible, check ↵Richard Smith2015-06-201-3/+11
| | | | | | all modules even if we've already found a definition that's not visible. llvm-svn: 240204
* Suppress bogus gcc -Wreturn-type warnings.Nico Weber2015-06-201-0/+1
| | | | llvm-svn: 240199
* Yet another MSVC-related fix.Douglas Gregor2015-06-191-1/+1
| | | | llvm-svn: 240196
* Try to fix the MSVC buildDouglas Gregor2015-06-191-1/+1
| | | | llvm-svn: 240190
* Make -Wnullability-completeness work with -Wsystem-headers.Douglas Gregor2015-06-191-2/+5
| | | | | | rdar://problem/21134250 llvm-svn: 240187
* CF_RETURNS_[NOT_]RETAINED on a param makes the inner pointer __nullable.Douglas Gregor2015-06-191-3/+39
| | | | | | | | | | | | | | That is, void cf2(CFTypeRef * __nullable p CF_RETURNS_NOT_RETAINED); is equivalent to void cf2(CFTypeRef __nullable * __nullable p CF_RETURNS_NOT_RETAINED); More rdar://problem/18742441 llvm-svn: 240186
* Allow the cf_returns_[not_]retained attributes to appear on out-parameters.Douglas Gregor2015-06-191-5/+43
| | | | | | | | | | | | | | | | Includes a simple static analyzer check and not much else, but we'll also be able to take advantage of this in Swift. This feature can be tested for using __has_feature(cf_returns_on_parameters). This commit also contains two fixes: - Look through non-typedef sugar when deciding whether something is a CF type. - When (cf|ns)_returns(_not)?_retained is applied to invalid properties, refer to "property" instead of "method" in the error message. rdar://problem/18742441 llvm-svn: 240185
* Fix a use of err_nullability_conflicting that's triggering an assertion.Douglas Gregor2015-06-191-1/+2
| | | | llvm-svn: 240171
* Code completion for nullability type specifiers.Douglas Gregor2015-06-191-13/+58
| | | | | | Another part of rdar://problem/18868820. llvm-svn: 240159
* Check for consistent use of nullability type specifiers in a header.Douglas Gregor2015-06-191-8/+121
| | | | | | | | | | | | | | | | | Adds a new warning (under -Wnullability-completeness) that complains about pointer, block pointer, or member pointer declarations that have not been annotated with nullability information (directly or inferred) within a header that contains some nullability annotations. This is intended to be used to help maintain the completeness of nullability information within a header that has already been audited. Note that, for performance reasons, this warning will underrepresent the number of non-annotated pointers in the case where more than one pointer is seen before the first nullability type specifier, because we're only tracking one piece of information per header. Part of rdar://problem/18868820. llvm-svn: 240158
* Introduced pragmas for audited nullability regions.Douglas Gregor2015-06-193-27/+405
| | | | | | | | | | | | | | | | | Introduce the clang pragmas "assume_nonnull begin" and "assume_nonnull end" in which we make default assumptions about the nullability of many unannotated pointers: - Single-level pointers are inferred to __nonnull - NSError** in a (function or method) parameter list is inferred to NSError * __nullable * __nullable. - CFErrorRef * in a (function or method) parameter list is inferred to CFErrorRef __nullable * __nullable. - Other multi-level pointers are never inferred to anything. Implements rdar://problem/19191042. llvm-svn: 240156
* Implement the 'null_resettable' attribute for Objective-C properties.Douglas Gregor2015-06-192-2/+63
| | | | | | | | 'null_resettable' properties are those whose getters return nonnull but whose setters take nil, to "reset" the property to some default. Implements rdar://problem/19051334. llvm-svn: 240155
* Extend type nullability qualifiers for Objective-C.Douglas Gregor2015-06-196-110/+365
| | | | | | | | | | | | | | | Introduce context-sensitive, non-underscored nullability specifiers (nonnull, nullable, null_unspecified) for Objective-C method return types, method parameter types, and properties. Introduce Objective-C-specific semantics, including computation of the nullability of the result of a message send, merging of nullability information from the @interface of a class into its @implementation, etc . This is the Objective-C part of rdar://problem/18868820. llvm-svn: 240154
* Diagnose unsafe uses of nil and __nonnull pointers.Douglas Gregor2015-06-193-56/+138
| | | | | | | | | | | | | | | | | | | This generalizes the checking of null arguments to also work with values of pointer-to-function, reference-to-function, and block pointer type, using the nullability information within the underling function prototype to extend non-null checking, and diagnoses returns of 'nil' within a function with a __nonnull return type. Note that we don't warn about nil returns from Objective-C methods, because it's common for Objective-C methods to mimic the nil-swallowing behavior of the receiver by checking ostensibly non-null parameters and returning nil from otherwise non-null methods in that case. It also diagnoses (via a separate flag) conversions from nullable to nonnull pointers. It's a separate flag because this warning can be noisy. llvm-svn: 240153
* Introduce type nullability specifiers for C/C++.Douglas Gregor2015-06-193-13/+293
| | | | | | | | | | | | | | | | | | | | | | | | | Introduces the type specifiers __nonnull, __nullable, and __null_unspecified that describe the nullability of the pointer type to which the specifier appertains. Nullability type specifiers improve on the existing nonnull attributes in a few ways: - They apply to types, so one can represent a pointer to a non-null pointer, use them in function pointer types, etc. - As type specifiers, they are syntactically more lightweight than __attribute__s or [[attribute]]s. - They can express both the notion of 'should never be null' and also 'it makes sense for this to be null', and therefore can more easily catch errors of omission where one forgot to annotate the nullability of a particular pointer (this will come in a subsequent patch). Nullability type specifiers are maintained as type sugar, and therefore have no effect on mangling, encoding, overloading, etc. Nonetheless, they will be used for warnings about, e.g., passing 'null' to a method that does not accept it. This is the C/C++ part of rdar://problem/18868820. llvm-svn: 240146
* [ATTRIBUTE] Support base vector types of __attribute__((mode)), patch by ↵Alexey Bataev2015-06-191-10/+35
| | | | | | | | | | | | Alexey Frolov Base type of attribute((mode)) can actually be a vector type. The patch is to distinguish between base type and base element type. This fixes http://llvm.org/PR17453. Differential Revision: http://reviews.llvm.org/D10058 llvm-svn: 240125
* Fix "the the" in comments/documentation/etc.Eric Christopher2015-06-191-1/+1
| | | | llvm-svn: 240110
* Wrap to 80 columns, no behavior change.Nico Weber2015-06-181-4/+4
| | | | llvm-svn: 240041
* [OPENMP] Support for '#pragma omp taskgroup' directive.Alexey Bataev2015-06-182-0/+51
| | | | | | | | | | | | | Added parsing, sema analysis and codegen for '#pragma omp taskgroup' directive (OpenMP 4.0). The code for directive is generated the following way: #pragma omp taskgroup <body> void __kmpc_taskgroup(<loc>, thread_id); <body> void __kmpc_end_taskgroup(<loc>, thread_id); llvm-svn: 240011
* [clang] Refactoring of conditions so they use isOneOf() instead of multiple ↵Daniel Marjamaki2015-06-181-1/+1
| | | | | | is(). llvm-svn: 240008
* [OPENMP] Add support for 'omp parallel for' directive.Alexey Bataev2015-06-181-0/+10
| | | | | | Codegen for this directive is a combined codegen for 'omp parallel' region with 'omp for simd' region inside. Clauses are supported. llvm-svn: 240006
* [OPENMP] Add support for 'omp for simd' directive.Alexey Bataev2015-06-181-0/+10
| | | | | | Added codegen for combined 'omp for simd' directives, that is a combination of 'omp for' directive followed by 'omp simd' directive. Includes support for all clauses. llvm-svn: 239990
* [modules] Ensure that if we merge the definitions of two enumerations, thatRichard Smith2015-06-171-1/+0
| | | | | | making either of them visible makes the merged definition visible. llvm-svn: 239969
* [modules] If we merge a template, also track that its parameters are merged soRichard Smith2015-06-171-4/+12
| | | | | | that we know when its default arguments should be visible. llvm-svn: 239936
* [modules] Improve diagnostic for a template-id that's invalid because a defaultRichard Smith2015-06-172-20/+85
| | | | | | argument is not visible. llvm-svn: 239934
* [modules] Fix merging of default template arguments onto friend templates.Richard Smith2015-06-161-3/+3
| | | | | | | | | Previously we'd complain about redefinition of default arguments when we instantiated a class with a friend template that inherits its default argument, because we propagate the default template arguemnt onto the friend when we reload the AST. llvm-svn: 239857
* [OPENMP] Remove last iteration separation for loop-based constructs.Alexey Bataev2015-06-161-4/+0
| | | | | | Previously the last iteration for simd loop-based OpenMP constructs were generated as a separate code. This feature is not required and codegen is simplified. llvm-svn: 239810
* [modules] Better support for redefinitions of an entity from the same module.Richard Smith2015-06-152-31/+48
| | | | | | | Support this across module save/reload and extend the 'missing import' diagnostics with a list of providing modules. llvm-svn: 239750
* This patch implements clang support for the ACLE special register intrinsicsLuke Cheeseman2015-06-151-0/+121
| | | | | | | | | | | | | in section 10.1, __arm_{w,r}sr{,p,64}. This includes arm_acle.h definitions with builtins and codegen to support these, the intrinsics are implemented by generating read/write_register calls which get appropriately lowered in the backend based on the register string provided. SemaChecking is also implemented to fault invalid parameters. Differential Revision: http://reviews.llvm.org/D9697 llvm-svn: 239737
* [ms] Don't try to delay lookup for failures in SFINAE context (PR23823)Hans Wennborg2015-06-121-1/+2
| | | | | | | | | | | | | The underlying problem in PR23823 already existed before my recent change in r239558, but that change made it worse (failing not only for undeclared symbols, but also failed overload resolution). This makes Clang not try to delay the lookup in SFINAE context. I assume no current code is relying on SFINAE working with lookups that need to be delayed, because that never seems to have worked. Differential Revision: http://reviews.llvm.org/D10417 llvm-svn: 239639
* [MS ABI] Lock-in the derived memptr rep. for base-to-derived conversionsDavid Majnemer2015-06-121-4/+4
| | | | | | | | | We would get this right in the case where an explicit cast was formed but not when we were performing an implicit conversion. This fixes PR23828. llvm-svn: 239625
* push_back() loop -> append() for random access iterators.Benjamin Kramer2015-06-121-5/+1
| | | | | | | append will resize the vector to the optimal size. No functional change intended. llvm-svn: 239607
* Add a warning for unsupported elements of the target attribute.Eric Christopher2015-06-121-3/+11
| | | | | | | | | Since we're ignoring the tune= and fpmath= attributes go ahead and add a warning alerting people to the fact that we're going to ignore that part of it during code generation and tie it to the attribute warning set. llvm-svn: 239583
* Add support for the the target attribute.Eric Christopher2015-06-121-0/+17
| | | | | | | | | | | | | | | Modeled after the gcc attribute of the same name, this feature allows source level annotations to correspond to backend code generation. In llvm particular parlance, this allows the adding of subtarget features and changing the cpu for a particular function based on source level hints. This has been added into the existing support for function level attributes without particular verification for any target outside of whether or not the backend will support the features/cpu given (similar to section, etc). llvm-svn: 239579
* [modules] Apply name visibility rules to names found by ADL.Richard Smith2015-06-121-0/+3
| | | | llvm-svn: 239578
* Add assume_safety option for pragma loop vectorize and interleave.Tyler Nowicki2015-06-111-1/+3
| | | | | | | | Specifying #pragma clang loop vectorize(assume_safety) on a loop adds the mem.parallel_loop_access metadata to each load/store operation in the loop. This metadata tells loop access analysis (LAA) to skip memory dependency checking. llvm-svn: 239572
* [modules] Fix assert/crash when parsing and merging a definition of a class ↵Richard Smith2015-06-111-0/+16
| | | | | | with a base-specifier inside a namespace. llvm-svn: 239569
* [ms] Do lookup in dependent base classes also when overload resolution fails ↵Hans Wennborg2015-06-111-22/+28
| | | | | | | | | | | | | | | | | | | (PR23810) This patch does two things in order to enable compilation of the problematic code in PR23810: 1. In Sema::buildOverloadedCallSet, it postpones lookup for MS mode when no viable candidate is found in the overload set. Previously, lookup would only be postponed here if the overload set was empty. 2. Make BuildRecoveryCallExpr call Sema::DiagnoseEmptyLookup under more circumstances. There is a comment in DiagnoseTwoPhaseLookup that says "Don't diagnose names we find in classes; we get much better diagnostics for these from DiagnoseEmptyLookup." The problem was that DiagnoseEmptyLookup might not get called later, and we failed to recover. Differential Revision: http://reviews.llvm.org/D10369 llvm-svn: 239558
* [modules] Fix a few places where merging wasn't performed if modules was ↵Richard Smith2015-06-112-4/+5
| | | | | | disabled but local module visibilty was enabled. llvm-svn: 239504
* [MS Compatibility] Handle cleanups we create for a ctor closureDavid Majnemer2015-06-111-0/+1
| | | | | | This fixes PR23801. llvm-svn: 239503
* [modules] Don't allow use of non-visible (inherited) default template arguments.Richard Smith2015-06-101-6/+6
| | | | llvm-svn: 239487
* [modules] Track all default template arguments for a given parameter acrossRichard Smith2015-06-102-12/+31
| | | | | | | modules, and allow use of a default template argument if any of the parameters providing it is visible. llvm-svn: 239485
* Do not parse members of incomplete class.Serge Pavlov2015-06-101-2/+4
| | | | | | | | | | If definition of a class is unknown and out-of-line definition of its member is encountered, do not parse the member declaration. This change fixes PR18542. Differential Revision: http://reviews.llvm.org/D8010 llvm-svn: 239483
* add ConstEvaluatedExprVisitorScott Douglass2015-06-102-9/+9
| | | | | | Differential Revision: http://reviews.llvm.org/D10210 llvm-svn: 239474
* PR5172: Fix for a bug in pragma redefine_extname implementation:Alexander Musman2015-06-101-9/+15
| | | | | | | | | | | it doesn't work correctly when a structure is declared before pragma and then a function with the same name declared after pragma. Patch by Andrey Bokhanko Differential Revision: http://reviews.llvm.org/D10187 llvm-svn: 239466
* Refactor storage of default template arguments.Richard Smith2015-06-102-20/+10
| | | | | | | This is just a preparatory step towards fixing visibility for default template arguments in modules builds. llvm-svn: 239447
* Implementing C99 partial re-initialization behavior (DR-253)Yunzhong Gao2015-06-103-38/+215
| | | | | | | | | | | | | | | | | | | | | | | | | Based on previous discussion on the mailing list, clang currently lacks support for C99 partial re-initialization behavior: Reference: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-April/029188.html Reference: http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_253.htm This patch attempts to fix this problem. Given the following code snippet, struct P1 { char x[6]; }; struct LP1 { struct P1 p1; }; struct LP1 l = { .p1 = { "foo" }, .p1.x[2] = 'x' }; // this example is adapted from the example for "struct fred x[]" in DR-253; // currently clang produces in l: { "\0\0x" }, // whereas gcc 4.8 produces { "fox" }; // with this fix, clang will also produce: { "fox" }; Differential Review: http://reviews.llvm.org/D5789 llvm-svn: 239446
* Revert "Re-land r236052, "[SEH] Add 32-bit lowering code for __try""Reid Kleckner2015-06-091-5/+0
| | | | | | | This reverts commit r239415. This was committed accidentally, LLVM isn't ready for this. llvm-svn: 239417
* Re-land r236052, "[SEH] Add 32-bit lowering code for __try"Reid Kleckner2015-06-091-0/+5
| | | | | | | | This reverts r236167. LLVM should be ready for this now. llvm-svn: 239415
OpenPOWER on IntegriCloud