summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Improve support for overloaded operator templates.Douglas Gregor2009-06-271-7/+3
| | | | llvm-svn: 74390
* Improved semantic analysis and AST respresentation for functionDouglas Gregor2009-06-251-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | templates. For example, this now type-checks (but does not instantiate the body of deref<int>): template<typename T> T& deref(T* t) { return *t; } void test(int *ip) { int &ir = deref(ip); } Specific changes/additions: * Template argument deduction from a call to a function template. * Instantiation of a function template specializations (just the declarations) from the template arguments deduced from a call. * FunctionTemplateDecls are stored directly in declaration contexts and found via name lookup (all forms), rather than finding the FunctionDecl and then realizing it is a template. This is responsible for most of the churn, since some of the core declaration matching and lookup code assumes that all functions are FunctionDecls. llvm-svn: 74213
* patch to mark use of implicit copy constructors.Fariborz Jahanian2009-06-221-7/+15
| | | | llvm-svn: 73922
* Parsing and AST support for using declarations, from John Thompson!Douglas Gregor2009-06-201-0/+8
| | | | llvm-svn: 73812
* Patch for implementation of C++'s object model. This isFariborz Jahanian2009-06-191-1/+19
| | | | | | work in progress. llvm-svn: 73782
* Removed deadcode related to addition of constructorFariborz Jahanian2009-06-171-24/+21
| | | | | | decls to a class. llvm-svn: 73650
* If a CXXRecordDecl is a class template, the 'this' type should be the ↵Anders Carlsson2009-06-131-1/+6
| | | | | | injected class name type. Fixes pr4383. llvm-svn: 73284
* Make ParmVarDecl::getDefaultArg() more robust, it now asserts that the ↵Anders Carlsson2009-06-061-2/+2
| | | | | | argument is not unparsed. Add a new hasDefaultArg() and use it in places where getDefaultArg() was called when the argument was unparsed. llvm-svn: 72984
* Get rid of CXXTempVarDecl.Anders Carlsson2009-05-301-9/+0
| | | | llvm-svn: 72637
* Pretty printing and improved representation for namespace alias declarationsDouglas Gregor2009-05-301-2/+4
| | | | llvm-svn: 72616
* Printing for using directives, e.g.,Douglas Gregor2009-05-301-2/+4
| | | | | | | | | using namespace std::debug; Extended UsingDirectiveDecl to store the nested-name-specifier that precedes the nominated namespace. llvm-svn: 72614
* Add code for emitting C++ destructors. Not used yet.Anders Carlsson2009-05-291-0/+17
| | | | llvm-svn: 72591
* Add setters/getters to CXXMethodDecl so it can keep track of which virtual ↵Anders Carlsson2009-05-161-0/+41
| | | | | | member functions it overrides (if any) llvm-svn: 71968
* Make sure that the type associated with a class template is dependent.Douglas Gregor2009-05-151-2/+4
| | | | llvm-svn: 71878
* Silence gcc warnings.Eli Friedman2009-04-251-2/+2
| | | | llvm-svn: 70086
* Fix assert.Anders Carlsson2009-04-241-2/+4
| | | | llvm-svn: 69961
* Add the beginnings of a CXXTempVarDecl class.Anders Carlsson2009-04-211-0/+7
| | | | llvm-svn: 69652
* Add support for the __has_trivial_destructor type trait.Anders Carlsson2009-04-171-1/+1
| | | | llvm-svn: 69345
* Add support for the __has_trivial_constructor type trait.Anders Carlsson2009-04-161-0/+6
| | | | llvm-svn: 69245
* Propagate the ASTContext to various AST traversal and lookup functions.Douglas Gregor2009-04-091-2/+2
| | | | | | No functionality change (really). llvm-svn: 68726
* switch TemplateOrInstantiation to be a PointerUnion, which Chris Lattner2009-03-291-18/+0
| | | | | | simplifies some code. llvm-svn: 67993
* Create AST nodes for namespace aliases.Anders Carlsson2009-03-281-0/+10
| | | | llvm-svn: 67962
* AddAnders Carlsson2009-03-261-0/+21
| | | | | | | | | const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, AccessSpecifier AS); so we can easily add access specifiers to diagnostics. llvm-svn: 67795
* Instantiation for member classes of class templates. Note that onlyDouglas Gregor2009-03-251-1/+21
| | | | | | | | | | | the declarations of member classes are instantiated when the owning class template is instantiated. The definitions of such member classes are instantiated when a complete type is required. This change also introduces the injected-class-name into a class template specialization. llvm-svn: 67707
* Keep track of whether a class is abstract or not. This is currently only ↵Anders Carlsson2009-03-221-2/+2
| | | | | | used for the __is_abstract type trait. llvm-svn: 67461
* Some minor tweaks and additional tests for rvalue referencesDouglas Gregor2009-03-201-1/+1
| | | | llvm-svn: 67397
* Almost complete implementation of rvalue references. One bug, and a few ↵Sebastian Redl2009-03-161-4/+5
| | | | | | unclear areas. Maybe Doug can shed some light on some of the fixmes. llvm-svn: 67059
* More static_assert work. Check that the assert expr is valid and show an ↵Anders Carlsson2009-03-141-0/+17
| | | | | | error if it's false. Create the declaration and add it to the current context. llvm-svn: 66995
* Eliminate CXXClassVarDecl. It doesn't add anythingDouglas Gregor2009-03-111-6/+0
| | | | llvm-svn: 66696
* Implement the basics of implicit instantiation of class templates, inDouglas Gregor2009-03-031-0/+1
| | | | | | | | | | | | | | | | | | | | response to attempts to diagnose an "incomplete" type. This will force us to use DiagnoseIncompleteType more regularly (rather than looking at isIncompleteType), but that's also a good thing. Implicit instantiation is still very simplistic, and will create a new definition for the class template specialization (as it should) but it only actually instantiates the base classes and attaches those. Actually instantiating class members will follow. Also, instantiate the types of non-type template parameters before checking them, allowing, e.g., template<typename T, T Value> struct Constant; to work properly. llvm-svn: 65924
* Create a new TypeNodes.def file that enumerates all of the types,Douglas Gregor2009-02-261-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | giving them rough classifications (normal types, never-canonical types, always-dependent types, abstract type representations) and making it far easier to make sure that we've hit all of the cases when decoding types. Switched some switch() statements on the type class over to using this mechanism, and filtering out those things we don't care about. For example, CodeGen should never see always-dependent or non-canonical types, while debug info generation should never see always-dependent types. More switch() statements on the type class need to be moved over to using this approach, so that we'll get warnings when we add a new type then fail to account for it somewhere in the compiler. As part of this, some types have been renamed: TypeOfExpr -> TypeOfExprType FunctionTypeProto -> FunctionProtoType FunctionTypeNoProto -> FunctionNoProtoType There shouldn't be any functionality change... llvm-svn: 65591
* Added ClassTemplateSpecializationDecl, which is a subclass ofDouglas Gregor2009-02-171-3/+3
| | | | | | | | | | | | | | | | | | CXXRecordDecl that is used to represent class template specializations. These are canonical declarations that can refer to either an actual class template specialization in the code, e.g., template<> class vector<bool> { }; or to a template instantiation. However, neither of these features is actually implemented yet, so really we're just using (and uniqing) the declarations to make sure that, e.g., A<int> is a different type from A<float>. Note that we carefully distinguish between what the user wrote in the source code (e.g., "A<FLOAT>") and the semantic entity it represents (e.g., "A<float, int>"); the former is in the sugared Type, the latter is an actual Decl. llvm-svn: 64716
* Basic representation of C++ class templates, from Andrew Sutton.Douglas Gregor2009-02-041-30/+0
| | | | llvm-svn: 63750
* Semantic analysis, ASTs, and unqualified name lookup support for C++Douglas Gregor2009-02-031-0/+11
| | | | | | using directives, from Piotr Rak! llvm-svn: 63646
* Finish making AST BumpPtrAllocation runtime configurable (based on ↵Steve Naroff2009-01-271-1/+1
| | | | | | | | | | | -disable-free). snaroff% time ../../Release-Asserts/bin/clang INPUTS/Cocoa_h.m 0.179u 0.051s 0:00.23 95.6% 0+0k 0+0io 0pf+0w snaroff% time ../../Release-Asserts/bin/clang INPUTS/Cocoa_h.m -disable-free 0.169u 0.052s 0:00.22 95.4% 0+0k 0+0io 0pf+0w llvm-svn: 63153
* Remove many references to ASTContext::getAllocator(), replacing them with ↵Steve Naroff2009-01-271-21/+12
| | | | | | | | calls to the recently added placement new (which uses ASTContext's allocator for memory). Also added ASTContext::Deallocate(). This will simplify runtime replacement of ASTContext's allocator. Keeping the allocator private (and removing getAllocator() entirely) is also goodness. llvm-svn: 63135
* Remove ScopedDecl, collapsing all of its functionality into Decl, soDouglas Gregor2009-01-201-6/+4
| | | | | | | | | | | | | | | | 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. llvm-svn: 62562
* This is a large/messy diff that unifies the ObjC AST's with DeclContext.Steve Naroff2009-01-081-2/+2
| | | | | | | | | | | | | | | - 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
* Finished semantic analysis of anonymous unions in C++.Douglas Gregor2009-01-071-1/+1
| | | | | | | | | 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
* PODness and Type TraitsSebastian Redl2009-01-051-5/+81
| | | | | | | | | | | | | | | 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-051-35/+3
| | | | | | | | | | | | | | | | | | | | | | 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
* 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
* 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
* Make linkage-specifications hold on to all of their declarationsDouglas Gregor2008-12-161-0/+32
| | | | llvm-svn: 61110
* Warning fixes to operator precedence warnings.Eli Friedman2008-12-161-2/+2
| | | | | | | Someone should double-check that I didn't somehow break ObjC serialization; I think the change there actually changes the semantics. llvm-svn: 61098
* Remove tabs.Nate Begeman2008-12-161-4/+4
| | | | llvm-svn: 61097
* Place constructors and destructors into the DeclContext of the class,Douglas Gregor2008-12-151-23/+23
| | | | | | | | | | | | just like all other members, and remove the special variables in CXXRecordDecl to store them. This eliminates a lot of special-case code for constructors and destructors, including ActOnConstructor/ActOnDeclarator and special lookup rules in LookupDecl. The result is far more uniform and manageable. Diagnose the redeclaration of member functions. llvm-svn: 61048
* Unifies the name-lookup mechanisms used in various parts of the ASTDouglas Gregor2008-12-111-14/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and separates lexical name lookup from qualified name lookup. In particular: * Make DeclContext the central data structure for storing and looking up declarations within existing declarations, e.g., members of structs/unions/classes, enumerators in C++0x enums, members of C++ namespaces, and (later) members of Objective-C interfaces/implementations. DeclContext uses a lazily-constructed data structure optimized for fast lookup (array for small contexts, hash table for larger contexts). * Implement C++ qualified name lookup in terms of lookup into DeclContext. * Implement C++ unqualified name lookup in terms of qualified+unqualified name lookup (since unqualified lookup is not purely lexical in C++!) * Limit the use of the chains of declarations stored in IdentifierInfo to those names declared lexically. * Eliminate CXXFieldDecl, collapsing its behavior into FieldDecl. (FieldDecl is now a ScopedDecl). * Make RecordDecl into a DeclContext and eliminates its Members/NumMembers fields (since one can just iterate through the DeclContext to get the fields). llvm-svn: 60878
* Representation of template type parameters and non-type templateDouglas Gregor2008-12-051-1/+17
| | | | | | | | | | | | | | | parameters, with some semantic analysis: - Template parameters are introduced into template parameter scope - Complain about template parameter shadowing (except in Microsoft mode) Note that we leak template parameter declarations like crazy, a problem we'll remedy once we actually create proper declarations for templates. Next up: dependent types and value-dependent/type-dependent expressions. llvm-svn: 60597
* Implement effects of 'mutable', and a few comments from Chris on its parsing.Sebastian Redl2008-11-171-2/+2
| | | | llvm-svn: 59470
OpenPOWER on IntegriCloud