summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Revert r120063, it was wrong.John McCall2010-11-291-2/+2
| | | | llvm-svn: 120296
* Minor whitespace and comment fixes. No functionality change.Nico Weber2010-11-281-1/+1
| | | | llvm-svn: 120266
* Redeclarations of using declarations are not okay in function scopes.John McCall2010-11-231-2/+2
| | | | | | | | Not sure what I was thinking before. Fixes PR8668. llvm-svn: 120063
* Major anonymous union/struct redesign.Francois Pichet2010-11-211-10/+15
| | | | | | | | | | | A new AST node is introduced: def IndirectField : DDecl<Value>; IndirectFields are injected into the anonymous's parent scope and chain back to the original field. Name lookup for anonymous entities now result in an IndirectFieldDecl instead of a FieldDecl. There is no functionality change, the code generated should be the same. llvm-svn: 119919
* A bundle of whitespace changes, separated out from the functional changes.Nick Lewycky2010-11-201-7/+7
| | | | llvm-svn: 119886
* Refactoring.Argyrios Kyrtzidis2010-11-191-4/+4
| | | | | | Move ErrorTrap from clang/Sema to clang/Basic as DiagnosticErrorTrap and use it in Scope. llvm-svn: 119763
* Add an assertion, fix a whole bunch of bugs, comment the assertionJohn McCall2010-11-181-5/+5
| | | | | | out because there are still bugs left. llvm-svn: 119722
* Calculate the value kind of an expression when it's created andJohn McCall2010-11-181-18/+17
| | | | | | | | | | | | | store it on the expression node. Also store an "object kind", which distinguishes ordinary "addressed" l-values (like variable references and pointer dereferences) and bitfield, @property, and vector-component l-values. Currently we're not using these for much, but I aim to switch pretty much everything calculating l-valueness over to them. For now they shouldn't necessarily be trusted. llvm-svn: 119685
* Region-allocate all AttributeList objects from a factory object instead of ↵Ted Kremenek2010-11-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | manually managing them using new/delete and OwningPtrs. After memory profiling Clang, I witnessed periodic leaks of these objects; digging deeper into the code, it was clear that our management of these objects was a mess. The ownership rules were murky at best, and not always followed. Worse, there are plenty of error paths where we could screw up. This patch introduces AttributeList::Factory, which is a factory class that creates AttributeList objects and then blows them away all at once. While conceptually simple, most of the changes in this patch just have to do with migrating over to the new interface. Most of the changes have resulted in some nice simplifications. This new strategy currently holds on to all AttributeList objects during the lifetime of the Parser object. This is easily tunable. If we desire to have more bound the lifetime of AttributeList objects more precisely, we can have the AttributeList::Factory object (in Parser) push/pop its underlying allocator as we enter/leave key methods in the Parser. This means that we get simple memory management while still having the ability to finely control memory use if necessary. Note that because AttributeList objects are now BumpPtrAllocated, we may reduce malloc() traffic in many large files with attributes. This fixes the leak reported in: <rdar://problem/8650003> llvm-svn: 118675
* Diagnose attempst to template using declarations and using directives.John McCall2010-11-101-8/+12
| | | | | | Recover from the latter and fail early for the former. Fixes PR8022. llvm-svn: 118669
* tidy upChris Lattner2010-11-091-5/+4
| | | | llvm-svn: 118626
* Fix source locations in unnamed bitfield diagnostic, from JakubDouglas Gregor2010-11-091-0/+5
| | | | | | Wieczorek! Fixes PR8025. llvm-svn: 118481
* Check for an invalid field earlier in a constructor's initializationDouglas Gregor2010-11-051-3/+3
| | | | | | | | | | | of that field. Otherwise, we can end up building and later trying to instantiate a dependent member initializer that will fail at instantiation time. Unfortunately, I've only managed to trigger this bug with very large sources, so there's no test case :( llvm-svn: 118306
* No really, we don't have a retain/release system for statements/expressionsJohn McCall2010-10-261-11/+3
| | | | | | anymore. llvm-svn: 117357
* Improve the tracking of source locations for parentheses in constructor calls.Chandler Carruth2010-10-251-5/+10
| | | | | | | | | | | | This adds them where missing, and traces them through PCH. We fix at least one bug in the extents found by the Index library, and make a lot of refactoring tools which care about the exact formulation of a constructor call easier to write. Also some minor cleanups to more consistently follow the friend pattern instead of the setter pattern when rebuilding a serialized AST. Patch originally by Samuel Benzaquen. llvm-svn: 117254
* When performing name lookup for a namespace definition, only look intoDouglas Gregor2010-10-221-9/+11
| | | | | | | the current context's redeclaration context, ignoring using directives. Fixes PR8430. llvm-svn: 117097
* Pass TInfo to CXXDestructorDecl::Create(), just like we do for otherCraig Silverstein2010-10-211-1/+1
| | | | | | | | function decls. Reviewed by rjmccall and nlewycky. llvm-svn: 116979
* Redirect templated friend class decls to a new Sema callback andJohn McCall2010-10-191-0/+104
| | | | | | | construct an unsupported friend when there's a friend with a templated scope specifier. Fixes a consistency crash, rdar://problem/8540527 llvm-svn: 116786
* Reformatting.John McCall2010-10-161-2/+2
| | | | llvm-svn: 116662
* White-listing templated-scope friend decls is a good idea, but doing itJohn McCall2010-10-161-0/+11
| | | | | | | | by marking the decl invalid isn't. Make some steps towards supporting these and then hastily shut them down at the last second by marking them as unsupported. llvm-svn: 116661
* Diagnose C++ [class.mem]p13-14, where a class member has the same nameDouglas Gregor2010-10-151-0/+21
| | | | | | as the class itself. Fixes PR7082. llvm-svn: 116573
* Death to blocks, or at least the word "block" in one particular obnoxiouslyJohn McCall2010-10-151-1/+1
| | | | | | ambiguous context. llvm-svn: 116567
* template-ids are looked up differently in friend declarations.John McCall2010-10-141-1/+6
| | | | llvm-svn: 116529
* Generalize the checking for qualification of (non-friend) classDouglas Gregor2010-10-131-0/+21
| | | | | | | | members. Provide a hard error when the qualification doesn't match the current class type, or a warning + Fix-it if it does match the current class type. Fixes PR8159. llvm-svn: 116445
* Preserve the original scope when picking the right scope for a friendJohn McCall2010-10-131-2/+3
| | | | | | declaration, because we'll need it later. Hopefully fixed self-host. llvm-svn: 116399
* Support friend function declarations in local classes correctly.John McCall2010-10-131-6/+22
| | | | | | | | Fixes a crash and diagnoses the error condition of an unqualified friend which doesn't resolve to something. I'm still not certain how this is useful. llvm-svn: 116393
* Handle dependent friends more explicitly and deal with the possibilityJohn McCall2010-10-121-42/+57
| | | | | | | | of templated-scope friends by marking them invalid and white-listing all accesses until such time as we implement them. Fixes a crash, this time without a broken test case. llvm-svn: 116364
* If we end up instantiating a function parameter whose default argumentDouglas Gregor2010-10-121-0/+12
| | | | | | | | | has not yet been parsed, note that the default argument hasn't been parsed and keep track of all of the instantiations of that function parameter. When its default argument does get parsed, imbue the instantiations with that default argument. Fixes PR8245. llvm-svn: 116324
* Track the location of the context requiring an implicit conversion and use itJohn McCall2010-10-081-1/+9
| | | | | | to white-list conversions required by system headers. rdar://problem/8232669 llvm-svn: 116029
* Silence unused variable warning in Release builds.Nick Lewycky2010-10-061-0/+1
| | | | llvm-svn: 115806
* When checking for uninitialized fields in member initializers, special case ↵Anders Carlsson2010-10-061-0/+13
| | | | | | static variables and enums. Fixes PR8075. llvm-svn: 115732
* Move the management of the set of conversion functions in a C++ classDouglas Gregor2010-09-291-28/+9
| | | | | | | | | | 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-76/+1
| | | | | | | | | | | 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-3/+0
| | | | | | CXXRecordDecl::DefinitionData, rather than having Sema mark the bit. llvm-svn: 114993
* Reinstate r114925 and r114929, both steps towardDouglas Gregor2010-09-281-51/+0
| | | | | | <rdar://problem/8459981>. llvm-svn: 114984
* Centralize the management of CXXRecordDecl::DefinitionData's Empty bitDouglas Gregor2010-09-281-10/+0
| | | | | | | | | | | | 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-8/+0
| | | | | | | | 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-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-45/+0
| | | | | | | | | | | 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-6/+0
| | | | | | | 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-10/+0
| | | | | | 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-8/+0
| | | | | | | 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-1/+0
| | | | | | | 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-1/+0
| | | | | | | | 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-10/+0
| | | | | | | 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-9/+0
| | | | | | | | | | | | | 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
* Patch implements passing arrays to functions expectingFariborz Jahanian2010-09-241-1/+2
| | | | | | vla. Implements pr7827. llvm-svn: 114737
* Do not warn with -Wuninitialized when the member is used in a sizeof or ↵Argyrios Kyrtzidis2010-09-211-0/+8
| | | | | | | | address-of expression. Fixes rdar://8331312. llvm-svn: 114426
* Give implicitly-defined default constructors and destructors emptyDouglas Gregor2010-09-201-3/+10
| | | | | | bodies, from Martin Vejnar! llvm-svn: 114329
* static local variables with destructors don't require a global destructorJohn McCall2010-09-181-1/+2
| | | | | | | | | unless we're on a platform without __cxa_atexit (or use thereof has been disabled). This patch actually just disables the check completely for static locals, but I've filed http://llvm.org/bugs/show_bug.cgi?id=8176 to track the platform-specific fix. llvm-svn: 114269
OpenPOWER on IntegriCloud