summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [Sema] Don't allow -Wunguarded-availability to be silenced with redeclsErik Pilkington2017-07-051-66/+31
| | | | | | Differential revision: https://reviews.llvm.org/D33816 llvm-svn: 307175
* Prevent devirtualization of calls to un-instantiated functions.Sunil Srivastava2017-06-201-0/+1
| | | | | | | | PR 27895 Differential Revision: https://reviews.llvm.org/D22057 llvm-svn: 305862
* [coroutines] Remove pass-through operator co_await; Replace it with the ↵Eric Fiselier2017-06-151-1/+7
| | | | | | | | | | | | input expression Reviewers: GorNishanov, rsmith Reviewed By: GorNishanov Differential Revision: https://reviews.llvm.org/D34216 llvm-svn: 305498
* Catch invalid bitwise operation on vector of floatsSerge Pavlov2017-06-081-10/+7
| | | | | | | | | | | | Bitwise complement applied to vector of floats described with attribute `ext_vector_type` is not diagnosed as error. Attempt to compile such construct causes assertion violation in Instruction.cpp. With this change the complement is treated similar to the case of vector type described with attribute `vector_size`. Differential Revision: https://reviews.llvm.org/D33732 llvm-svn: 304963
* Simplify.Richard Smith2017-06-081-8/+4
| | | | llvm-svn: 304960
* [Sema] Silence unused variable warning.Benjamin Kramer2017-06-071-1/+1
| | | | llvm-svn: 304892
* Improve error recovery for missing 'template' keyword in contexts where theRichard Smith2017-06-071-0/+26
| | | | | | | | | | | | | | template is valid with or without it (with different meanings). If we see "dependent.x<...", and what follows the '<' is a valid expression, we must parse the '<' as a comparison rather than a template angle bracket. When we later come to instantiate, if we find that the LHS of the '<' actually names an overload set containing function templates, produce a diagnostic suggesting that the 'template' keyword was missed rather than producing a mysterious diagnostic saying that the function must be called (and pointing at what looks to already be a function call!). llvm-svn: 304852
* Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.Galina Kistanova2017-06-031-0/+2
| | | | llvm-svn: 304651
* [OpenCL] An error shall occur if any scalar operand has greater rank than ↵Egor Churaev2017-05-301-8/+20
| | | | | | | | | | | | | | | | | | | | the type of the vector element Summary: This is the fix for patch https://reviews.llvm.org/D33353 @uweigand, could you please verify that everything will be good on SystemZ? I added triple spir-unknown-unknown. Thank you in advance! Reviewers: uweigand Reviewed By: uweigand Subscribers: yaxunl, cfe-commits, bader, Anastasia, uweigand Differential Revision: https://reviews.llvm.org/D33648 llvm-svn: 304191
* Revert "[OpenCL] An error shall occur if any scalar operand has greater rank ↵Renato Golin2017-05-261-20/+8
| | | | | | | | | | | | | than the type of the vector element" This reverts commit r303986 as it broke all ARM and AArch64 buildbots... http://lab.llvm.org:8011/builders/clang-cmake-aarch64-39vma/builds/7007 http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/6705 http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/7509 etc. llvm-svn: 303996
* [OpenCL] An error shall occur if any scalar operand has greater rank than ↵Egor Churaev2017-05-261-8/+20
| | | | | | | | | | | | | | the type of the vector element Reviewers: Anastasia Reviewed By: Anastasia Subscribers: cfe-commits, bader, yaxunl Differential Revision: https://reviews.llvm.org/D33353 llvm-svn: 303986
* Revert "Sema: allow imaginary constants via GNU extension if UDL overloads ↵Tim Northover2017-05-241-17/+8
| | | | | | | | | not present." This reverts commit r303697. It broke libc++ tests that were specifically checking incompatibility in C++14 mode. llvm-svn: 303813
* Address follow-up feedback for r303712Argyrios Kyrtzidis2017-05-241-4/+3
| | | | llvm-svn: 303789
* Warn about uses of `@available` that can't suppress theAlex Lorenz2017-05-241-0/+7
| | | | | | | | | | -Wunguarded-availability warnings rdar://32306520 Differential Revision: https://reviews.llvm.org/D33450 llvm-svn: 303761
* Enhance the 'diagnose_if' attribute so that we can apply it for ObjC methods ↵Argyrios Kyrtzidis2017-05-241-1/+12
| | | | | | | | and properties as well This is an initial commit to allow using it with constant expressions, a follow-up commit will enable full support for it in ObjC methods. llvm-svn: 303712
* Sema: allow imaginary constants via GNU extension if UDL overloads not present.Tim Northover2017-05-231-8/+17
| | | | | | | | | | | | | C++14 added user-defined literal support for complex numbers so that you can write something like "complex<double> val = 2i". However, there is an existing GNU extension supporting this syntax and interpreting the result as a _Complex type. This changes parsing so that such literals are interpreted in terms of C++14's operators if an overload is present but otherwise falls back to the original GNU extension. llvm-svn: 303694
* [Sema] Use CK_NoOp instead CK_Invalid in tryGCCVectorConvertAndSplatVitaly Buka2017-05-151-2/+2
| | | | | | | | | | | | This fix UBSAN bots after r302935. Storing non-defined values in enum is undefined behavior. Other places, where "if (ScalarCast != CK_Invalid)" is used, never get to the "if" with CK_Invalid. tryGCCVectorConvertAndSplat can get to the "if" with CK_Invalid and it looks like expected case. So we have to use something other than CK_Invalid, e.g. CK_NoOp. llvm-svn: 303121
* [Sema] Support implicit scalar to vector conversionsSimon Dardis2017-05-121-11/+228
| | | | | | | | | | | | | | | | | | This patch teaches clang to perform implicit scalar to vector conversions when one of the operands of a binary vector expression is a scalar which can be converted to the element type of the vector without truncation following GCC's implementation. If the (constant) scalar is can be casted safely, it is implicitly casted to the vector elements type and splatted to produce a vector of the same type. Contributions from: Petar Jovanovic Reviewers: bruno, vkalintiris Differential Revision: https://reviews.llvm.org/D25866 llvm-svn: 302935
* [Sema] Fix typos handling in an overloadable call.Anastasia Stulova2017-05-081-0/+3
| | | | | | | | | | | | | | | | In C typos in arguments in a call of an overloadable function lead to a failure of construction of CallExpr and following recovery does not handle created delayed typos. This causes an assertion fail in Sema::~Sema since Sema::DelayedTypos remains not empty. The patch fixes that behavior by handling a call with arguments having dependant types in the way that C++ does. Differential Revision: https://reviews.llvm.org/D31764 Patch by Dmitry Borisenkov! llvm-svn: 302435
* [ARM] Limit the diagnose when an ISR calls a regular functionWeiming Zhao2017-05-051-2/+4
| | | | | | | | | | | | | | | | Summary: When the function is compiled with soft-float or on CPU with no FPU, we don't need to diagnose for a call from an ISR to a regular function. Reviewers: jroelofs, eli.friedman Reviewed By: jroelofs Subscribers: aemerson, rengolin, javed.absar, cfe-commits Differential Revision: https://reviews.llvm.org/D32918 llvm-svn: 302274
* [Sema] Update function doc; NFCGeorge Burgess IV2017-05-021-1/+1
| | | | llvm-svn: 301970
* Use a consistent style. NFCGeorge Burgess IV2017-04-271-4/+3
| | | | llvm-svn: 301601
* Fix comment. NFCGeorge Burgess IV2017-04-261-2/+1
| | | | llvm-svn: 301486
* -Wunguarded-availability should support if (@available) checks in top-levelAlex Lorenz2017-04-261-3/+11
| | | | | | | | | | | | | blocks and lambdas Prior to this commit Clang emitted the old "partial availability" warning for expressions that referred to declarations that were not yet introduced in blocks and lambdas that were not in a function/method. This commit ensures that top-level blocks and lambdas use the new unguarded availability checks. rdar://31835952 llvm-svn: 301409
* Add support for editor placeholders to ClangAlex Lorenz2017-04-191-0/+6
| | | | | | | | | | | | | | | | | | | | | This commit teaches Clang to recognize editor placeholders that are produced when an IDE like Xcode inserts a code-completion result that includes a placeholder. Now when the lexer sees a placeholder token, it emits an 'editor placeholder in source file' error and creates an identifier token that represents the placeholder. The parser/sema can now recognize the placeholders and can suppress the diagnostics related to the placeholders. This ensures that live issues in an IDE like Xcode won't get spurious diagnostics related to placeholders. This commit also adds a new compiler option named '-fallow-editor-placeholders' that silences the 'editor placeholder in source file' error. This is useful for an IDE like Xcode as we don't want to display those errors in live issues. rdar://31581400 Differential Revision: https://reviews.llvm.org/D32081 llvm-svn: 300667
* Diagnose attempt to take address of bitfield members in anonymous structs.Richard Smith2017-04-131-1/+4
| | | | | | | | Patch by Jacob Young! Differential Revision: https://reviews.llvm.org/D27263 llvm-svn: 300264
* [Sema] Extend GetSignedVectorType to deal with non ExtVector typesSimon Dardis2017-04-061-15/+36
| | | | | | | | | | | | | This improves some error messages which would otherwise refer to ext_vector_type types in contexts where there are no such types. Factored out from D25866 at reviewer's request. Reviewers: bruno Differential Revision: https://reviews.llvm.org/D31667 llvm-svn: 299641
* [OpenCL] Extended diagnostics for atomic initializationEgor Churaev2017-04-051-1/+1
| | | | | | | | | | | | | | | | | | Summary: I saw the same changes in the following review: https://reviews.llvm.org/D17438 I don't know in that way I could determine that atomic variable was initialized by macro ATOMIC_VAR_INIT. Anyway I added check that atomic variables can be initialize only in global scope. I think that we can discuss this change. Reviewers: Anastasia, cfe-commits Reviewed By: Anastasia Subscribers: bader, yaxunl Differential Revision: https://reviews.llvm.org/D30643 llvm-svn: 299537
* [NFC, Scoped Enum] Convert Sema::ExpressionEvaluationContext into a scoped EnumFaisal Vali2017-04-011-30/+34
| | | | | | | | - also replace direct equality checks against the ConstantEvaluated enumerator with isConstantEvaluted(), in anticipation of adding finer granularity to the various ConstantEvaluated contexts and reinstating certain restrictions on where lambda expressions can occur in C++17. - update the clang tablegen backend that uses these Enumerators, and add the relevant scope where needed. llvm-svn: 299316
* Spelling mistakes in comments. NFCI. (PR27635)Simon Pilgrim2017-03-301-1/+1
| | | | llvm-svn: 299083
* [ARC][ObjC++] Use ObjC semantic rules for comparisons between a pointer andAlex Lorenz2017-03-301-1/+4
| | | | | | | | | | | | | | | | | | | | an ObjC object pointer When ARC is enabled in Objective-C++, comparisons between a pointer and Objective-C object pointer typically result in errors like this: "invalid operands to a binary expression". This error message can be quite confusing as it doesn't provide a solution to the problem, unlike the non-C++ diagnostic: "implicit conversion of Objective-C pointer type 'id' to C pointer type 'void *' requires a bridged cast" (it also provides fix-its). This commit forces comparisons between pointers and Objective-C object pointers in ARC to use the Objective-C semantic rules to ensure that a better diagnostic is reported. rdar://31103857 Differential Revision: https://reviews.llvm.org/D31177 llvm-svn: 299080
* [Objective-C] Fix "weak-unavailable" warning with -fobjc-weakBrian Kelley2017-03-291-9/+10
| | | | | | | | | | | | | | Summary: clang should produce the same errors Objective-C classes that cannot be assigned to weak pointers under both -fobjc-arc and -fobjc-weak. Check for ObjCWeak along with ObjCAutoRefCount when analyzing pointer conversions. Add an -fobjc-weak pass to the existing arc-unavailable-for-weakref test cases to verify the behavior is the same. Reviewers: rsmith, doug.gregor, rjmccall Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31006 llvm-svn: 299014
* [Objective-C] Fix "repeated use of weak" warning with -fobjc-weakBrian Kelley2017-03-291-7/+11
| | | | | | | | | | | | | | Summary: -Warc-repeated-use-of-weak should produce the same warnings with -fobjc-weak as it does with -objc-arc. Also check for ObjCWeak along with ObjCAutoRefCount when recording the use of an evaluated weak variable. Add a -fobjc-weak run to the existing arc-repeated-weak test case and adapt it slightly to work in both modes. Reviewers: rsmith, doug.gregor, jordan_rose, rjmccall Reviewed By: rjmccall Subscribers: arphaman, rjmccall, cfe-commits Differential Revision: https://reviews.llvm.org/D31005 llvm-svn: 299011
* Encapsulate FPOptions and use it consistentlyAdam Nemet2017-03-271-2/+2
| | | | | | | | | | | | | | | | | | Sema holds the current FPOptions which is adjusted by 'pragma STDC FP_CONTRACT'. This then gets propagated into expression nodes as they are built. This encapsulates FPOptions so that this propagation happens opaquely rather than directly with the fp_contractable on/off bit. This allows controlled transitioning of fp_contractable to a ternary value (off, on, fast). It will also allow adding more fast-math flags later. This is toward moving fp-contraction=fast from an LLVM TargetOption to a FastMathFlag in order to fix PR25721. Differential Revision: https://reviews.llvm.org/D31166 llvm-svn: 298877
* Fix crash with interrupt attribute on ARM.Eli Friedman2017-03-141-1/+1
| | | | | | An indirect call has no associated function declaration. llvm-svn: 297694
* [OpenCL] Fix type compatibility check and generic AS mangling.Anastasia Stulova2017-03-101-63/+84
| | | | | | | | | | | | | | | | | | | | 1. Reimplemented conditional operator so that it checks compatibility of unqualified pointees of the 2nd and the 3rd operands (C99, OpenCL v2.0 6.5.15). Define QualTypes compatibility for OpenCL as following: - corresponding types are compatible (C99 6.7.3) - CVR-qualifiers are equal (C99 6.7.3) - address spaces are equal (implementation defined) 2. Added generic address space to Itanium mangling. Review: D30037 Patch by Dmitry Borisenkov! llvm-svn: 297468
* [Sema] Add variable captured by a block to the enclosing lambda'sAkira Hatanaka2017-03-011-2/+3
| | | | | | | | | | | | | | | potential capture list. Fix Sema::getCurLambda() to return the innermost lambda scope when there is a block enclosed in the lambda. Previously, the method would return a nullptr in such cases, which would prevent a variable captured by the enclosed block to be added to the lambda scope's potential capture list. rdar://problem/28412462 Differential Revision: https://reviews.llvm.org/D25556 llvm-svn: 296584
* Rename ActiveTemplateInstantiation to CodeSynthesisContext in preparation forRichard Smith2017-02-231-4/+5
| | | | | | | using it for other kinds of context (where we currently produce context notes in a highly ad-hoc manner). llvm-svn: 295919
* Factor out function to determine whether we're performing a templateRichard Smith2017-02-211-8/+7
| | | | | | | | | instantiation. In preparation for converting the template stack to a more general context stack (so we can include context notes for other kinds of context). llvm-svn: 295686
* Add an explicit derived class of FunctionDecl to model deduction guides ratherRichard Smith2017-02-171-0/+3
| | | | | | | | than just treating them as FunctionDecls with a funny name. No functionality change intended. llvm-svn: 295491
* Use correct fix-it location for -Wblock-capture-autoreleasingAlex Lorenz2017-02-161-2/+24
| | | | | | | | | The '__autoreleasing' keyword should be inserted after the Objective-C pointer type. rdar://30123548 llvm-svn: 295381
* [OpenCL] Disallow blocks capture other blocks (v2.0, s6.12.5)Anastasia Stulova2017-02-161-0/+7
| | | | llvm-svn: 295307
* [c++1z] Diagnose attempts to use variables with deduced class templateRichard Smith2017-02-101-3/+1
| | | | | | specialization types from within their own initializers. llvm-svn: 294796
* [OpenCL] Accept logical NOT for pointer types in CL1.1Anastasia Stulova2017-02-071-1/+1
| | | | | | | | | Fix for bug 30217 - incorrect error given for logical NOT operation with a pointer type: corrected sema check and improved related tests. Review: D29038 llvm-svn: 294313
* Change how we handle diagnose_if attributes.George Burgess IV2017-01-281-18/+1
| | | | | | | | | | | | | This patch changes how we handle argument-dependent `diagnose_if` attributes. In particular, we now check them in the same place that we check for things like passing NULL to Nonnull args, etc. This is basically better in every way than how we were handling them before. :) This fixes PR31638, PR31639, and PR31640. Differential Revision: https://reviews.llvm.org/D28889 llvm-svn: 293360
* [OpenCL] Add missing address spaces in IR generation of blocksAnastasia Stulova2017-01-271-3/+20
| | | | | | | | | | | | | | | | | | | | | | | | Modify ObjC blocks impl wrt address spaces as follows: - keep default private address space for blocks generated as local variables (with captures); - add global address space for global block literals (no captures); - make the block invoke function and enqueue_kernel prototype with the generic AS block pointer parameter to accommodate both private and global AS cases from above; - add block handling into default AS because it's implemented as a special pointer type (BlockPointer) in the frontend and therefore it is used as a pointer everywhere. This is also needed to accommodate both private and global AS blocks for the two cases above. - removes ObjC RT specific symbols (NSConcreteStackBlock and NSConcreteGlobalBlock) in the OpenCL mode. Review: https://reviews.llvm.org/D28814 llvm-svn: 293286
* PR0091R3: Implement parsing support for using templates as types.Richard Smith2017-01-261-1/+2
| | | | | | | | | | | | | | | This change adds a new type node, DeducedTemplateSpecializationType, to represent a type template name that has been used as a type. This is modeled around AutoType, and shares a common base class for representing a deduced placeholder type. We allow deduced class template types in a few more places than the standard does: in conditions and for-range-declarators, and in new-type-ids. This is consistent with GCC and with discussion on the core reflector. This patch does not yet support deduced class template types being named in typename specifiers. llvm-svn: 293207
* [Sema][ObjC] Make sure -Wblock-capture-autoreleasing issues a warningAkira Hatanaka2017-01-261-3/+20
| | | | | | | | | | | | | | | even in the presence of nullability qualifiers. This commit fixes bugs in r285031 where -Wblock-capture-autoreleasing wouldn't issue warnings when the function parameters were annotated with nullability qualifiers. Specifically, look through the sugar and see if there is an AttributedType of kind attr_objc_ownership to determine whether __autoreleasing was explicitly specified or implicitly added by the compiler. rdar://problem/30193488 llvm-svn: 293194
* [Sema] Fix PR28181 by avoiding calling BuildOverloadedBinOp in C modeAlex Lorenz2017-01-191-6/+5
| | | | | | | | rdar://28532840 Differential Revision: https://reviews.llvm.org/D25213 llvm-svn: 292497
* Warn when calling a non interrupt function from an interrupt on ARMJonathan Roelofs2017-01-181-0/+9
| | | | | | | | | | The idea for this originated from a really tricky bug: ISRs on ARM don't automatically save off the VFP regs, so if say, memcpy gets interrupted and the ISR itself calls memcpy, the regs are left clobbered when the ISR is done. https://reviews.llvm.org/D28820 llvm-svn: 292375
OpenPOWER on IntegriCloud