summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remember declaration scope qualifiers in the AST. Imposes no memory overheadJohn McCall2010-03-151-2/+1
| | | | | | | | | | | on unqualified declarations. Patch by Enea Zaffanella! Minimal adjustments: allocate the ExtInfo nodes with the ASTContext and delete them during Destroy(). I audited a bunch of Destroy methods at the same time, to ensure that the correct teardown was being done. llvm-svn: 98540
* Remember access paths for visible conversion decls.John McCall2010-03-151-108/+121
| | | | llvm-svn: 98539
* Implement basic support for friend types and functions in non-dependentJohn McCall2010-03-121-1/+1
| | | | | | contexts. llvm-svn: 98321
* Split C++ friend declarations into their own header/implementation file.John McCall2010-03-111-22/+0
| | | | | | | | | I'm expecting this portion of the AST to grow and change, and I'd like to be able to do that with minimal recompilation. If this proves unnecessary when access control is fully-implemented, I'll fold the classes back into DeclCXX.h. llvm-svn: 98249
* Create a new InjectedClassNameType to represent bare-word references to the John McCall2010-03-101-5/+10
| | | | | | | | | | | | | injected class name of a class template or class template partial specialization. This is a non-canonical type; the canonical type is still a template specialization type. This becomes the TypeForDecl of the pattern declaration, which cleans up some amount of code (and complicates some other parts, but whatever). Fixes PR6326 and probably a few others, primarily by re-establishing a few invariants about TypeLoc sizes. llvm-svn: 98134
* Eliminate the static map of overridden C++ methods, which was going toDouglas Gregor2010-03-021-34/+3
| | | | | | come back to bite us at some point. llvm-svn: 97607
* Skip dependent virtual base classes; fixes PR6413.Douglas Gregor2010-02-271-3/+4
| | | | llvm-svn: 97291
* Implement semantic analysis for C++ [expr.new]p18-20, which describeDouglas Gregor2010-02-261-1/+7
| | | | | | | | | | how we find the operator delete that matches withe operator new we found in a C++ new-expression. This will also need CodeGen support. On a happy note, we're now a "nans" away from building tramp3d-v4. llvm-svn: 97209
* Perform two more constructor/destructor code-size optimizations:John McCall2010-02-231-2/+2
| | | | | | | | | | | | | | | | 1) emit base destructors as aliases to their unique base class destructors under some careful conditions. This is enabled for the same targets that can support complete-to-base aliases, i.e. not darwin. 2) Emit non-variadic complete constructors for classes with no virtual bases as calls to the base constructor. This is enabled on all targets and in theory can trigger in situations that the alias optimization can't (mostly involving virtual bases, mostly not yet supported). These are bundled together because I didn't think it worthwhile to split them, not because they really need to be. llvm-svn: 96842
* Remove another redundant ASTContext parameterDouglas Gregor2010-02-111-2/+3
| | | | llvm-svn: 95843
* Ensure that a operator delete overload is rocognized regardless of cv-quals.Chandler Carruth2010-02-081-1/+2
| | | | llvm-svn: 95553
* Extract a common structure for holding information about the definitionJohn McCall2010-02-041-35/+43
| | | | | | | | of a C++ record. Exposed a lot of problems where various routines were silently doing The Wrong Thing (or The Acceptable Thing in The Wrong Order) when presented with a non-definition. Also cuts down on memory usage. llvm-svn: 95330
* Rework base and member initialization in constructors, with severalDouglas Gregor2010-01-311-25/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (necessarily simultaneous) changes: - CXXBaseOrMemberInitializer now contains only a single initializer rather than a set of initialiation arguments + a constructor. The single initializer covers all aspects of initialization, including constructor calls as necessary but also cleanup of temporaries created by the initializer (which we never handled before!). - Rework + simplify code generation for CXXBaseOrMemberInitializers, since we can now just emit the initializer as an initializer. - Switched base and member initialization over to the new initialization code (InitializationSequence), so that it - Improved diagnostics for the new initialization code when initializing bases and members, to match the diagnostics produced by the previous (special-purpose) code. - Simplify the representation of type-checked constructor initializers in templates; instead of keeping the fully-type-checked AST, which is rather hard to undo at template instantiation time, throw away the type-checked AST and store the raw expressions in the AST. This simplifies instantiation, but loses a little but of information in the AST. - When type-checking implicit base or member initializers within a dependent context, don't add the generated initializers into the AST, because they'll look like they were explicit. - Record in CXXConstructExpr when the constructor call is to initialize a base class, so that CodeGen does not have to infer it from context. This ensures that we call the right kind of constructor. There are also a few "opportunity" fixes here that were needed to not regress, for example: - Diagnose default-initialization of a const-qualified class that does not have a user-declared default constructor. We had this diagnostic specifically for bases and members, but missed it for variables. That's fixed now. - When defining the implicit constructors, destructor, and copy-assignment operator, set the CurContext to that constructor when we're defining the body. llvm-svn: 94952
* Add an assert to make sure that we don't try to mess with overridden methods ↵Anders Carlsson2010-01-301-1/+3
| | | | | | for class templates. llvm-svn: 94907
* Give UnresolvedSet the ability to store access specifiers for each declaration.John McCall2010-01-201-5/+7
| | | | | | | Change LookupResult to use UnresolvedSet. Also extract UnresolvedSet into its own header and make it templated over an inline capacity. llvm-svn: 93959
* When qualified lookup into the current instantiation fails (because itDouglas Gregor2010-01-141-0/+13
| | | | | | | | finds nothing), and the current instantiation has dependent base classes, treat the qualified lookup as if it referred to an unknown specialization. Fixes PR6031. llvm-svn: 93433
* Improve key-function computation for templates. In particular:Douglas Gregor2010-01-051-15/+7
| | | | | | | | | | | | | | | | - All classes can have a key function; templates don't change that. non-template classes when computing the key function. - We always mark all of the virtual member functions of class template instantiations. - The vtable for an instantiation of a class template has weak linkage. We could probably use available_externally linkage for vtables of classes instantiated by explicit instantiation declarations (extern templates), but GCC doesn't do this and I'm not 100% that the ABI permits it. llvm-svn: 92753
* Eliminate the ASTContext argument to CXXConstructorDecl::isCopyConstructor, ↵Douglas Gregor2009-12-221-5/+5
| | | | | | since the context is available in the Decl llvm-svn: 91862
* Patch over yet more problems with friend declarations which were provokingJohn McCall2009-12-171-1/+5
| | | | | | | problems on LLVM-Code-Syntax. This proved remarkably easy to "fix" once I settled on how I was going to approach it. llvm-svn: 91633
* getTemplateSpecializationKind should be const.Anders Carlsson2009-12-071-2/+2
| | | | llvm-svn: 90750
* DeclaratorInfo -> TypeSourceInfo. Makes an effort to rename associated ↵John McCall2009-12-071-11/+11
| | | | | | | | | | | | | | | | | | | | | variables, but the results are imperfect. For posterity, I did: cat <<EOF > $cmdfile s/DeclaratorInfo/TypeSourceInfo/g s/DInfo/TInfo/g s/TypeTypeSourceInfo/TypeSourceInfo/g s/SourceTypeSourceInfo/TypeSourceInfo/g EOF find lib -name '*.cpp' -not -path 'lib/Parse/*' -exec sed -i '' -f $cmdfile '{}' \; find lib -name '*.h' -exec sed -i '' -f $cmdfile '{}' \; find include -name '*.h' -not -path 'include/clang/Parse/*' -not -path 'include/clang/Basic/*' -exec sed -i '' -f $cmdfile '{}' \; llvm-svn: 90743
* Move helper onto CXXMethodDecl.Eli Friedman2009-12-061-0/+19
| | | | llvm-svn: 90716
* Make sure that overridden method decls are always canonical.Anders Carlsson2009-12-041-0/+2
| | | | llvm-svn: 90542
* A new helper function to set various bits in the class whenFariborz Jahanian2009-12-031-0/+12
| | | | | | | a new virtual function is declared/instantiated. it is used in couple of places. llvm-svn: 90470
* Improve source location information for C++ member initializers in aDouglas Gregor2009-12-021-22/+56
| | | | | | | constructor, by keeping the DeclaratorInfo* rather than just the type and a single location. llvm-svn: 90355
* In Sema, whenever we think that a function is going to cause a vtable to be ↵Anders Carlsson2009-12-021-3/+2
| | | | | | generated, we mark any virtual implicit member functions as referenced. llvm-svn: 90327
* r90313, in which OverloadedFunctionDecl is removed and never spoken of again.John McCall2009-12-021-58/+0
| | | | llvm-svn: 90313
* Let using directives refer to namespace aliases. Fixes PR5479.Sebastian Redl2009-11-231-1/+12
| | | | llvm-svn: 89657
* "Incremental" progress on using expressions, by which I mean totally rippingJohn McCall2009-11-211-21/+12
| | | | | | | | | | | | | | | | | | | | | | into pretty much everything about overload resolution in order to wean BuildDeclarationNameExpr off LookupResult::getAsSingleDecl(). Replace UnresolvedFunctionNameExpr with UnresolvedLookupExpr, which generalizes the idea of a non-member lookup that we haven't totally resolved yet, whether by overloading, argument-dependent lookup, or (eventually) the presence of a function template in the lookup results. Incidentally fixes a problem with argument-dependent lookup where we were still performing ADL even when the lookup results contained something from a block scope. Incidentally improves a diagnostic when using an ObjC ivar from a class method. This just fell out from rewriting BuildDeclarationNameExpr's interaction with lookup, and I'm too apathetic to break it out. The only remaining uses of OverloadedFunctionDecl that I know of are in TemplateName and MemberExpr. llvm-svn: 89544
* Incremental progress on using declarations. Split UnresolvedUsingDecl intoJohn McCall2009-11-181-9/+24
| | | | | | | | | | two classes, one for typenames and one for values; this seems to have some support from Doug if not necessarily from the extremely-vague-on-this-point standard. Track the location of the 'typename' keyword in a using-typename decl. Make a new lookup result for unresolved values and deal with it in most places. llvm-svn: 89184
* Instead of hanging a using declaration's target decls directly off the using John McCall2009-11-171-5/+4
| | | | | | | decl, create shadow declarations and put them in scope like normal. Work in progress. llvm-svn: 89048
* Unify the way destructor epilogues are generated for synthesized and regular ↵Anders Carlsson2009-11-171-6/+0
| | | | | | destructors. Also fix PR5529. llvm-svn: 89034
* First part of changes to eliminate problems with cv-qualifiers andDouglas Gregor2009-11-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sugared types. The basic problem is that our qualifier accessors (getQualifiers, getCVRQualifiers, isConstQualified, etc.) only look at the current QualType and not at any qualifiers that come from sugared types, meaning that we won't see these qualifiers through, e.g., typedefs: typedef const int CInt; typedef CInt Self; Self.isConstQualified() currently returns false! Various bugs (e.g., PR5383) have cropped up all over the front end due to such problems. I'm addressing this problem by splitting each qualifier accessor into two versions: - the "local" version only returns qualifiers on this particular QualType instance - the "normal" version that will eventually combine qualifiers from this QualType instance with the qualifiers on the canonical type to produce the full set of qualifiers. This commit adds the local versions and switches a few callers from the "normal" version (e.g., isConstQualified) over to the "local" version (e.g., isLocalConstQualified) when that is the right thing to do, e.g., because we're printing or serializing the qualifiers. Also, switch a bunch of Context.getCanonicalType(T1).getUnqualifiedType() == Context.getCanonicalType(T2).getQualifiedType() expressions over to Context.hasSameUnqualifiedType(T1, T2) llvm-svn: 88969
* If we attempt to add a constructor template specialization that looksDouglas Gregor2009-11-141-0/+27
| | | | | | | | | | | | like a copy constructor to the overload set, just ignore it. This ensures that we don't try to use such a constructor as a copy constructor *without* triggering diagnostics at the point of declaration. Note that we *do* diagnose such copy constructors when explicitly written by the user (e.g., as an explicit specialization). llvm-svn: 88733
* Revert r88718, which does NOT solve the ↵Douglas Gregor2009-11-131-8/+8
| | | | | | constructor-template-as-copy-constructor issue. Big thanks to John for finding this llvm-svn: 88724
* A constructor template cannot be instantiated to a copyDouglas Gregor2009-11-131-8/+8
| | | | | | constructor. Make sure that such declarations can never be formed. llvm-svn: 88718
* Make sure isCopyAssignment is only true for actual copy assignment operators,Eli Friedman2009-11-071-0/+3
| | | | | | | | instead of all assignment operators. The mistake messes up IRGen because it ends up assuming that the assignment operator is actually the implicit copy assignment operator, and therefore tries to emit the RHS as an lvalue. llvm-svn: 86307
* When looking for a copy-assignment operator to determine the cv-qualifiers ↵Douglas Gregor2009-10-301-1/+4
| | | | | | on its argument type, ignore assignment operator templates llvm-svn: 85629
* Audit the code for places where it is assumed that every base specifier ↵Sebastian Redl2009-10-251-16/+18
| | | | | | refers to a RecordType. Add assertions or conditions as appropriate. This fixes another crash in the Apache stdlib vector. llvm-svn: 85055
* Member function templates (and instantiations/specializations thereof)Douglas Gregor2009-10-131-2/+10
| | | | | | are never copy constructors or copy assignment operators. llvm-svn: 84057
* Diagnose the declaration of explicit specializations after an implicitDouglas Gregor2009-10-121-6/+7
| | | | | | | instantiation has already been required. To do so, keep track of the point of instantiation for anything that can be instantiated. llvm-svn: 83890
* Use CanQualType (instead of QualType) to store collection of visibleFariborz Jahanian2009-10-121-7/+9
| | | | | | canonical conversion types. llvm-svn: 83869
* Refactoring to further simplify collection of visible conversionFariborz Jahanian2009-10-081-22/+16
| | | | | | functions. llvm-svn: 83552
* Improve checking for specializations of member classes of classDouglas Gregor2009-10-081-0/+47
| | | | | | | | | | | templates, and keep track of how those member classes were instantiated or specialized. Make sure that we don't try to instantiate an explicitly-specialized member class of a class template, when that explicit specialization was a declaration rather than a definition. llvm-svn: 83547
* Fixes problem in finding visible convertion functions of a classFariborz Jahanian2009-10-071-29/+63
| | | | | | | | where matching conversion types in base classes were still visible. Plus refactoring and cleanup. Added a test case. llvm-svn: 83485
* Handle C++ delete expressions when the overloaded delete operator is aDouglas Gregor2009-09-291-0/+34
| | | | | | | | | | | "usual deallocation function" with two arguments. CodeGen will have to handle this case specifically, since the value for the second argument (the size of the allocated object) may have to be computed at run time. Fixes the Sema part of PR4782. llvm-svn: 83080
* Refactor the representation of qualifiers to bring ExtQualType out of theJohn McCall2009-09-241-4/+7
| | | | | | | | Type hierarchy. Demote 'volatile' to extended-qualifier status. Audit our use of qualifiers and fix a few places that weren't dealing with qualifiers quite right; many more remain. llvm-svn: 82705
* Change all the Type::getAsFoo() methods to specializations of Type::getAs().John McCall2009-09-211-3/+3
| | | | | | | | | | | Several of the existing methods were identical to their respective specializations, and so have been removed entirely. Several more 'leaf' optimizations were introduced. The getAsFoo() methods which imposed extra conditions, like getAsObjCInterfacePointerType(), have been left in place. llvm-svn: 82501
* In building list of visible conversion functions, useFariborz Jahanian2009-09-151-2/+2
| | | | | | result type of template convesion functions. llvm-svn: 81943
* 1) don't do overload resolution in selecting conversionFariborz Jahanian2009-09-151-2/+3
| | | | | | | | to pointer function for delete expression. 2) Treat type conversion function and its 'const' version as identical in building the visible conversion list. llvm-svn: 81930
OpenPOWER on IntegriCloud