summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaPseudoObject.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [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 llvm-svn: 254067
* 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 llvm-svn: 250827
* 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 llvm-svn: 250822
* [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 llvm-svn: 250265
* 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 llvm-svn: 245771
* 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 *). llvm-svn: 241543
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-1/+1
| | | | llvm-svn: 240353
* 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. llvm-svn: 240270
* [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 llvm-svn: 235023
* 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. llvm-svn: 230512
* 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. llvm-svn: 228404
* 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. llvm-svn: 217825
* 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 llvm-svn: 217543
* 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. llvm-svn: 216825
* Fix crash when accessing a property of an invalid interfaceOlivier Goffart2014-08-041-12/+10
| | | | llvm-svn: 214735
* 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 llvm-svn: 214734
* Switch over a few uses of param_begin() to parameters()Alp Toker2014-07-071-9/+9
| | | | llvm-svn: 212442
* 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 llvm-svn: 211132
* 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 llvm-svn: 211039
* 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. llvm-svn: 211005
* Objective-C. Don't ignore availability attribute whenFariborz Jahanian2014-06-101-1/+4
| | | | | | | doing Objective-C subscript access. // rdar://16842487 PR19682. llvm-svn: 210565
* 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. llvm-svn: 210403
* Refactoring. Remove release and take methods from ActionResult. Rename ↵Nikola Smiljanic2014-05-291-15/+15
| | | | | | takeAs to getAs. llvm-svn: 209800
* 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 llvm-svn: 209758
* [C++11] Use 'nullptr'. Sema edition.Craig Topper2014-05-261-18/+19
| | | | llvm-svn: 209613
* 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. llvm-svn: 208470
* 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 llvm-svn: 206781
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-121-12/+12
| | | | | | class. llvm-svn: 203640
* 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. llvm-svn: 203043
* 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. llvm-svn: 200082
* Removing some more unnecessary manual quotes from diagnostics.Aaron Ballman2014-01-031-1/+1
| | | | llvm-svn: 198418
* Removing some more unnecessary manual quotes from attribute diagnostics.Aaron Ballman2014-01-031-4/+4
| | | | llvm-svn: 198387
* s/getter_setter/accessor No functional changes intended.Aaron Ballman2013-12-261-4/+4
| | | | | | Thanks to Alp Toker for the naming suggestion! llvm-svn: 198052
* Parameterizing some MS property-related diagnostics. No functional changes ↵Aaron Ballman2013-12-261-6/+8
| | | | | | intended. llvm-svn: 198049
* 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. llvm-svn: 195814
* ObjectiveC++: support for passing C++11 style initialized temporaries to Fariborz Jahanian2013-10-161-0/+10
| | | | | | | objc++ properties using property-dot syntax. // rdar://14654207 llvm-svn: 192819
* 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>. llvm-svn: 186738
* 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 llvm-svn: 183582
* 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 llvm-svn: 182423
* Replace 'MultiExprArg()' with 'None'Dmitri Gribenko2013-05-051-4/+3
| | | | llvm-svn: 181166
* Replace ArrayRef<T>() with None, now that we have an implicit ArrayRef ↵Dmitri Gribenko2013-05-051-3/+2
| | | | | | | | constructor from None Patch by Robert Wilhelm. llvm-svn: 181139
* Don't put too much thought into whether or not to capture aJohn McCall2013-04-161-1/+2
| | | | | | | | | type-dependent intermediate result in a postfix ++ pseudo- object operation. Test case by Tong Shen. llvm-svn: 179637
* Basic support for Microsoft property declarations andJohn McCall2013-04-161-0/+116
| | | | | | | | references thereto. Patch by Tong Shen! llvm-svn: 179585
* Add 178663 back.Rafael Espindola2013-04-031-3/+0
| | | | | | | | | | | http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green before it processed the reverted 178663, so it could not have been the culprit. Revert "Revert 178663." This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41. llvm-svn: 178682
* Revert 178663.Rafael Espindola2013-04-031-0/+3
| | | | | | | | | | Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb Revert "Don't compute a patched/semantic storage class." This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05. llvm-svn: 178681
* Don't compute a patched/semantic storage class.Rafael Espindola2013-04-031-3/+0
| | | | | | | | | | | For variables and functions clang used to store two storage classes. The one "as written" in the code and a patched one, which, for example, propagates static to the following decls. This apparently is from the days clang lacked linkage computation. It is now redundant and this patch removes it. llvm-svn: 178663
* Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.Jordan Rose2013-02-081-1/+3
| | | | | | | Nearly all of these changes are one-to-one replacements; the few that aren't have to do with custom identifier validation. llvm-svn: 174768
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-2/+2
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Fix crash-on-invalid. <rdar://problem/12765391>.Eli Friedman2012-11-291-4/+3
| | | | llvm-svn: 168851
* Don't return a pointer to an UnresolvedSetImpl in the CXXRecordDecl interface,Argyrios Kyrtzidis2012-11-281-5/+4
| | | | | | expose only the iterators instead. llvm-svn: 168770
OpenPOWER on IntegriCloud