summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
* Explicit declaration of property setters over-rideFariborz Jahanian2009-01-101-1/+7
| | | | | | prohibition of 'readonly' properties in an assignment. llvm-svn: 62028
* This patch removes mergeProperties and does the property lookupFariborz Jahanian2009-01-091-25/+10
| | | | | | in designated protocols lazily. llvm-svn: 62007
* Replace DeclContext's vector of ScopedDecl pointers with a linked listDouglas Gregor2009-01-092-2/+18
| | | | | | | | | | | | | | | | | | of ScopedDecls (using the new ScopedDecl::NextDeclInScope pointer). Performance-wise: - It's a net win in memory utilization, since DeclContext is now one pointer smaller than it used to be (std::vectors are typically 3 pointers; we now use 2 pointers) and - Parsing Cocoa.h with -fsyntax-only (with a Release-Asserts Clang) is about 1.9% faster than before, most likely because we no longer have the memory allocations and copying associated with the std::vector. I'll re-enable serialization of DeclContexts once I've sorted out the NextDeclarator/NextDeclInScope question. llvm-svn: 62001
* Make sure that ScopedDecls passed to DeclContext::addDecl are added into ↵Douglas Gregor2009-01-092-1/+8
| | | | | | their lexical context llvm-svn: 61998
* Provide a new kind of iterator, the specific_decl_iterator, thatDouglas Gregor2009-01-092-3/+3
| | | | | | | | | filters the decls seen by decl_iterator with two criteria: the dynamic type of the declaration and a run-time predicate described by a member function. This simplifies EnumDecl, RecordDecl, and ObjCContainerDecl considerably. It has no measurable performance impact. llvm-svn: 61994
* Move property API's up to ObjCContainerDecl (removing a lot of duplicate code).Steve Naroff2009-01-093-106/+32
| | | | | | | | | Add isa/cast/dyncast support for ObjCContainerDecl. Renamed classprop_iterator/begin/end to prop_iterator/begin/end (the class prefix was confusing). More simplifications to Sema::ActOnAtEnd()... Added/changed some FIXME's as a result of the above work. llvm-svn: 61988
* Fix crash on null deference when searching for readwrite properties inDaniel Dunbar2009-01-091-13/+15
| | | | | | | categories. - Also, simplify nesting via early return. llvm-svn: 61968
* Addressed the issue in <rdar://problem/6479085>, where we failed toDouglas Gregor2009-01-091-18/+20
| | | | | | | | | | | | | | | rewrite @class declarations that showed up within linkage specifications because those @class declarations never made it any place where the rewriter could find them. Moved all of the ObjC*Decl nodes over to ScopedDecls, so that they can live in the appropriate top-level or transparent DeclContext near the top level, e.g., TranslationUnitDecl or LinkageSpecDecl. Objective-C declarations now show up in a traversal of the declarations in a DeclContext (they didn't before!). This way, the rewriter finds all Objective-C declarations within linkage specifications. llvm-svn: 61966
* Revert my previous, failed attempt to pretty-print anonymous struct/union ↵Douglas Gregor2009-01-081-4/+5
| | | | | | accesses well. Added a FIXME so we know to revisit this later llvm-svn: 61951
* Fix ObjCInterfaceDecl::Destroy and ObjCProtocolDecl::Destroy to iterate and ↵Ted Kremenek2009-01-081-10/+4
| | | | | | destroy all contained ObjCMethodDecls in one sweep. This fixes a use-after-free error found by valgrind. llvm-svn: 61943
* Unify the code for defining tags in C and C++, so that we alwaysDouglas Gregor2009-01-082-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | introduce a Scope for the body of a tag. This reduces the number of semantic differences between C and C++ structs and unions, and will help with other features (e.g., anonymous unions) in C. Some important points: - Fields are now in the "member" namespace (IDNS_Member), to keep them separate from tags and ordinary names in C. See the new test in Sema/member-reference.c for an example of why this matters. In C++, ordinary and member name lookup will find members in both the ordinary and member namespace, so the difference between IDNS_Member and IDNS_Ordinary is erased by Sema::LookupDecl (but only in C++!). - We always introduce a Scope and push a DeclContext when we're defining a tag, in both C and C++. Previously, we had different actions and different Scope/CurContext behavior for enums, C structs/unions, and C++ structs/unions/classes. Now, it's one pair of actions. (Yay!) There's still some fuzziness in the handling of struct/union/enum definitions within other struct/union/enum definitions in C. We'll need to do some more cleanup to eliminate some reliance on CurContext before we can solve this issue for real. What we want is for something like this: struct X { struct T { int x; } t; }; to introduce T into translation unit scope (placing it at the appropriate point in the IdentifierResolver chain, too), but it should still have struct X as its lexical declaration context. PushOnScopeChains isn't smart enough to do that yet, though, so there's a FIXME test in nested-redef.c llvm-svn: 61940
* Removed ObjCContainerDecl::getPropertyMethods()...doesn't belong in the AST.Steve Naroff2009-01-081-72/+0
| | | | | | Moved logic to Sema::ProcessPropertyDecl(). llvm-svn: 61936
* Remove redundant method context (now that ObjCMethodDecl isa ScopedDecl).Steve Naroff2009-01-081-6/+7
| | | | | | | | Convert clients to use the standard getDeclContext() API. Doug, thanks for the review! llvm-svn: 61935
* This is a large/messy diff that unifies the ObjC AST's with DeclContext.Steve Naroff2009-01-083-95/+66
| | | | | | | | | | | | | | | - ObjCContainerDecl's (ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl), ObjCCategoryImpl, & ObjCImplementation are all DeclContexts. - ObjCMethodDecl is now a ScopedDecl (so it can play nicely with DeclContext). - ObjCContainerDecl now does iteration/lookup using DeclContext infrastructure (no more linear search:-) - Removed ASTContext argument to DeclContext::lookup(). It wasn't being used and complicated it's use from an ObjC AST perspective. - Added Sema::ProcessPropertyDecl() and removed Sema::diagnosePropertySetterGetterMismatch(). - Simplified Sema::ActOnAtEnd() considerably. Still more work to do. - Fixed an incorrect casting assumption in Sema::getCurFunctionOrMethodDecl(), now that ObjCMethodDecl is a ScopedDecl. - Removed addPropertyMethods from ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl. This passes all the tests on my machine. Since many of the changes are central to the way ObjC finds it's methods, I expect some fallout (and there are still a handful of FIXME's). Nevertheless, this should be a step in the right direction. llvm-svn: 61929
* Fix printing of member references to avoid displaying implicitly-generated ↵Douglas Gregor2009-01-071-2/+4
| | | | | | member references, e.g., for anonymous struct/unions or implicit 'this' in member functions llvm-svn: 61885
* Finished semantic analysis of anonymous unions in C++.Douglas Gregor2009-01-072-1/+10
| | | | | | | | | Duplicate-member checking within classes is still a little messy, and anonymous unions are still completely broken in C. We'll need to unify the handling of fields in C and C++ to make this code applicable in both languages. llvm-svn: 61878
* ObjC AST cleanups/simplifications (phase 1).Steve Naroff2009-01-071-49/+6
| | | | | | Add ObjCContainerDecl class and have ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl inherit from it. llvm-svn: 61866
* When determining whether a variable is a file-scoped variable, checkDouglas Gregor2009-01-071-2/+2
| | | | | | | out its lookup context (to see through linkage specifications). Addresses <rdar://problem/6477142>. llvm-svn: 61848
* Initial implementation of anonymous unions (and, as a GNU extension,Douglas Gregor2009-01-073-2/+5
| | | | | | | | | | | | structures and classes) in C++. Covers name lookup and the synthesis and member access for the unnamed objects/fields associated with anonymous unions. Some C++ semantic checks are still missing (anonymous unions can't have function members, static data members, etc.), and there is no support for anonymous structs or unions in C. llvm-svn: 61840
* Allow Objective-C entities to be declared within a transparent contextDouglas Gregor2009-01-061-0/+7
| | | | | | nested in the translation unit. This fixes <rdar://problem/6476070>. llvm-svn: 61832
* Minor tweaks to the transparent declcontext patchDouglas Gregor2009-01-061-1/+2
| | | | llvm-svn: 61798
* Add QualifiedDeclRefExpr, which retains additional source-locationDouglas Gregor2009-01-063-2/+49
| | | | | | | | | | | | | | | | | | | information for declarations that were referenced via a qualified-id, e.g., N::C::value. We keep track of the location of the start of the nested-name-specifier. Note that the difference between QualifiedDeclRefExpr and DeclRefExpr does have an effect on the semantics of function calls in two ways: 1) The use of a qualified-id instead of an unqualified-id suppresses argument-dependent lookup 2) If the name refers to a virtual function, the qualified-id version will call the function determined statically while the unqualified-id version will call the function determined dynamically (by looking up the appropriate function in the vtable). Neither of these features is implemented yet, but we do print out qualified names for QualifiedDeclRefExprs as part of the AST printing. llvm-svn: 61789
* Back out code for handling VectorType's in getFloatingRank.Daniel Dunbar2009-01-051-2/+0
| | | | llvm-svn: 61764
* Implement getFloatingRank() for extended vectors.Daniel Dunbar2009-01-051-2/+4
| | | | | | | - I'm not sure this is appropriate, but it seems reasonable to be able to call getFloatingRank on anything which isFloatingType(). llvm-svn: 61758
* PODness and Type TraitsSebastian Redl2009-01-057-5/+201
| | | | | | | | | | | | | | | Make C++ classes track the POD property (C++ [class]p4) Track the existence of a copy assignment operator. Implicitly declare the copy assignment operator if none is provided. Implement most of the parsing job for the G++ type traits extension. Fully implement the low-hanging fruit of the type traits: __is_pod: Whether a type is a POD. __is_class: Whether a type is a (non-union) class. __is_union: Whether a type is a union. __is_enum: Whether a type is an enum. __is_polymorphic: Whether a type is polymorphic (C++ [class.virtual]p1). llvm-svn: 61746
* Introduce support for "transparent" DeclContexts, which areDouglas Gregor2009-01-053-59/+55
| | | | | | | | | | | | | | | | | | | | | | DeclContexts whose members are visible from enclosing DeclContexts up to (and including) the innermost enclosing non-transparent DeclContexts. Transparent DeclContexts unify the mechanism to be used for various language features, including C enumerations, anonymous unions, C++0x inline namespaces, and C++ linkage specifications. Please refer to the documentation in the Clang internals manual for more information. Only enumerations and linkage specifications currently use transparent DeclContexts. Still to do: use transparent DeclContexts to implement anonymous unions and GCC's anonymous structs extension, and, later, the C++0x features. We also need to tighten up the DeclContext/ScopedDecl link to ensure that every ScopedDecl is in a single DeclContext, which will ensure that we can then enforce ownership and reduce the memory footprint of DeclContext. llvm-svn: 61735
* Fix an uninitialized-variable warningDouglas Gregor2009-01-051-1/+1
| | | | llvm-svn: 61700
* Fix try statement deserialization.Sebastian Redl2008-12-241-0/+3
| | | | llvm-svn: 61421
* Add serialization support for TypeOfType.Zhongxing Xu2008-12-241-1/+26
| | | | llvm-svn: 61417
* Add serialization support for TypeOfExpr.Zhongxing Xu2008-12-241-0/+23
| | | | llvm-svn: 61416
* Keep track of template arguments when we parse them. Right now, we don't ↵Douglas Gregor2008-12-241-0/+15
| | | | | | actually do anything with the template arguments, but they'll be used to create template declarations llvm-svn: 61413
* Correct the order in which we cope with end-of-class-definitionDouglas Gregor2008-12-242-7/+9
| | | | | | | | | | | | | | | | | | | | | | semantics and improve our handling of default arguments. Specifically, we follow this order: - As soon as the see the '}' in the class definition, the class is complete and we add any implicit declarations (default constructor, copy constructor, etc.) to the class. - If there are any default function arguments, parse them - If there were any inline member function definitions, parse them As part of this change, we now keep track of the the fact that we've seen unparsed default function arguments within the AST. See the new ParmVarDecl::hasUnparsedDefaultArg member. This allows us to properly cope with calls inside default function arguments to other functions where we're making use of the default arguments. Made some C++ error messages regarding failed initializations more specific. llvm-svn: 61406
* When determining whether a class type has a const copy constructor, beDouglas Gregor2008-12-231-14/+5
| | | | | | | sure to look at all of the results returned by name lookup. Fixes <rdar://problem/6465262> llvm-svn: 61388
* Last patch, for now, to privde ObjC's encoding of types.Fariborz Jahanian2008-12-231-0/+10
| | | | | | We now pass all gcc's encoding compatibility tests. llvm-svn: 61387
* Don't push OverloadedFunctionDecls onto the chain of declarationsDouglas Gregor2008-12-232-23/+23
| | | | | | | | attached to an identifier. Instead, all overloaded functions will be pushed into scope, and we'll synthesize an OverloadedFunctionDecl on the fly when we need it. llvm-svn: 61386
* Lot more encoding work. We are closing the gap toFariborz Jahanian2008-12-231-7/+53
| | | | | | gcc compatibilty in all aspects of encoding now. llvm-svn: 61383
* Don't explicitly represent OverloadedFunctionDecls withinDouglas Gregor2008-12-231-68/+95
| | | | | | | | | | | | | | | | | | | | | | | | DeclContext. Instead, just keep the list of currently-active declarations and only build the OverloadedFunctionDecl when we absolutely need it. This is a half-step toward eliminating the need to explicitly build OverloadedFunctionDecls that store sets of overloaded functions. This was suggested by Argiris a while back, and it's a good thing for several reasons: first, it eliminates the messy logic that currently tries to keep the OverloadedFunctionDecl in sync with the declarations that are being added. Second, it will (eventually) eliminate the need to allocate memory for overload sets, which could help performance. Finally, it helps set us up for when name lookup can return multiple (possibly ambiguous) results, as can happen with lookup of class members in C++. Next steps: make the IdentifierResolver store overloads as separate entries in its list rather than replacing them with an OverloadedFunctionDecl now, then see how far we can go toward eliminating OverloadedFunctionDecl entirely. llvm-svn: 61357
* More encoding support; in this case, encoding ofFariborz Jahanian2008-12-221-2/+9
| | | | | | outer-most const of pointer types. llvm-svn: 61355
* Full AST support and better Sema support for C++ try-catch.Sebastian Redl2008-12-223-3/+47
| | | | llvm-svn: 61346
* Fixed a bug showed up the meta-data for protocol Fariborz Jahanian2008-12-221-2/+10
| | | | | | | instance methods by building print-class-info.m, whose output is now identical to what gcc puts out. llvm-svn: 61339
* Partial AST and Sema support for C++ try-catch.Sebastian Redl2008-12-223-0/+48
| | | | llvm-svn: 61337
* Add support for calls to overloaded member functions. Things to note:Douglas Gregor2008-12-223-5/+18
| | | | | | | | | | | | - Overloading has to cope with having both static and non-static member functions in the overload set. - The call may or may not have an implicit object argument, depending on the syntax (x.f() vs. f()) and the context (static vs. non-static member function). - We now generate MemberExprs for implicit member access expression. - We now cope with mutable whenever we're building MemberExprs. llvm-svn: 61329
* Add codegen support for __nullAnders Carlsson2008-12-211-0/+6
| | | | llvm-svn: 61314
* Correct comments.Zhongxing Xu2008-12-211-3/+3
| | | | llvm-svn: 61311
* fix 80-col violation.Zhongxing Xu2008-12-211-1/+1
| | | | llvm-svn: 61306
* Add ASTContext::getBaseElementType and use it in ↵Anders Carlsson2008-12-211-0/+10
| | | | | | CodeGenFunction::EmitArraySubscriptExpr. llvm-svn: 61303
* Did not mean to commit this.Anders Carlsson2008-12-211-0/+1
| | | | llvm-svn: 61296
* Handle VLA indexingAnders Carlsson2008-12-211-1/+0
| | | | llvm-svn: 61295
* Add support for member references (E1.E2, E1->E2) with C++ semantics,Douglas Gregor2008-12-204-22/+59
| | | | | | | | | | which can refer to static data members, enumerators, and member functions as well as to non-static data members. Implement correct lvalue computation for member references in C++. Compute the result type of non-static data members of reference type properly. llvm-svn: 61294
* Finish up saving original parameter type andFariborz Jahanian2008-12-203-5/+19
| | | | | | using it in ObjC's method parameter encoding. llvm-svn: 61293
OpenPOWER on IntegriCloud