summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Add a new flag, -fspell-checking-limit=<number> to control how many times ↵Nick Lewycky2014-12-161-69/+16
| | | | | | | | we'll do spell checking. Note that spell checking will change the produced AST, so we don't automatically change this value when someone sets -ferror-limit=. With this, merge test typo-correction-pt2.cpp into typo-correction.cpp. Remove Sema::UnqualifiedTyposCorrected, a cache of corrected typos. It would only cache typo corrections that didn't provide ValidateCandidate of which there were few left, and it had a bug when we had the same identifier spelled wrong twice. See the last two tests in typo-correction.cpp for cases this fires. llvm-svn: 224375
* Consider calls from implict host device functions as valid in SemaCUDA.Jacques Pienaar2014-12-162-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | In SemaCUDA all implicit functions were considered host device, this led to errors such as the following code snippet failing to compile: struct Copyable { const Copyable& operator=(const Copyable& x) { return *this; } }; struct Simple { Copyable b; }; void foo() { Simple a, b; a = b; } Above the implicit copy assignment operator was inferred as host device but there was only a host assignment copy defined which is an error in device compilation mode. Differential Revision: http://reviews.llvm.org/D6565 llvm-svn: 224358
* Renamed RefersToEnclosingLocal bitfield to RefersToCapturedVariable.Alexey Bataev2014-12-165-27/+28
| | | | | | | Bitfield RefersToEnclosingLocal of Stmt::DeclRefExprBitfields renamed to RefersToCapturedVariable to reflect latest changes introduced in commit 224323. Also renamed method Expr::refersToEnclosingLocal() to Expr::refersToCapturedVariable() and comments for constant arguments. No functional changes. llvm-svn: 224329
* [OPENMP] Bugfix for processing of global variables in OpenMP regions.Alexey Bataev2014-12-162-13/+52
| | | | | | | | Currently, if global variable is marked as a private OpenMP variable, the compiler crashes in debug version or generates incorrect code in release version. It happens because in the OpenMP region the original global variable is used instead of the generated private copy. It happens because currently globals variables are not captured in the OpenMP region. This patch adds capturing of global variables iff private copy of the global variable must be used in the OpenMP region. Differential Revision: http://reviews.llvm.org/D6259 llvm-svn: 224323
* Sema: Don't crash converting to bool from _AtomicDavid Majnemer2014-12-161-1/+1
| | | | | | | | | | | Turning our _Atomic L-value into an R-value removes its _Atomic-ness. However, we didn't update our 'FromType' which made ScalarTypeToBooleanCastKind think we were trying to pass it a non-scalar. This fixes PR21836. llvm-svn: 224322
* Improve handling of value dependent expressions in ↵Nick Lewycky2014-12-161-2/+12
| | | | | | __attribute__((enable_if)), both in the condition expression and at the call site. Fixes PR20988! llvm-svn: 224320
* Clarify the code in checkDLLAttribute()Hans Wennborg2014-12-161-7/+12
| | | | | | | | Update the comments to make it more clear what's going on, and address Richard's comments from PR21718. This doesn't fix that bug, but hopefully makes the code easier to understand. llvm-svn: 224303
* Sema: Check value dependent casts when possibleDavid Majnemer2014-12-161-4/+2
| | | | | | | | | | We know that const_cast<char *>((void)Something) is ill-formed, even if 'Something' is dependent because you can't cast from void to a pointer type. This fixes PR21845. llvm-svn: 224299
* Handle errors in lambda prototype instantiation correctlyReid Kleckner2014-12-151-2/+8
| | | | | | | | | | | | Previously we would attempt to build a TypeSourceInfo for a null type, and then we would forget to pop the function scope before returning an error. Reviewers: rsmith Differential Revision: http://reviews.llvm.org/D6665 llvm-svn: 224271
* Sema: Cleanup and improve string-plus-char checking.Daniel Marjamaki2014-12-151-4/+4
| | | | | | Patch by Anders Rönnholm llvm-svn: 224268
* Warn when attribute 'optnone' conflicts with attributes on aPaul Robinson2014-12-152-0/+55
| | | | | | different declaration of the same function. llvm-svn: 224256
* Sema: Don't diagnose string + int if the int is value dependentDavid Majnemer2014-12-151-1/+1
| | | | | | | | | | | Don't send a value dependent expression into the expression evaluator, HandleSizeof would crash. Making HandleSizeof handle dependent types would noisily warn about the operation even if everything turns out OK after instantiation. This fixes PR21848. llvm-svn: 224240
* Sema: Don't leave switch stack inconsistent when recoveringDavid Majnemer2014-12-151-1/+2
| | | | | | | | | We would exit Sema::ActOnFinishSwitchStmt early if we didn't have a body. This would leave an extra SwitchStmt on the SwitchStack. This fixes PR21841. llvm-svn: 224237
* First patch with codegen of the 'omp for' directive. It implementsAlexander Musman2014-12-151-76/+113
| | | | | | | | | | | | | | | the simplest case, which is used when no chunk_size is specified in the schedule(static) or no 'schedule' clause is specified - the iteration space is divided by the library into chunks that are approximately equal in size, and at most one chunk is distributed to each thread. In this case, we do not need an outer loop in each thread - each thread requests once which iterations range it should handle (using __kmpc_for_static_init runtime call) and then runs the inner loop on this range. Differential Revision: http://reviews.llvm.org/D5865 llvm-svn: 224233
* If a non-template constructor instantiated to X(X),John McCall2014-12-141-10/+20
| | | | | | | | | | | | | | | | | | | | | | | ignore it during overload resolution when initializing X from a value of type cv X. Previously, our rule here only ignored specializations of constructor templates. That's probably because the standard says that constructors are outright ill-formed if their first parameter is literally X and they're callable with one argument. However, Clang only enforces that prohibition against non-implicit instantiations; I'm not sure why, but it seems to be deliberate. Given that, the most sensible thing to do is to just ignore the "illegal" constructor regardless of where it came from. Also, stop ignoring such constructors silently: print a note explaining why they're being ignored. Fixes <rdar://19199836>. llvm-svn: 224205
* Sema: attribute((annotate)) must have at least one argumentDavid Majnemer2014-12-141-1/+1
| | | | | | | | | | Sema::handleAnnotateAttr expects that some basic validation is done on the given AttributeList. However, ProcessAccessDeclAttributeList called it directly. Instead, pass the list to ProcessDeclAttribute. This fixes PR21847. llvm-svn: 224204
* Parse: MS property members cannot have an in-class initializerDavid Majnemer2014-12-131-4/+5
| | | | | | | | | We would crash trying to treat a property member as a field. These shoudl be forbidden anyway, reject programs which contain them. This fixes PR21840. llvm-svn: 224193
* Sema: Constexpr functions must have return statements which have an exprDavid Majnemer2014-12-131-4/+16
| | | | | | | | | | | | | | | clang lets programmers be pretty cavalier when it comes to void return statements in functions which have non-void return types. However, we cannot be so forgiving in constexpr functions: evaluation will go off the rails very quickly. Instead, keep the return statement in the AST but mark the function as invalid. Doing so gives us nice diagnostics while making constexpr evaluation halt. This fixes PR21859. llvm-svn: 224189
* Fix two small bugs in typo correction. One assertion failure building member ↵Nick Lewycky2014-12-131-1/+2
| | | | | | | | expressions because the lookup finds a different name than the original, fixed by updating the LookupResult's name with the name of the found decl. Second is that we also diagnose delayed typo exprs in the index of an array subscript expression. The testcase shows a third bug with a FIXME in it. llvm-svn: 224183
* Implement feedback on r224172 in PR21899Reid Kleckner2014-12-131-1/+1
| | | | | | Based on suggestions from Kaelyn. llvm-svn: 224173
* Typo correction: Ignore temporary binding exprs after overload resolutionReid Kleckner2014-12-131-2/+7
| | | | | | | | Transformation of a CallExpr doesn't always result in a new CallExpr. Fixes PR21899. llvm-svn: 224172
* Implement the __builtin_call_with_static_chain GNU extension.Peter Collingbourne2014-12-121-0/+68
| | | | | | | | | | | | | | | | The extension has the following syntax: __builtin_call_with_static_chain(Call, Chain) where Call must be a function call expression and Chain must be of pointer type This extension performs a function call Call with a static chain pointer Chain passed to the callee in a designated register. This is useful for calling foreign language functions whose ABI uses static chain pointers (e.g. to implement closures). Differential Revision: http://reviews.llvm.org/D6332 llvm-svn: 224167
* [Objective-C]. This patch extends objc_bridge attribute to support ↵Fariborz Jahanian2014-12-111-0/+3
| | | | | | | | | | objc_bridge(id). This means that a pointer to the struct type to which the attribute appertains is a CF type (and therefore an Objective-C object of some type), but not of any specific class. rdar://19157264 llvm-svn: 224072
* When checking for nonnull parameter attributes, also check the ParmVarDecl ↵Aaron Ballman2014-12-112-2/+3
| | | | | | since the attribute may reside there, instead of just on the FunctionDecl. Fixes PR21668. llvm-svn: 224039
* Parse: Concatenated string literals should be verified in inline asmDavid Majnemer2014-12-111-12/+4
| | | | | | | | | | While we would correctly handle asm("foo") and reject asm(L"bar"), we weren't careful to handle cases where an ascii literal could be concatenated with a wide literal. This fixes PR21822. llvm-svn: 223992
* Diagnose attributes 'optnone' and 'minsize' on the same declaration.Paul Robinson2014-12-101-1/+13
| | | | | | | Eventually we'll diagnose them on different declarations, but let's get this part out of the way first. llvm-svn: 223985
* Revert r223980 as it had wrong commit message.Paul Robinson2014-12-101-13/+1
| | | | llvm-svn: 223984
* Rename a couple of preprocessor symbols to be more descriptive. NFC.Paul Robinson2014-12-101-1/+13
| | | | | | Review feedback from recent changes to GetSVN.cmake. llvm-svn: 223980
* Handle possible TypoExprs in member initializers.Kaelyn Takata2014-12-081-0/+5
| | | | | | | Includes a new test case since none of the existing tests were hitting this code path. llvm-svn: 223705
* Workaround attribute ordering issue with kernel only attributesMatt Arsenault2014-12-051-0/+10
| | | | | | | | | | | Placing the attribute after the kernel keyword would incorrectly reject the attribute, so use the smae workaround that other kernel only attributes use. Also add a FIXME because there are two different phrasings now for the same error, althoug amdgpu_num_[sv]gpr uses a consistent one. llvm-svn: 223490
* Use else if when checking multiple attributes.Matt Arsenault2014-12-051-4/+2
| | | | | | Only one of these can really match. llvm-svn: 223489
* Adding a FIXME to the code, based on a discussion in IRC; NFC.Aaron Ballman2014-12-041-0/+4
| | | | llvm-svn: 223403
* Add attributes for AMDGPU register limits.Matt Arsenault2014-12-041-0/+32
| | | | | | | This is a performance hint that can be applied to kernels to attempt to limit the number of used registers. llvm-svn: 223384
* CUDA host device code with two code pathsReid Kleckner2014-12-031-5/+14
| | | | | | | | | | | | | | | | | | | | | | | Summary: Allow CUDA host device functions with two code paths using __CUDA_ARCH__ to differentiate between code path being compiled. For example: __host__ __device__ void host_device_function(void) { #ifdef __CUDA_ARCH__ device_only_function(); #else host_only_function(); #endif } Patch by Jacques Pienaar. Reviewed By: rnk Differential Revision: http://reviews.llvm.org/D6457 llvm-svn: 223271
* PR21706: -Wunsequenced was missing warnings when leaving a sequenced region ↵Richard Smith2014-12-031-5/+6
| | | | | | that contained side effects. llvm-svn: 223184
* Diagnose TypoExprs in a couple of error cases in ParsePostfixExpressionSuffix.Kaelyn Takata2014-12-021-1/+1
| | | | | | | Also have CorrectDelayedTyposInExpr check that the Expr* isn't null before trying to access its members. Fixes PR21679. llvm-svn: 223162
* Perform correct lookup when '__super' is used in class with dependent base.Nikola Smiljanic2014-12-013-6/+27
| | | | llvm-svn: 223090
* [OPENMP] Additional processing of 'omp atomic write' directive.Alexey Bataev2014-11-281-12/+61
| | | | | | According to OpenMP standard, Section 2.12.6, atomic Construct, '#pragma omp atomic write' is allowed to be used only for expression statements of form 'x = expr;', where x is a lvalue expression and expr is an expression with scalar type. Patch adds checks for it. llvm-svn: 222913
* Create a new 'flag_enum' attribute.Alexis Hunt2014-11-283-77/+159
| | | | | | | | | | | This attribute serves as a hint to improve warnings about the ranges of enumerators used as flag types. It currently has no working C++ implementation due to different semantics for enums in C++. For more explanation, see the docs and testcases. Reviewed by Aaron Ballman. llvm-svn: 222906
* When checking for uninitialized values, do not confuse "std::move" with everyRichard Trieu2014-11-272-2/+4
| | | | | | other function named "move". llvm-svn: 222863
* [OpenCL] Implemented restrictions for pointer conversions specified in ↵Anastasia Stulova2014-11-262-4/+26
| | | | | | | | | | | | OpenCL v2.0. OpenCL v2.0 s6.5.5 restricts conversion of pointers to different address spaces: - the named address spaces (__global, __local, and __private) => __generic - implicitly converted; - __generic => named - with an explicit cast; - named <=> named - disallowed; - __constant <=> any other - disallowed. llvm-svn: 222834
* [OpenCL] Generic address space has been added in OpenCL v2.0.Anastasia Stulova2014-11-262-2/+5
| | | | | | | | | | To support it in the frontend, the following has been added: - generic address space type attribute; - documentation for the OpenCL address space attributes; - parsing of __generic(generic) keyword; - test code for the parser and diagnostics. llvm-svn: 222831
* [c++1z] Most of N4268 (allow constant evaluation for non-type template ↵Richard Smith2014-11-263-67/+219
| | | | | | | | | arguments). We don't yet support pointer-to-member template arguments that have undergone pointer-to-member conversions, mostly because we don't have a mangling for them yet. llvm-svn: 222807
* Ensure that any TypoExprs in the arguments to bultins with custom typeKaelyn Takata2014-11-251-2/+6
| | | | | | | | checking are handled before the custom type checking is performed. Fixes PR21669. llvm-svn: 222797
* Force the correction of delayed typos in casts in non-C++ code.Kaelyn Takata2014-11-241-0/+6
| | | | | | | Fixes PR21656, which is fallout from r222551 caused by an untested/missed code path. llvm-svn: 222694
* Fix line endingsNico Rieck2014-11-241-3/+3
| | | | llvm-svn: 222666
* Delay checking overrides for exception specifications if the overriddenRichard Smith2014-11-223-21/+22
| | | | | | specification has not yet been parsed. llvm-svn: 222603
* Objective-C ARC. Fixes a crash when checking for 'weak' propery Fariborz Jahanian2014-11-211-0/+2
| | | | | | whose base is not an expression. rdar://19053620 llvm-svn: 222570
* Sema: Don't permit variably modified types in typeidDavid Majnemer2014-11-211-0/+7
| | | | | | | | | | GCC and ICC both reject this and the 'Runtime-sized arrays with automatic storage duration' (N3639) paper forbade this as well. Previously, we would crash on our way to mangling. This fixes PR21632. llvm-svn: 222569
* Implement -Wcast-qual, fixing #13772.Roman Divacky2014-11-211-4/+40
| | | | | | Many thanks to dblaikie for his advices and suggestions! llvm-svn: 222568
OpenPOWER on IntegriCloud