summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Keep track in chained PCH of implicit members that were added after the ↵Argyrios Kyrtzidis2010-10-241-6/+5
| | | | | | definition was completed. llvm-svn: 117240
* Put the mechanism in place to track modifications in an AST entity that were ↵Argyrios Kyrtzidis2010-10-241-0/+1
| | | | | | | | | | | | committed after its initial creation/deserialization and store the changes in a chained PCH. The idea is that the AST entities call methods on the ASTMutationListener to give notifications of changes; the PCHWriter implements the ASTMutationListener interface and stores the incremental changes of the updated entity. WIP llvm-svn: 117235
* Pass TInfo to CXXDestructorDecl::Create(), just like we do for otherCraig Silverstein2010-10-211-3/+4
| | | | | | | | function decls. Reviewed by rjmccall and nlewycky. llvm-svn: 116979
* When implicit members are added to a C++ record, notify the serializer so ↵Argyrios Kyrtzidis2010-10-201-0/+7
| | | | | | | | that a chained PCH writes the definition again. Thanks to Doug for the hint! llvm-svn: 116975
* Move the management of the set of conversion functions in a C++ classDouglas Gregor2010-09-291-0/+36
| | | | | | | | | | into CXXRecordDecl. The only part that we do not handle this way are using declarations, since that would require extra name lookup that we don't currently want to pay for. This fixes <rdar://problem/8459981>, so that LLDB can build a CXXRecordDecl and magically get all of the right bits set. llvm-svn: 115026
* Move the maintenance of CXXRecordDecl::DefinitionData's Abstract bitDouglas Gregor2010-09-291-0/+58
| | | | | | | | | | | completely into CXXRecordDecl, by adding a new completeDefinition() function. This required a little reshuffling of the final-overrider checking code, since the "abstract" calculation in the presence of abstract base classes needs to occur in CXXRecordDecl::completeDefinition() but we don't want to compute final overriders more than one in the common case. llvm-svn: 115007
* Teach FunctionDecl::setPure() to (indirectly) mark the Abstract bit inDouglas Gregor2010-09-281-2/+7
| | | | | | CXXRecordDecl::DefinitionData, rather than having Sema mark the bit. llvm-svn: 114993
* Reinstate r114925 and r114929, both steps towardDouglas Gregor2010-09-281-8/+78
| | | | | | <rdar://problem/8459981>. llvm-svn: 114984
* Centralize the management of CXXRecordDecl::DefinitionData's Empty bitDouglas Gregor2010-09-281-7/+38
| | | | | | | | | | | | in CXXRecordDecl itself. Yes, this is also part of <rdar://problem/8459981>. This reinstates r114924, with one crucial bug fix: we were ignoring the implicit fields created by anonymous structs/unions when updating the bits in CXXRecordDecl, which means that a class/struct containing only an anonymous class/struct would be considered "empty". Hilarity follows. llvm-svn: 114980
* Reinstate r114921, which I've exonerated via a self-host build.Douglas Gregor2010-09-281-2/+48
| | | | | | | | Centralize the management of CXXRecordDecl::DefinitionData's Aggregate and PlainOldData bits in CXXRecordDecl itself. Another milepost on the road toward <rdar://problem/8459981>. llvm-svn: 114977
* Temporarily revert 114929 114925 114924 114921. It looked like they (or at leastBill Wendling2010-09-281-153/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | one of them) was causing a series of failures: http://google1.osuosl.org:8011/builders/clang-x86_64-darwin10-selfhost/builds/4518 svn merge -c -114929 https://llvm.org/svn/llvm-project/cfe/trunk --- Reverse-merging r114929 into '.': U include/clang/Sema/Sema.h U include/clang/AST/DeclCXX.h U lib/Sema/SemaDeclCXX.cpp U lib/Sema/SemaTemplateInstantiateDecl.cpp U lib/Sema/SemaDecl.cpp U lib/Sema/SemaTemplateInstantiate.cpp U lib/AST/DeclCXX.cpp svn merge -c -114925 https://llvm.org/svn/llvm-project/cfe/trunk --- Reverse-merging r114925 into '.': G include/clang/AST/DeclCXX.h G lib/Sema/SemaDeclCXX.cpp G lib/AST/DeclCXX.cpp svn merge -c -114924 https://llvm.org/svn/llvm-project/cfe/trunk --- Reverse-merging r114924 into '.': G include/clang/AST/DeclCXX.h G lib/Sema/SemaDeclCXX.cpp G lib/Sema/SemaDecl.cpp G lib/AST/DeclCXX.cpp U lib/AST/ASTContext.cpp svn merge -c -114921 https://llvm.org/svn/llvm-project/cfe/trunk --- Reverse-merging r114921 into '.': G include/clang/AST/DeclCXX.h G lib/Sema/SemaDeclCXX.cpp G lib/Sema/SemaDecl.cpp G lib/AST/DeclCXX.cpp llvm-svn: 114933
* Centralize the management of CXXRecordDecl::DefinitionData'sDouglas Gregor2010-09-281-7/+67
| | | | | | | | | | | HasTrivialConstructor, HasTrivialCopyConstructor, HasTrivialCopyAssignment, and HasTrivialDestructor bits in CXXRecordDecl's methods. This completes all but the Abstract bit and the set of conversion functions, both of which will require a bit of extra work. The majority of <rdar://problem/8459981> is now implemented (but not all of it). llvm-svn: 114929
* Centralize the management of CXXRecordDecl::DefinitionData'sDouglas Gregor2010-09-271-1/+11
| | | | | | | Polymorphic bit in CXXRecordDecl itself. Yes, this is also part of <rdar://problem/8459981>. llvm-svn: 114925
* Centralize the management of CXXRecordDecl::DefinitionData's Empty bitDouglas Gregor2010-09-271-2/+27
| | | | | | in CXXRecordDecl itself. Yes, this is also part of <rdar://problem/8459981>. llvm-svn: 114924
* Centralize the management of CXXRecordDecl::DefinitionData's AggregateDouglas Gregor2010-09-271-2/+48
| | | | | | | and PlainOldData bits in CXXRecordDecl itself. Another milepost on the road toward <rdar://problem/8459981>. llvm-svn: 114921
* Centralize the handling of CXXRecordDecl::DefinitionData'sDouglas Gregor2010-09-271-4/+10
| | | | | | | DeclaredDestructor and UserDeclaredDestructor bits in CXXRecordDecl itself. Another step on the road to <rdar://problem/8459981>. llvm-svn: 114918
* Kill FunctionDecl's IsCopyAssignment bit; it duplicated what couldDouglas Gregor2010-09-271-5/+2
| | | | | | | | already be determined by isCopyAssignmentOperator(), and was set too late in the process for all clients to see the appropriate value. Cleanup only; no functionality change. llvm-svn: 114916
* Centralize the handling ofDouglas Gregor2010-09-271-81/+108
| | | | | | | CXXRecordDecl::DefinitionData::DeclaredCopyAssignment, for copy-assignment operators. Another step toward <rdar://problem/8459981>. llvm-svn: 114899
* Clean up the handling of the DeclaredDefaultConstructor andDouglas Gregor2010-09-271-5/+21
| | | | | | | | | | | | | DeclaredCopyConstructor bits in CXXRecordDecl's DefinitionData structure. Rather than having Sema call addedConstructor or set the bits directly at semi-random places, move all of the logic for managing these bits into CXXRecordDecl itself and tie the addedConstructor call into DeclContext::addDecl(). This makes it easier for AST-building clients to get the right bits set in DefinitionData, and is one small part of <rdar://problem/8459981>. llvm-svn: 114889
* Remove CXXRecordDecl::getDefaultConstructor(), an inherently unsafe function ↵Sebastian Redl2010-09-131-22/+0
| | | | | | due to lazy declaration of default constructors. Now that __has_nothrow_constructor doesn't use it anymore, part of PR8101 is fixed. llvm-svn: 113794
* Implement __has_virtual_destructor. Patch by Steven Watanabe.Sebastian Redl2010-09-021-1/+2
| | | | llvm-svn: 112905
* Implement libclang support for using directives (cursor + visitation +Douglas Gregor2010-09-011-8/+2
| | | | | | | | suppressing USRs). Also, fix up the source location information for using directives so that the declaration location refers to the namespace name. llvm-svn: 112693
* Added locations and type source info for DeclarationName inside UsingDecl.Abramo Bagnara2010-08-121-8/+7
| | | | llvm-svn: 110912
* Added locations and type source info for DeclarationName.Abramo Bagnara2010-08-111-14/+19
| | | | llvm-svn: 110860
* Add source location information to C++ base specifiers.Nick Lewycky2010-07-261-8/+6
| | | | llvm-svn: 109396
* Remove destructors from declaration nodesDouglas Gregor2010-07-251-6/+0
| | | | llvm-svn: 109380
* Remove the vast majority of the Destroy methods from the AST library,Douglas Gregor2010-07-251-28/+0
| | | | | | since we aren't going to be calling them ever. llvm-svn: 109377
* Introduce Decl::hasBody() and FunctionDecl::hasBody() and use them instead ↵Argyrios Kyrtzidis2010-07-071-1/+1
| | | | | | | | of getBody() when we are just checking the existence of a body, to avoid de-serialization of the body from PCH. Makes de-serialization of the function body even more "lazier". llvm-svn: 107768
* Read/write more information of ASTContext for PCH. Overriden methods and ↵Argyrios Kyrtzidis2010-07-041-0/+4
| | | | | | instantiated-from information. llvm-svn: 107597
* Lazily declare default constructors. We now delay the construction ofDouglas Gregor2010-07-031-1/+4
| | | | | | | | | | | | | | | | | | declarations for implicit default constructors, copy constructors, copy assignment operators, and destructors. On a "simple" translation unit that includes a bunch of C++ standard library headers, we generate relatively few of these implicit declarations now: 4/159 implicit default constructors created 18/236 implicit copy constructors created 70/241 implicit copy assignment operators created 0/173 implicit destructors created And, on this translation unit, this optimization doesn't really provide any benefit. I'll do some more performance measurements soon, but this completes the implementation work for <rdar://problem/8151045>. llvm-svn: 107551
* Lazily declare implicit copy constructors.Douglas Gregor2010-07-021-1/+4
| | | | llvm-svn: 107543
* Lazily declare copy-assignment operators.Douglas Gregor2010-07-021-49/+3
| | | | llvm-svn: 107521
* Lazily declare the implicitly-declared destructor in a C++ class.Douglas Gregor2010-07-021-0/+1
| | | | llvm-svn: 107510
* Add some side-effect free Create methods for TypeDecl subclasses and use ↵Argyrios Kyrtzidis2010-07-021-0/+5
| | | | | | them for PCH reading. llvm-svn: 107468
* Provide exception specifications for implicitly-declared default constructors.Douglas Gregor2010-07-011-1/+2
| | | | llvm-svn: 107437
* Provide exception specifications for implicitly-declared copy constructors.Douglas Gregor2010-07-011-27/+32
| | | | llvm-svn: 107429
* Provide an exception-specification for an implicitly-declaredDouglas Gregor2010-07-011-0/+73
| | | | | | copy-assignment operator. llvm-svn: 107406
* Remove unnecessary ASTContext parameter fromDouglas Gregor2010-07-011-1/+2
| | | | | | CXXRecordDecl::getDestructor(); no functionality change. llvm-svn: 107394
* Added source order to CXXBaseOrMemberInitializer.Abramo Bagnara2010-05-261-7/+8
| | | | llvm-svn: 104712
* Renamed misleading getSourceRange -> getLocalSourceRange and ↵Abramo Bagnara2010-05-201-1/+1
| | | | | | getFullSourceRange -> getSourceRange for TypeLoc. llvm-svn: 104220
* Merged Elaborated and QualifiedName types.Abramo Bagnara2010-05-111-1/+1
| | | | llvm-svn: 103517
* add PCH support for a bunch of C++ Decls, patch byChris Lattner2010-05-071-0/+24
| | | | | | Andrew Sutton! llvm-svn: 103301
* Reimplement code generation for copying fields in theDouglas Gregor2010-05-051-3/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implicitly-generated copy constructor. Previously, Sema would perform some checking and instantiation to determine which copy constructors, etc., would be called, then CodeGen would attempt to figure out which copy constructor to call... but would get it wrong, or poke at an uninstantiated default argument, or fail in other ways. The new scheme is similar to what we now do for the implicit copy-assignment operator, where Sema performs all of the semantic analysis and builds specific ASTs that look similar to the ASTs we'd get from explicitly writing the copy constructor, so that CodeGen need only do a direct translation. However, it's not quite that simple because one cannot explicit write elementwise copy-construction of an array. So, I've extended CXXBaseOrMemberInitializer to contain a list of indexing variables used to copy-construct the elements. For example, if we have: struct A { A(const A&); }; struct B { A array[2][3]; }; then we generate an implicit copy assignment operator for B that looks something like this: B::B(const B &other) : array[i0][i1](other.array[i0][i1]) { } CodeGen will loop over the invented variables i0 and i1 to visit all elements in the array, so that each element in the destination array will be copy-constructed from the corresponding element in the source array. Of course, if we're dealing with arrays of scalars or class types with trivial copy-assignment operators, we just generate a memcpy rather than a loop. Fixes PR6928, PR5989, and PR6887. Boost.Regex now compiles and passes all of its regression tests. Conspicuously missing from this patch is handling for the exceptional case, where we need to destruct those objects that we have constructed. I'll address that case separately. llvm-svn: 103079
* Complete reimplementation of the synthesis for implicitly-defined copyDouglas Gregor2010-05-011-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | assignment operators. Previously, Sema provided type-checking and template instantiation for copy assignment operators, then CodeGen would synthesize the actual body of the copy constructor. Unfortunately, the two were not in sync, and CodeGen might pick a copy-assignment operator that is different from what Sema chose, leading to strange failures, e.g., link-time failures when CodeGen called a copy-assignment operator that was not instantiation, run-time failures when copy-assignment operators were overloaded for const/non-const references and the wrong one was picked, and run-time failures when by-value copy-assignment operators did not have their arguments properly copy-initialized. This implementation synthesizes the implicitly-defined copy assignment operator bodies in Sema, so that the resulting ASTs encode exactly what CodeGen needs to do; there is no longer any special code in CodeGen to synthesize copy-assignment operators. The synthesis of the body is relatively simple, and we generate one of three different kinds of copy statements for each base or member: - For a class subobject, call the appropriate copy-assignment operator, after overload resolution has determined what that is. - For an array of scalar types or an array of class types that have trivial copy assignment operators, construct a call to __builtin_memcpy. - For an array of class types with non-trivial copy assignment operators, synthesize a (possibly nested!) for loop whose inner statement calls the copy constructor. - For a scalar type, use built-in assignment. This patch fixes at least a few tests cases in Boost.Spirit that were failing because CodeGen picked the wrong copy-assignment operator (leading to link-time failures), and I suspect a number of undiagnosed problems will also go away with this change. Some of the diagnostics we had previously have gotten worse with this change, since we're going through generic code for our type-checking. I will improve this in a subsequent patch. llvm-svn: 102853
* Make the InjectedClassNameType the canonical type of the current instantiationJohn McCall2010-04-271-9/+0
| | | | | | | | | | | | | | | | of a class template or class template partial specialization. That is to say, in template <class T> class A { ... }; or template <class T> class B<const T*> { ... }; make 'A<T>' and 'B<const T*>' sugar for the corresponding InjectedClassNameType when written inside the appropriate context. This allows us to track the current instantiation appropriately even inside AST routines. It also allows us to compute a DeclContext for a type much more efficiently, at some extra cost every time we write a template specialization (which can be optimized, but I've left it simple in this patch). llvm-svn: 102407
* Keep track of the actual storage specifier written on a variable orDouglas Gregor2010-04-191-7/+7
| | | | | | | | function declaration, since it may end up being changed (e.g., "extern" can become "static" if a prior declaration was static). Patch by Enea Zaffanella and Paolo Bolzoni. llvm-svn: 101826
* Have the CXXBaseOrMemberInitializer keep track of whether an initializer ↵Anders Carlsson2010-04-121-2/+2
| | | | | | initializes a virtual base or not. llvm-svn: 101004
* Regularize support for naming conversion functions in using decls.John McCall2010-03-311-13/+34
| | | | llvm-svn: 99979
* When collecting virtual bases it's very important to use the canonical type ↵Anders Carlsson2010-03-291-3/+3
| | | | | | of the base class. Otherwise, we might add the same virtual base class twice if the virtual base is an instantiated template. Fixes PR6251. llvm-svn: 99829
* Fix a nasty bug in the virtual base computation which would lead to us ↵Anders Carlsson2010-03-291-49/+37
| | | | | | initializing virtual bases in the wrong order. llvm-svn: 99806
OpenPOWER on IntegriCloud