aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclObjC.cpp
AgeCommit message (Collapse)Author
2009-03-29tighten this up, the decl *must* be a declcontext, no need for the dynamic ↵Chris Lattner
check. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67978 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28Introduce a new OpaquePtr<N> struct type, which is a simple POD wrapper for aChris Lattner
pointer. Its purpose in life is to be a glorified void*, but which does not implicitly convert to void* or other OpaquePtr's with a different UID. Introduce Action::DeclPtrTy which is a typedef for OpaquePtr<0>. Change the entire parser/sema interface to use DeclPtrTy instead of DeclTy*. This makes the C++ compiler enforce that these aren't convertible to other opaque types. We should also convert ExprTy, StmtTy, TypeTy, AttrTy, BaseTy, etc, but I don't plan to do that in the short term. The one outstanding known problem with this patch is that we lose the bitmangling optimization where ActionResult<DeclPtrTy> doesn't know how to bitmangle the success bit into the low bit of DeclPtrTy. I will rectify this with a subsequent patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67952 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-21Issue error if variables are defined inside an objc class,Fariborz Jahanian
category or protocol. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67450 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18objc: Implemented variables declared in class interface Fariborz Jahanian
whose sema decl is at the translation unit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67249 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-14Make Selector::getIdentifierInfo() private. I took a first attempt at this lastTed Kremenek
week in: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090302/013580.html That patch caused the output of the diagnostics to change. Since 'DeclarationName' can already reason about Selectors and the Diagnostics logic reasons about DeclarationName, there is no additional code needed to get the diagnostics working by making Selector::getIdentifierInfo() private. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66992 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13Remove ActiveScope (revert ↵Steve Naroff
http://llvm.org/viewvc/llvm-project?view=rev&revision=65694 and http://llvm.org/viewvc/llvm-project?view=rev&revision=66741). Will replace with something better today... git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66893 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07Revert my last couple patches until I can get them to not make the tests fail.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66317 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07Teach Diagnostic about Selector.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66314 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07Selector: (changes made after discussing this more with Steve Naroff)Ted Kremenek
- Make Selector::getAsIdentifierInfo() private. Using IdentifierInfo* in Selector is an implementation detail that clients shouldn't think about. - Modify diagnostic emission in Sema::ProcessPropertyDecl to not use Selector::getAsIdentifierInfo() (which could crash when IdentifierInfo* is null) and instead use Selector::getAsString(). - Tidy up Selector::getAsString() implementation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66313 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05Tweak diag for <rdar://problem/5982579> [clang on xcode] (using ↵Steve Naroff
arch=x86_64): synthesized property 'sdkPath' must either be named the same as a compatible ivar or must explicitly name an ivar. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66162 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05Fix <rdar://problem/6144382> [sema] gcc inconsistency w.r.t. forward ↵Steve Naroff
protocol declarations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66161 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04simplify Sema::AddInstanceMethodToGlobalPool, no functionality change.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66016 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-03Fix <rdar://problem/5982579> [clang on xcode] (using arch=x86_64): ↵Steve Naroff
synthesized property 'sdkPath' must either be named the same as a compatible ivar or must explicitly name an ivar. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65973 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-03Fix <rdar://problem/6497242> Inherited overridden protocol declared objects ↵Steve Naroff
don't work. Change Sema::DiagnosePropertyMismatch() to check for type compatibility (rather than type equivalence, which is too strict). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65949 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-03Fix <rdar://problem/6497608> clang does not catch ivar type mismatches in ↵Steve Naroff
@implementation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65948 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-02Fixed a typo.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65855 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-02Check for duplicate declaration of method of a classFariborz Jahanian
in its extension. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65854 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-01"This patch uses the new ObjCImplDecl class to merge ↵Chris Lattner
Sema::ImplMethodsVsClassMethods and Sema::ImplCategoryMethodsVsIntfMethods methods. And now, when clang check a class implementation to find unimplemented methods, it also checks all methods from the class extensions (unnamed categories). There is also a test case to check this warning. This patch contains also a minor update for ObjCImplDecl . getNameAsCString and getNameAsString now returns an empty string instead of crashing for unnamed categories." Patch by Jean-Daniel Dupas! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65744 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28Minor name change (move the ObjC prefix to a more appropriate place).Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65695 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28Fix <rdar://problem/6451399> problems with labels and blocks.Steve Naroff
- Move the 'LabelMap' from Sema to Scope. To avoid layering problems, the second element is now a 'StmtTy *', which makes the LabelMap a bit more verbose to deal with. - Add 'ActiveScope' to Sema. Managed by ActOnStartOfFunctionDef(), ObjCActOnStartOfMethodDef(), ActOnBlockStmtExpr(). - Changed ActOnLabelStmt(), ActOnGotoStmt(), ActOnAddrLabel(), and ActOnFinishFunctionBody() to use the new ActiveScope. - Added FIXME to workaround in ActOnFinishFunctionBody() (for dealing with C++ nested functions). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65694 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27Diagnose gc attribute mismatch of property and its ivar.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65656 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26Fix <rdar://problem/6574319> clang issues error on 'readonly' property with ↵Steve Naroff
a defaul setter attribute. Needed to make isPropertyReadonly() non-const (for this fix to compile). I imagine there's a way to retain the const-ness, however I have more important fish to fry. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65562 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-23fix rdar://6611778, a redefinition of an interface was causing anChris Lattner
assertion when the ivars and method list was reset into the existing interface. To fix this, mark decls as invalid when they are redefined, and don't insert ivars/methods into invalid decls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65340 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20Fix <rdar://problem/6500554> missing objc error message.Steve Naroff
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65198 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20fix indentationChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65170 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20add plumbing to get ASTContext& down to allocation/deallocation points in ↵Chris Lattner
ObjCList, but don't start using it yet. Renamed some methods to be more consistent. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65168 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20remove some more methods from objc decls, using the iteratorChris Lattner
interfaces more consistently. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65138 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18Downgrade complaints about calling unavailable functions to a warningDouglas Gregor
(as GCC does), except when we've performed overload resolution and found an unavailable function: in this case, we actually error. Merge the checking of unavailable functions with the checking for deprecated functions. This unifies a bit of code, and makes sure that we're checking for unavailable functions in the right places. Also, this check can cause an error. We may, eventually, want an option to make "unavailable" warnings into errors. Implement much of the logic needed for C++0x deleted functions, which are effectively the same as "unavailable" functions (but always cause an error when referenced). However, we don't have the syntax to specify deleted functions yet :) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64955 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16diagnose uses of deprecated typenames and tags.Chris Lattner
We now pass all the deprecation tests in the objc.dg suite. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64679 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16warn about interfaces that inherit from deprecated classes.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64671 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16warn about categories that implement deprecated interfaces.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64670 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16early exit on error. This code is creating an invalid decl on error. This isChris Lattner
dubious, but at least mark it as an invalid decl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64668 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16Remove an unused variable (which caused a warning).Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64660 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16Remove FindIvarDeclaration. Use lookupInstanceVariable is is functionallyFariborz Jahanian
the same. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64657 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16code cleanupChris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64651 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16propagate attributes onto property decls.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64643 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16Untabify.Ben Laurie
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64628 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-14simplify some code.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64548 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04Some name-lookup-related fixes, from Piotr Rak!Douglas Gregor
- Changes Lookup*Name functions to return NamedDecls, instead of Decls. Unfortunately my recent statement that it will simplify lot of code, was not quite right, but it simplifies some... - Makes MergeLookupResult SmallPtrSet instead of vector, following Douglas suggestions. - Adds %qN format for printing qualified names to Diagnostic. - Avoids searching for using-directives in Scopes, which are not DeclScope, during unqualified name lookup. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63739 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04Fix <rdar://problem/6552648> error: redefinition of ↵Steve Naroff
'XCElementAnchorDelegate' as different kind of symbol. At first glance, this looked like a recent regression (possibly created by http://llvm.org/viewvc/llvm-project?view=rev&revision=63354, which was the only recent change to this section of Sema::ActOnStartClassInterface()). After more investigation, it looks like an edge case bug that we didn't cover in our tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63738 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02Add a macro-based enumeration of all of the Decl nodes (like we doDouglas Gregor
with Stmt/Expr nodes), and convert some of the more mundane switch-on-all-decl-kinds uses over to use this new file. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63570 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30Eliminated LookupCriteria, whose creation was causing a bottleneck forDouglas Gregor
LookupName et al. Instead, use an enum and a bool to describe its contents. Optimized the C/Objective-C path through LookupName, eliminating any unnecessarily C++isms. Simplify IdentifierResolver::iterator, removing some code and arguments that are no longer used. Eliminated LookupDeclInScope/LookupDeclInContext, moving all callers over to LookupName, LookupQualifiedName, or LookupParsedName, as appropriate. All together, I'm seeing a 0.2% speedup on Cocoa.h with PTH and -disable-free. Plus, we're down to three name-lookup routines. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63354 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29diags moved, so these casts are no longer needed.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63324 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29Suppress a warningDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63310 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29move library-specific diagnostic headers into library private dirs. ReduceChris Lattner
redundant #includes. Patch by Anders Johnsen! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63271 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-29Refactor Sema::LookupDecl() into 2 functions: LookupDeclInScope() and ↵Steve Naroff
LookupDeclInContext(). The previous interface was very confusing. This is much more explicit, which will be easier to understand/optimize/convert. The plan is to eventually deprecate both of these functions. For now, I'm focused on performance. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63256 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27Split the single monolithic DiagnosticKinds.def file into oneChris Lattner
.def file for each library. This means that adding a diagnostic to sema doesn't require all the other libraries to be rebuilt. Patch by Anders Johnsen! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63111 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-20Remove ScopedDecl, collapsing all of its functionality into Decl, soDouglas Gregor
that every declaration lives inside a DeclContext. Moved several things that don't have names but were ScopedDecls (and, therefore, NamedDecls) to inherit from Decl rather than NamedDecl, including ObjCImplementationDecl and LinkageSpecDecl. Now, we don't store empty DeclarationNames for these things, nor do we try to insert them into DeclContext's lookup structure. The serialization tests are temporarily disabled. We'll re-enable them once we've sorted out the remaining ownership/serialiazation issues between DeclContexts and TranslationUnion, DeclGroups, etc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62562 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-19Type of property and its ivar is more restrictiveFariborz Jahanian
that rules for assignment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62524 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17Diagnose when method parameter is an object.Fariborz Jahanian
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62431 91177308-0d34-0410-b5e6-96231b3b80d8