summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprMember.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* objc: Include all types when issuing warning underFariborz Jahanian2012-08-081-1/+1
| | | | | | -Wdirect-ivar-access. llvm-svn: 161500
* objc-arc: Make -Wdirect-ivar-access accessible to allFariborz Jahanian2012-08-071-5/+5
| | | | | | | memory models, except when arc is accessing a weak ivar (which is an error). // rdar://6505197 llvm-svn: 161458
* objective-c: Exclude -Wdirect-ivar-access for arc.Fariborz Jahanian2012-08-071-2/+11
| | | | | | | Allow direct ivar access in init and dealloc methods in mrr. // rdar://650197 llvm-svn: 161426
* objective-c: Implement gcc's -Wdirect-ivar-access option.Fariborz Jahanian2012-08-061-1/+3
| | | | | | // rdar://6505197 llvm-svn: 161362
* Consolidate ObjC lookupPrivateMethod methods from Sema and DeclObjC.Anna Zaks2012-07-271-3/+0
| | | | | | | | | | | | | Also, fix a subtle bug, which occurred due to lookupPrivateMethod defined in DeclObjC.h not looking up the method inside parent's categories. Note, the code assumes that Class's parent object has the same methods as what's in the Root class of a the hierarchy, which is a heuristic that might not hold for hierarchies which do not descend from NSObject. Would be great to fix this in the future. llvm-svn: 160885
* objective-c: If an ivar is (1) the first ivar in a root class and (2) named ↵Fariborz Jahanian2012-06-211-1/+14
| | | | | | | | `isa`, then it should get the same warnings that id->isa gets. // rdar://11702488 llvm-svn: 158938
* Documentation cleanup:James Dennett2012-06-151-3/+3
| | | | | | | | | * Removed \param comments for parameters that no longer exist; * Fixed a "\para" typo to "\param"; * Escaped @, # and \ symbols as needed in Doxygen comments; * Added use of \brief to output short summaries. llvm-svn: 158498
* Introduce -Wunused-private-field. If enabled, this warning detectsDaniel Jasper2012-06-061-0/+2
| | | | | | | unused private fields of classes that are fully defined in the current translation unit. llvm-svn: 158054
* Anonymous union members within a struct are now properly handled as an ↵Aaron Ballman2012-06-011-1/+1
| | | | | | unevaluated field in C++11 mode. This fixes PR12866. llvm-svn: 157784
* Move Sema::RequireCompleteType() and Sema::RequireCompleteExprType()Douglas Gregor2012-05-041-5/+4
| | | | | | | | | | | off PartialDiagnostic. PartialDiagnostic is rather heavyweight for something that is in the critical path and is rarely used. So, switch over to an abstract-class-based callback mechanism that delays most of the work until a diagnostic is actually produced. Good for ~11k code size reduction in the compiler and 1% speedup in -fsyntax-only on the code in <rdar://problem/11004361>. llvm-svn: 156176
* Let's use the correct bool this time.Kaelyn Uhrain2012-05-011-1/+1
| | | | llvm-svn: 155871
* A couple of very small tweaks suggested by Doug in reply to r155580 and r155163.Kaelyn Uhrain2012-05-011-1/+1
| | | | llvm-svn: 155870
* Add an error message with fixit hint for changing '.' to '->'.Kaelyn Uhrain2012-04-251-3/+32
| | | | | | | | | This is mainly for attempting to recover in cases where a class provides a custom operator-> and a '.' was accidentally used instead of '->' when accessing a member of the object returned by the current object's operator->. llvm-svn: 155580
* Also highlight the member name.Matt Beaumont-Gay2012-04-211-2/+2
| | | | llvm-svn: 155274
* Fix a QoI bug reported by a user.Matt Beaumont-Gay2012-04-211-2/+2
| | | | | | | | | | | Set the source location for the "member reference base type ... is not a structure or union" diag to point at the operator rather than the member name. If we're giving this diagnostic because of a typo'd '.' in place of a ';' at the end of a line, the caret previously pointed at the identifier on the following line, which isn't as helpful as it could be. Pointing the caret at the '.' makes it more obvious what the problem is. llvm-svn: 155267
* Implement C++11 [expr.prim.general]p3, which permits the use of 'this'Douglas Gregor2012-04-161-12/+5
| | | | | | | | | | | | | | | | | | | | | | | in the declaration of a non-static member function after the (optional) cv-qualifier-seq, which in practice means in the exception specification and late-specified return type. The new scheme here used to manage 'this' outside of a member function scope is more general than the Scope-based mechanism previously used for non-static data member initializers and late-parsesd attributes, because it can also handle the cv-qualifiers on the member function. Note, however, that a separate pass is required for static member functions to determine whether 'this' was used, because we might not know that we have a static function until after declaration matching. Finally, this introduces name mangling for 'this' and for the implicit 'this', which is intended to match GCC's mangling. Independent verification for the new mangling test case would be appreciated. Fixes PR10036 and PR12450. llvm-svn: 154799
* Improve diagnostics for invalid use of non-static members / this:Richard Smith2012-04-051-19/+27
| | | | | | | | | | | | * s/nonstatic/non-static/ in the diagnostics, since the latter form outvoted the former by 28-2 in our diagnostics. * Fix the "use of member in static member function" diagnostic to correctly detect this situation inside a block or lambda. * Produce a more specific "invalid use of non-static member" diagnostic for the case where a nested class member refers to a member of a lexically-surrounding class. llvm-svn: 154073
* Fix crash on invalid code. I've tried to produce a reduced test case, but ↵Ted Kremenek2012-03-171-1/+10
| | | | | | when I do the specific crash is hidden. Fixes <rdar://problem/11063594>. llvm-svn: 152968
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-8/+8
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* objective-c lldb support: don't perform ivar access control check Fariborz Jahanian2012-03-071-9/+10
| | | | | | when debugging. // rdar://10997647 llvm-svn: 152187
* Fix r151443 to only apply C++11's exception for non-static data member accessRichard Smith2012-02-251-5/+14
| | | | | | | in cases where we would otherwise disallow the access, and add a -Wc++98-compat diagnostic for this C++11 feature. llvm-svn: 151444
* PR11956: C++11's special exception for accessing non-static data members fromRichard Smith2012-02-251-15/+15
| | | | | | unevaluated operands applies within member functions, too. llvm-svn: 151443
* Bugfix: bogus warning -- "invalid use of non-static data member",DeLesley Hutchins2012-02-251-1/+2
| | | | | | | when a class is forward declared, and the reference to the data member in question does not occur within a method body. llvm-svn: 151413
* Fixed instantiation of DependentScopeDeclRefExpr.Abramo Bagnara2012-02-061-2/+2
| | | | llvm-svn: 149868
* Split Sema::MarkDeclarationReferenced into multiple functions; the ↵Eli Friedman2012-02-021-16/+17
| | | | | | additional entry points are needed to implement C++11 odr-use marking correctly. No functional change in this patch; I'll actually make the change which fixes the odr-use marking in a followup patch. llvm-svn: 149586
* Make the callback object to Sema::CorrectTypo mandatory.Kaelyn Uhrain2012-01-311-2/+2
| | | | llvm-svn: 149451
* Added source location for the template keyword in AST template-id expressions.Abramo Bagnara2012-01-271-16/+26
| | | | llvm-svn: 149127
* Remove PotentiallyPotentiallyEvaluated, and replace it with a much simpler ↵Eli Friedman2012-01-201-35/+11
| | | | | | and less error-prone way of handling the relevant cases. Towards marking of whether a declaration is used more accurately. llvm-svn: 148522
* objc: deprecate direct usage of 'isa' of objc objectsFariborz Jahanian2012-01-181-2/+4
| | | | | | | in favor of usage of api's intended for. // rdar://8290002 llvm-svn: 148404
* Make PotentiallyPotentiallyEvaluated contexts work correctly when ↵Eli Friedman2012-01-181-15/+44
| | | | | | referencing a class field from outside an instance method. llvm-svn: 148376
* Remove unreachable code in Clang. (replace with llvm_unreachable where ↵David Blaikie2012-01-171-1/+0
| | | | | | appropriate or when GCC requires it) llvm-svn: 148292
* Convert SemaExprMember.cpp to pass a callback object to CorrectTypo,Kaelyn Uhrain2012-01-131-12/+23
| | | | | | | | | improving the typo correction results in certain situations. This is also the first typo correction callback conversion to affect an existing unit test. :) llvm-svn: 148140
* A few minor improvements to error recovery trying to access member of a ↵Eli Friedman2012-01-131-7/+5
| | | | | | function. In particular, this restores the cool error recovery for the example from http://blog.llvm.org/2010/04/amazing-feats-of-clang-error-recovery.html , which regressed a few months back. llvm-svn: 148089
* More lambda work: semantic analysis of capturing 'this'. It's a bit ↵Eli Friedman2012-01-071-0/+3
| | | | | | complicated, but we have to be careful about when exactly captures are marked given PotentiallyPotentiallyEvaluated contexts. (Actually, it's not 100% correct yet, but it's close enough for the moment.) llvm-svn: 147723
* Diagnose cases where the definition of a particular type is required,Douglas Gregor2012-01-021-0/+5
| | | | | | | is known (to Clang), but is not visible because the module has not yet been imported. llvm-svn: 147436
* Unlike in C++03, a constant-expression is not an unevaluated operand in C++11.Richard Smith2011-12-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | Split out a new ExpressionEvaluationContext flag for this case, and don't treat it as unevaluated in C++11. This fixes some crash-on-invalids where we would allow references to class members in potentially-evaluated constant expressions in static member functions, and also fixes half of PR10177. The fix to PR10177 exposed a case where template instantiation failed to provide a source location for a diagnostic, so TreeTransform has been tweaked to supply source locations when transforming a type. The source location is still not very good, but MarkDeclarationsReferencedInType would need to operate on a TypeLoc to improve it further. Also fix MarkDeclarationReferenced in C++98 mode to trigger instantiation for static data members of class templates which are used in constant expressions. This fixes a link-time problem, but we still incorrectly treat the member as non-constant. The rest of the fix for that issue is blocked on PCH support for early-instantiated static data members, which will be added in a subsequent patch. llvm-svn: 146955
* Replace all comparisons between ObjCInterfaceDecl pointers with callsDouglas Gregor2011-12-151-2/+2
| | | | | | | | to declaresSameEntity(), as a baby step toward tracking forward declarations of Objective-C classes precisely. Part of <rdar://problem/10583531>. llvm-svn: 146618
* Fix some cases where a CK_IntegralCast was being used to convert an lvalue to anRichard Smith2011-10-271-0/+1
| | | | | | | | | rvalue. An assertion to catch this is in ImpCastExprToType will follow, but vector operations currently trip over this (due to omitting the usual arithmetic conversions). Also add an assert to catch missing lvalue-to-rvalue conversions on the LHS of ->. llvm-svn: 143155
* Pull out conversion on LHS of -> and . into its own function. This happensRichard Smith2011-10-261-7/+12
| | | | | | | implicitly in LookupMemberExpr and explicitly in cases where template instantiation doesn't redo the lookup. llvm-svn: 143046
* Restore r142914 and r142915, now with missing file and apparentJohn McCall2011-10-251-40/+8
| | | | | | GCC compiler workaround. llvm-svn: 142931
* Revert r142914 and r142915, due to possibly missing file.NAKAMURA Takumi2011-10-251-8/+40
| | | | | | r142914: "Introduce a placeholder type for "pseudo object"" r142915: "Pull the pseudo-object stuff into its own file." llvm-svn: 142921
* Introduce a placeholder type for "pseudo object"John McCall2011-10-251-40/+8
| | | | | | | | | | | | | | | expressions: expressions which refer to a logical rather than a physical l-value, where the logical object is actually accessed via custom getter/setter code. A subsequent patch will generalize the AST for these so that arbitrary "implementing" sub-expressions can be provided. Right now the only client is ObjC properties, but this should be generalizable to similar language features, e.g. Managed C++'s __property methods. llvm-svn: 142914
* Make it possible to compute the type of 'this' without capturingDouglas Gregor2011-10-181-2/+2
| | | | | | it. Refactoring to be used in a moment. llvm-svn: 142360
* obj-c++: Fix a IRGen crash when getter is a reference type.Fariborz Jahanian2011-10-171-9/+9
| | | | | | Fix is in Sema. // rdar://10153365 llvm-svn: 142249
* Catch placeholder types in DefaultLvalueConversionJohn McCall2011-10-111-43/+19
| | | | | | | | | | | and DefaultFunctionArrayLvalueConversion. To prevent significant regression for should-this-be-a-call fixits, and to repair some such regression from the introduction of bound member placeholders, make those placeholder checks try to build calls appropriately. Harden the build-a-call logic while we're at it. llvm-svn: 141738
* Don't complain about qualified property or ivar access when theDouglas Gregor2011-10-101-2/+2
| | | | | | qualifier itself is invalid. Crasher noticed by Fariborz. llvm-svn: 141544
* Diagnose attempts to qualify the name of an instance variable orDouglas Gregor2011-10-091-0/+14
| | | | | | property in an Objective-C++ member access expression. Fixes PR9759. llvm-svn: 141522
* Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.Argyrios Kyrtzidis2011-09-191-1/+1
| | | | | | It already works (and is useful with) macro locs as well. llvm-svn: 140057
* Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear ↵Francois Pichet2011-09-171-1/+1
| | | | | | | | that this flag must be used only for Microsoft extensions and not emulation; to avoid confusion with the new LangOptions::MicrosoftMode flag. Many of the code now under LangOptions::MicrosoftExt will eventually be moved under the LangOptions::MicrosoftMode flag. llvm-svn: 139987
* Encapsulate the Objective-C id/Class/SEL "redefinition" types inDouglas Gregor2011-08-111-4/+5
| | | | | | | | | ASTContext with accessors/mutators. The only functional change is that the AST writer won't bother writing the id/Class/SEL redefinition type if it hasn't been explicitly set; previously, it ended up being written as a synonym for the built-in id/Class/SEL. llvm-svn: 137349
OpenPOWER on IntegriCloud