summaryrefslogtreecommitdiffstats
path: root/lib/Sema/SemaPseudoObject.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Replace a use of std::for_each() with llvm::for_each(); NFC.Aaron Ballman2017-11-031-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317359 91177308-0d34-0410-b5e6-96231b3b80d8
* [ObjC] Check that a subscript methods is declared for a qualified id typeAlex Lorenz2017-07-111-7/+2
| | | | | | | | | | | | | Objective-C subscript expressions report errors when a subscript method is not declared in the base class. However, prior to this commit, qualified id types were not checked. This commit ensures that an appropriate error is reported when a subscript method is not declared in any of the protocols that are included in the qualified id type. rdar://33213924 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307642 91177308-0d34-0410-b5e6-96231b3b80d8
* [Objective-C] Fix "weak-unavailable" warning with -fobjc-weakBrian Kelley2017-03-291-2/+2
| | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299014 91177308-0d34-0410-b5e6-96231b3b80d8
* [Objective-C] Fix "repeated use of weak" warning with -fobjc-weakBrian Kelley2017-03-291-9/+7
| | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299011 91177308-0d34-0410-b5e6-96231b3b80d8
* Encapsulate FPOptions and use it consistentlyAdam Nemet2017-03-271-5/+8
| | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298877 91177308-0d34-0410-b5e6-96231b3b80d8
* More diagnostic name fixups: w_ -> warn_, warning_ -> warn_, not_ -> note_.Richard Smith2016-12-021-2/+3
| | | | | | | In passing, add a warning group for "ignored qualifier in inline assembly" warnings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288548 91177308-0d34-0410-b5e6-96231b3b80d8
* Mass-rename the handful of error_* diagnostics to err_*.Richard Smith2016-12-021-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@288545 91177308-0d34-0410-b5e6-96231b3b80d8
* PR25890: Fix incoherent error handling in PerformImplicitConversion andRichard Smith2016-10-061-1/+2
| | | | | | | | | | | | | CheckSingleAssignmentConstraints. These no longer produce ExprError() when they have not emitted an error, and reliably inform the caller when they *have* emitted an error. This fixes some serious issues where we would fail to emit any diagnostic for invalid code and then attempt to emit code for an invalid AST, and conversely some issues where we would emit two diagnostics for the same problem. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283508 91177308-0d34-0410-b5e6-96231b3b80d8
* arc-repeated-use-of-weak should not warn about IBOutlet propertiesBob Wilson2016-05-251-1/+1
| | | | | | | | | | | | | | Revision r211132 was supposed to disable -Warc-repeated-use-of-weak for Objective-C properties marked with the IBOutlet attribute. Those properties are supposed to be weak but they are only accessed from the main thread so there is no risk of asynchronous updates setting them to nil. That combination makes -Warc-repeated-use-of-weak very noisy. The previous change only handled one kind of access to weak IBOutlet properties. Instead of trying to add checks for all the different kinds of property accesses, this patch removes the previous special case check and adds a check at the point where the diagnostic is reported. rdar://21366461 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270665 91177308-0d34-0410-b5e6-96231b3b80d8
* Class Property: class property and instance property can have the same name.Manman Ren2016-01-281-1/+2
| | | | | | | | | | | | | | | | | | | | Add "enum ObjCPropertyQueryKind" to a few APIs that used to only take the name of the property: ObjCPropertyDecl::findPropertyDecl, ObjCContainerDecl::FindPropertyDeclaration, ObjCInterfaceDecl::FindPropertyVisibleInPrimaryClass, ObjCImplDecl::FindPropertyImplDecl, and Sema::ActOnPropertyImplDecl. ObjCPropertyQueryKind currently has 3 values: OBJC_PR_query_unknown, OBJC_PR_query_instance, OBJC_PR_query_class This extra parameter specifies that we are looking for an instance property with the given name, or a class property with the given name, or any property with the given name (if both exist, the instance property will be returned). rdar://23891898 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259070 91177308-0d34-0410-b5e6-96231b3b80d8
* [MSVC] Fix for http://llvm.org/PR25636: indexed accessor property not ↵Alexey Bataev2015-12-101-3/+26
| | | | | | | | | | supported correctly. All problems described in http://llvm.org/PR25636 are implemented except for return value of the 'put' property. This patch fixes this problem with the indexed properties Differential Revision: http://reviews.llvm.org/D15174 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@255218 91177308-0d34-0410-b5e6-96231b3b80d8
* [MSVC] 'property' with an empty array in array subscript expression.Alexey Bataev2015-11-251-110/+132
| | | | | | | | | | | | | MSVC supports 'property' attribute and allows to apply it to the declaration of an empty array in a class or structure definition. For example: ``` __declspec(property(get=GetX, put=PutX)) int x[]; ``` The above statement indicates that x[] can be used with one or more array indices. In this case, i=p->x[a][b] will be turned into i=p->GetX(a, b), and p->x[a][b] = i will be turned into p->PutX(a, b, i); Differential Revision: http://reviews.llvm.org/D13336 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254067 91177308-0d34-0410-b5e6-96231b3b80d8
* Roll-back r250822.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250827 91177308-0d34-0410-b5e6-96231b3b80d8
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-201-1/+1
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250822 91177308-0d34-0410-b5e6-96231b3b80d8
* [MSVC] Fix for http://llvm.org/PR24132: __declspec(property): double ↵Alexey Bataev2015-10-141-11/+12
| | | | | | | | | | invocations of foo() when compiling foo()->propertyName Removes extra codegen for base expression of MS property call Differential Revision: http://reviews.llvm.org/D13375 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@250265 91177308-0d34-0410-b5e6-96231b3b80d8
* When building a pseudo-object assignment, and the RHS isJohn McCall2015-08-221-17/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | a contextually-typed expression that semantic analysis will probably need to invasively rewrite, don't include the RHS OVE as a separate semantic expression, and check the operation with the original RHS expression. There are two contextually-typed expressions that can survive to here: overloaded function references, which are at least safe to double-emit, and C++11 initializer list expressions, which are not at all safe to double-emit and which often don't update the original syntactic InitListExpr with implicit conversions to member types, etc. This means that the original RHS may appear, undecorated by an OVE, in the semantic expressions. Fortunately, it will only ever be used in a single place there, and I don't believe there are clients that rely on being able to pick out the original RHS from the semantic expressions. But this could be problematic if there are clients that do visit the entire tree and rely on not seeing the same expression multiple times, once in the syntactic and once in the semantic expressions. This is a very fiddly part of the compiler. rdar://21801088 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@245771 91177308-0d34-0410-b5e6-96231b3b80d8
* Substitute type arguments into uses of Objective-C interface members.Douglas Gregor2015-07-071-26/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When messaging a method that was defined in an Objective-C class (or category or extension thereof) that has type parameters, substitute the type arguments for those type parameters. Similarly, substitute into property accesses, instance variables, and other references. This includes general infrastructure for substituting the type arguments associated with an ObjCObject(Pointer)Type into a type referenced within a particular context, handling all of the substitutions required to deal with (e.g.) inheritance involving parameterized classes. In cases where no type arguments are available (e.g., because we're messaging via some unspecialized type, id, etc.), we substitute in the type bounds for the type parameters instead. Example: @interface NSSet<T : id<NSCopying>> : NSObject <NSCopying> - (T)firstObject; @end void f(NSSet<NSString *> *stringSet, NSSet *anySet) { [stringSet firstObject]; // produces NSString* [anySet firstObject]; // produces id<NSCopying> (the bound) } When substituting for the type parameters given an unspecialized context (i.e., no specific type arguments were given), substituting the type bounds unconditionally produces type signatures that are too strong compared to the pre-generics signatures. Instead, use the following rule: - In covariant positions, such as method return types, replace type parameters with “id” or “Class” (the latter only when the type parameter bound is “Class” or qualified class, e.g, “Class<NSCopying>”) - In other positions (e.g., parameter types), replace type parameters with their type bounds. - When a specialized Objective-C object or object pointer type contains a type parameter in its type arguments (e.g., NSArray<T>*, but not NSArray<NSString *> *), replace the entire object/object pointer type with its unspecialized version (e.g., NSArray *). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241543 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240353 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-1/+1
| | | | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240270 91177308-0d34-0410-b5e6-96231b3b80d8
* [Objective-C Sema]This patch fixes the warning when clang issuesFariborz Jahanian2015-04-151-2/+2
| | | | | | | | | | | "multiple methods named '<selector>' found" warning by noting the method that is actualy used. It also cleans up and refactors code in this area and selects a method that matches actual arguments in case of receiver being a forward class object. rdar://19265430 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235023 91177308-0d34-0410-b5e6-96231b3b80d8
* Sema: Parenthesized bound destructor member expressions can be calledDavid Majnemer2015-02-251-2/+2
| | | | | | | | | We would wrongfully reject (a.~A)() in both the destructor and pseudo-destructor cases. This fixes PR22668. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230512 91177308-0d34-0410-b5e6-96231b3b80d8
* Update APIs that return a pair of iterators to return an iterator_range instead.Benjamin Kramer2015-02-061-9/+5
| | | | | | Convert uses of those APIs into ranged for loops. NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@228404 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C. Prevents a crash generating AST for aFariborz Jahanian2014-09-151-0/+4
| | | | | | | | | | a property assignment due to numerous user errors. Cannot come up with a reasonable test case due to array of user errors before the crash point. rdar://17813651. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217825 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C. Accept 'nil' as indexing argument toFariborz Jahanian2014-09-101-1/+2
| | | | | | | | dictionary literals since the API which implements them accepts it too. // rdar://18254621 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217543 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some cases where StringRef was being passed by const reference. Remove ↵Craig Topper2014-08-301-1/+1
| | | | | | const from some other StringRefs since its implicitly const already. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216825 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix crash when accessing a property of an invalid interfaceOlivier Goffart2014-08-041-12/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214735 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix crash when assiging to a property with an invalid typeOlivier Goffart2014-08-041-1/+6
| | | | | | | | | | This is a regression from clang 3.4 Set the result to ExprError and returns true, rather than simply returns false because errors have been reported already and returning false show a confusing error git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214734 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch over a few uses of param_begin() to parameters()Alp Toker2014-07-071-9/+9
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@212442 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C ARC. Do not warn about properties with bothFariborz Jahanian2014-06-171-7/+14
| | | | | | | | | | IBOutlet and weak attributes when accessed being unpredictably set to nil because usage of such properties are always single threaded and its ivar cannot be set to nil asynchronously. // rdar://15885642 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211132 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C. Diagnose when property access is using declaredFariborz Jahanian2014-06-161-1/+4
| | | | | | | | property accessor methods which have become deprecated or available. // rdar://15951801 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211039 91177308-0d34-0410-b5e6-96231b3b80d8
* Hide the concept of diagnostic levels from lex, parse and semaAlp Toker2014-06-151-6/+3
| | | | | | | | | | | | | | | | The compilation pipeline doesn't actually need to know about the high-level concept of diagnostic mappings, and hiding the final computed level presents several simplifications and other potential benefits. The only exceptions are opportunistic checks to see whether expensive code paths can be avoided for diagnostics that are guaranteed to be ignored at a certain SourceLocation. This commit formalizes that invariant by introducing and using DiagnosticsEngine::isIgnored() in place of individual level checks throughout lex, parse and sema. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211005 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C. Don't ignore availability attribute whenFariborz Jahanian2014-06-101-1/+4
| | | | | | | | doing Objective-C subscript access. // rdar://16842487 PR19682. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210565 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid dubious IdentifierInfo::getNameStart() usesAlp Toker2014-06-071-4/+2
| | | | | | | | These cases in particular were incurring an extra strlen() when we already knew the length. They appear to be leftovers from when the interfaces worked with C strings that have continued to compile due to the implicit StringRef ctor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210403 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactoring. Remove release and take methods from ActionResult. Rename ↵Nikola Smiljanic2014-05-291-15/+15
| | | | | | takeAs to getAs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209800 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C. Diagnose use of properties in functions nested in, Fariborz Jahanian2014-05-281-0/+20
| | | | | | | | now deprecated, ObjC containers instead of crashing. // rdar://16859666 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209758 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'. Sema edition.Craig Topper2014-05-261-18/+19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209613 91177308-0d34-0410-b5e6-96231b3b80d8
* Decouple ExprCXX.h and DeclCXX.h and clean up includes a bit.Benjamin Kramer2014-05-101-0/+1
| | | | | | | Required pulling LambdaExpr::Capture into its own header. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208470 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C. Patch to allow use of dot syntax on classFariborz Jahanian2014-04-211-2/+4
| | | | | | | | objects to fund root class's instance methods. // rdar://16650575 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206781 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-121-12/+12
| | | | | | class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203640 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C properties. Fixes a crash in Sema where RHS ofFariborz Jahanian2014-03-061-4/+7
| | | | | | | | the property assignment is an lvalue for an incomplete type. // rdar://15118128. Reviewed offline by John McCall. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203043 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename getResultType() on function and method declarations to getReturnType()Alp Toker2014-01-251-14/+11
| | | | | | | | | | | | | | | A return type is the declared or deduced part of the function type specified in the declaration. A result type is the (potentially adjusted) type of the value of an expression that calls the function. Rule of thumb: * Declarations have return types and parameters. * Expressions have result types and arguments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@200082 91177308-0d34-0410-b5e6-96231b3b80d8
* Removing some more unnecessary manual quotes from diagnostics.Aaron Ballman2014-01-031-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198418 91177308-0d34-0410-b5e6-96231b3b80d8
* Removing some more unnecessary manual quotes from attribute diagnostics.Aaron Ballman2014-01-031-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198387 91177308-0d34-0410-b5e6-96231b3b80d8
* s/getter_setter/accessor No functional changes intended.Aaron Ballman2013-12-261-4/+4
| | | | | | Thanks to Alp Toker for the naming suggestion! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198052 91177308-0d34-0410-b5e6-96231b3b80d8
* Parameterizing some MS property-related diagnostics. No functional changes ↵Aaron Ballman2013-12-261-6/+8
| | | | | | intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198049 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove a whole lot of unused variablesAlp Toker2013-11-271-2/+0
| | | | | | | There are about 30 removed in this patch, generated by a new FixIt I haven't got round to submitting yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195814 91177308-0d34-0410-b5e6-96231b3b80d8
* ObjectiveC++: support for passing C++11 style initialized temporaries to Fariborz Jahanian2013-10-161-0/+10
| | | | | | | | objc++ properties using property-dot syntax. // rdar://14654207 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192819 91177308-0d34-0410-b5e6-96231b3b80d8
* Make IgnoreParens() look through ChooseExprs.Eli Friedman2013-07-201-0/+19
| | | | | | | | | | | | | This is the same way GenericSelectionExpr works, and it's generally a more consistent approach. A large part of this patch is devoted to caching the value of the condition of a ChooseExpr; it's needed to avoid threading an ASTContext into IgnoreParens(). Fixes <rdar://problem/14438917>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186738 91177308-0d34-0410-b5e6-96231b3b80d8
* address some comments on r183474:Adrian Prantl2013-06-071-3/+3
| | | | | | | | | | - factor the name construction part out from constructSetterName - rename constructSetterName to the more appropriate constructSetterSelector no functionality change intended. rdar://problem/14035789 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183582 91177308-0d34-0410-b5e6-96231b3b80d8
* Objective-C arc: don't count use of __weakFariborz Jahanian2013-05-211-2/+2
| | | | | | | | variables when they are used in such unevaluated contexts as __typeof, etc. // rdar://13942025 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182423 91177308-0d34-0410-b5e6-96231b3b80d8