summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove unnecessary ASTContext parameter fromDouglas Gregor2010-07-011-1/+1
| | | | | | CXXRecordDecl::getDestructor(); no functionality change. llvm-svn: 107394
* Reinstate fix for PR7526, which was failing because, now that weDouglas Gregor2010-07-011-1/+1
| | | | | | | | | | | | | | | aren't dropping all exception specifications on destructors, the exception specifications on implicitly-declared destructors were detected as being wrong (which they were). Introduce logic to provide a proper exception-specification for implicitly-declared destructors. This also fixes PR6972. Note that the other implicitly-declared special member functions also need to get exception-specifications. I'll deal with that in a subsequent commit. llvm-svn: 107385
* Revert r107374, which broke bootstrap.Douglas Gregor2010-07-011-1/+1
| | | | llvm-svn: 107378
* When building the type of a destructor, make sure to keep theDouglas Gregor2010-07-011-1/+1
| | | | | | exception specification. Fixes PR7526. llvm-svn: 107374
* Add comment for my last patch.Fariborz Jahanian2010-06-251-1/+7
| | | | llvm-svn: 106813
* Fixes a regression when redeclaration of a global satic Fariborz Jahanian2010-06-241-1/+2
| | | | | | is an extern local to a function. Radar 8125274. llvm-svn: 106773
* In C++, allow a declaration of an enum to follow a definition of thatDouglas Gregor2010-06-221-4/+11
| | | | | | enum as a GNU extension. llvm-svn: 106540
* Fixes a corner case bug whereby declaring and defining an extern variable in a Fariborz Jahanian2010-06-211-0/+4
| | | | | | | particular sequence causes its definition to not be generated in the object file. (fixes radar 8071804). llvm-svn: 106424
* Merge the "regparm" attribute from a previous declaration of aDouglas Gregor2010-06-181-2/+16
| | | | | | function to redeclarations of that function. Fixes PR7025. llvm-svn: 106317
* Fix the recently-added warning about 'typename' and 'template'Douglas Gregor2010-06-161-1/+1
| | | | | | | | | disambiguation keywords outside of templates in C++98/03. Previously, the warning would fire when the associated nested-name-specifier was not dependent, but that was a misreading of the C++98/03 standard: now, we complain only when we're outside of any template. llvm-svn: 106161
* Don't poke at an undefined class type of a field. Fixes PR7355.Douglas Gregor2010-06-161-34/+35
| | | | llvm-svn: 106111
* Fix the build. Using declarations should not be considering when lookingJohn McCall2010-06-161-1/+1
| | | | | | for overridden virtual methods. llvm-svn: 106096
* Fix a point of semantics with using declaration hiding: method templatesJohn McCall2010-06-161-8/+6
| | | | | | | | | | | | | | | | | introduced by using decls are hidden even if their template parameter lists or return types differ from the "overriding" declaration. Propagate using shadow declarations around more effectively when looking up template-ids. Reperform lookup for template-ids in member expressions so that access control is properly set up. Fix some number of latent bugs involving template-ids with totally invalid base types. You can only actually get these with a scope specifier, since otherwise the template-id won't parse as a template-id. Fixes PR7384. llvm-svn: 106093
* Give Type::isIntegralType() an ASTContext parameter, so that itDouglas Gregor2010-06-161-2/+2
| | | | | | | | | | | | provides C "integer type" semantics in C and C++ "integral type" semantics in C++. Note that I still need to update isIntegerType (and possibly other predicates) using the same approach I've taken for isIntegralType(). The two should have the same meaning, but currently don't (!). llvm-svn: 106074
* Introduce Type::isIntegralOrEnumerationType(), to cover those placesDouglas Gregor2010-06-161-3/+3
| | | | | | | | | | in C++ that involve both integral and enumeration types. Convert all of the callers to Type::isIntegralType() that are meant to work with both integral and enumeration types over to Type::isIntegralOrEnumerationType(), to prepare to eliminate enumeration types as integral types. llvm-svn: 106071
* Patch adds support for copying of thoseFariborz Jahanian2010-06-151-0/+6
| | | | | | | | objective-c++ class objects which have GC'able objc object pointers and need to use ObjC's objc_memmove_collectable API (radar 8070772). llvm-svn: 106061
* Allocate template parameter lists for out-of-line definitions via theDouglas Gregor2010-06-151-3/+6
| | | | | | ASTContext rather than via the normal heap. llvm-svn: 106008
* Added template parameters info for out-of-line definitions of class template ↵Abramo Bagnara2010-06-121-5/+26
| | | | | | methods. llvm-svn: 105882
* Split DependentNameType into two types. DependentNameType represents theJohn McCall2010-06-111-8/+2
| | | | | | | | | | | | | | case of an elaborated-type-specifier like 'typename A<T>::foo', and DependentTemplateSpecializationType represents the case of an elaborated-type-specifier like 'typename A<T>::template B<T>'. The TypeLoc representation of a DependentTST conveniently exactly matches that of an ElaboratedType wrapping a TST. Kill off the explicit rebuild methods for RebuildInCurrentInstantiation; the standard implementations work fine because the nested name specifier is computable in the newly-entered context. llvm-svn: 105801
* Fix two typos in comments.Sebastian Redl2010-06-091-1/+1
| | | | llvm-svn: 105751
* When referring to a tag that was previously declared only as a friend, Douglas Gregor2010-06-081-1/+2
| | | | | | | build a new declaration for that tag type that will be visible for future lookups of that tag. llvm-svn: 105643
* Added AccessSpecDecl node.Abramo Bagnara2010-06-051-0/+2
| | | | llvm-svn: 105525
* Alter the interface of GetTypeForDeclarator to return a TypeSourceInfo*.John McCall2010-06-041-10/+9
| | | | | | This is never null, but the associated type might be. llvm-svn: 105503
* Restructure how we interpret block-literal declarators. Correctly handleJohn McCall2010-06-041-8/+14
| | | | | | | the case where we pick up block arguments from a typedef. Save the block signature as it was written, and preserve same through PCH. llvm-svn: 105466
* Delay checking for mutable const fields until we're checking the field.John McCall2010-06-041-0/+18
| | | | | | | Allows this check to work properly for instantiated fields and removes an unnecessary GetTypeForDeclarator call. llvm-svn: 105463
* Sema: Replace getPragmaPackAlignment with AddAlignmentAttributesForRecord, whichDaniel Dunbar2010-05-271-8/+5
| | | | | | exposes less details. llvm-svn: 104797
* AST: Rename PragmaPackAttr to MaxFieldAlignmentAttr, which is more accurate.Daniel Dunbar2010-05-271-1/+1
| | | | llvm-svn: 104795
* Improve on flexible array diagnostics (PR7029).Fariborz Jahanian2010-05-261-1/+1
| | | | llvm-svn: 104739
* Fixes misc. flexible array bugs in c++ (PR7029).Fariborz Jahanian2010-05-261-0/+9
| | | | llvm-svn: 104733
* Improve parser recovery when we encounter a dependent template nameDouglas Gregor2010-05-211-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that is missing the 'template' keyword, e.g., t->getAs<T>() where getAs is a member of an unknown specialization. C++ requires that we treat "getAs" as a value, but that would fail to parse since T is the name of a type. We would then fail at the '>', since a type cannot be followed by a '>'. This is a very common error for C++ programmers to make, especially since GCC occasionally allows it when it shouldn't (as does Visual C++). So, when we are in this case, we use tentative parsing to see if the tokens starting at "<" can only be parsed as a template argument list. If so, we produce a diagnostic with a fix-it that states that the 'template' keyword is needed: test/SemaTemplate/dependent-template-recover.cpp:5:8: error: 'template' keyword is required to treat 'getAs' as a dependent template name t->getAs<T>(); ^ template This is just a start of this patch; I'd like to apply the same approach to everywhere that a template-id with dependent template name can be parsed. llvm-svn: 104406
* Propagate access specifiers to anonymous union members nested within classes.John McCall2010-05-211-11/+20
| | | | | | Fixes <rdar://problem/7987650>. llvm-svn: 104376
* Whoops.John McCall2010-05-201-1/+1
| | | | llvm-svn: 104218
* Don't try to check jump scopes in invalid functions. FixesJohn McCall2010-05-201-1/+3
| | | | | | <rdar://problem/7995494>. llvm-svn: 104217
* Added basic source locations to Elaborated and DependentName types.Abramo Bagnara2010-05-191-2/+3
| | | | llvm-svn: 104169
* Adds support for ObjC++'s GC attribute on declaration ofFariborz Jahanian2010-05-191-3/+14
| | | | | | object variables and functions returning such objects. llvm-svn: 104168
* Substantially alter the design of the Objective C type AST by introducingJohn McCall2010-05-151-4/+4
| | | | | | | | | | | | | | | | | | | | | ObjCObjectType, which is basically just a pair of one of {primitive-id, primitive-Class, user-defined @class} with a list of protocols. An ObjCObjectPointerType is therefore just a pointer which always points to one of these types (possibly sugared). ObjCInterfaceType is now just a kind of ObjCObjectType which happens to not carry any protocols. Alter a rather large number of use sites to use ObjCObjectType instead of ObjCInterfaceType. Store an ObjCInterfaceType as a pointer on the decl rather than hashing them in a FoldingSet. Remove some number of methods that are no longer used, at least after this patch. By simplifying ObjCObjectPointerType, we are now able to easily remove and apply pointers to Objective-C types, which is crucial for a certain kind of ObjC++ metaprogramming common in WebKit. llvm-svn: 103870
* Implement semantic analysis and an AST representation for the namedDouglas Gregor2010-05-151-0/+35
| | | | | | | | | | | | return value optimization. Sema marks return statements with their NRVO candidates (which may or may not end up using the NRVO), then, at the end of a function body, computes and marks those variables that can be allocated into the return slot. I've checked this locally with some debugging statements (not committed), but there won't be any tests until CodeGen comes along. llvm-svn: 103865
* Patch to fix a crash on incomplete class declaration.Fariborz Jahanian2010-05-141-3/+7
| | | | | | Radar 7923673. llvm-svn: 103812
* Rework when and how vtables are emitted, by tracking where vtables areDouglas Gregor2010-05-131-40/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "used" (e.g., we will refer to the vtable in the generated code) and when they are defined (i.e., because we've seen the key function definition). Previously, we were effectively tracking "potential definitions" rather than uses, so we were a bit too eager about emitting vtables for classes without key functions. The new scheme: - For every use of a vtable, Sema calls MarkVTableUsed() to indicate the use. For example, this occurs when calling a virtual member function of the class, defining a constructor of that class type, dynamic_cast'ing from that type to a derived class, casting to/through a virtual base class, etc. - For every definition of a vtable, Sema calls MarkVTableUsed() to indicate the definition. This happens at the end of the translation unit for classes whose key function has been defined (so we can delay computation of the key function; see PR6564), and will also occur with explicit template instantiation definitions. - For every vtable defined/used, we mark all of the virtual member functions of that vtable as defined/used, unless we know that the key function is in another translation unit. This instantiates virtual member functions when needed. - At the end of the translation unit, Sema tells CodeGen (via the ASTConsumer) which vtables must be defined (CodeGen will define them) and which may be used (for which CodeGen will define the vtables lazily). From a language perspective, both the old and the new schemes are permissible: we're allowed to instantiate virtual member functions whenever we want per the standard. However, all other C++ compilers were more lazy than we were, and our eagerness was both a performance issue (we instantiated too much) and a portability problem (we broke Boost test cases, which now pass). Notes: (1) There's a ton of churn in the tests, because the order in which vtables get emitted to IR has changed. I've tried to isolate some of the larger tests from these issues. (2) Some diagnostics related to implicitly-instantiated/implicitly-defined virtual member functions have moved to the point of first use/definition. It's better this way. (3) I could use a review of the places where we MarkVTableUsed, to see if I missed any place where the language effectively requires a vtable. Fixes PR7114 and PR6564. llvm-svn: 103718
* Merged Elaborated and QualifiedName types.Abramo Bagnara2010-05-111-19/+20
| | | | llvm-svn: 103517
* Improve our handling of the -Wunused-variable warning in templates. InDouglas Gregor2010-05-081-15/+22
| | | | | | | | | particular, don't complain about unused variables that have dependent type until instantiation time, so that we can look at the type of the variable. Moreover, only complain about unused variables that have neither a user-declared constructor nor a non-trivial destructor. llvm-svn: 103362
* Remember the number of positive and negative bits used by the enumerators ofJohn McCall2010-05-061-2/+3
| | | | | | | an enum in the enum decl itself. Use some spare bits from TagDecl for this purpose. llvm-svn: 103173
* When instantiating a function that was declared via a typedef, e.g.,Douglas Gregor2010-05-041-2/+4
| | | | | | | | | | | | | typedef int functype(int, int); functype func; also instantiate the synthesized function parameters for the resulting function declaration. With this change, Boost.Wave builds and passes all of its regression tests. llvm-svn: 103025
* Diagnose unused exception parameters under a different warning groupDouglas Gregor2010-05-031-3/+8
| | | | | | | | (-Wunused-exception-parameter) than normal variables, since it's more common to name and then ignore an exception parameter. This warning is neither enabled by default nor by -Wall. Fixes <rdar://problem/7931045>. llvm-svn: 102931
* When a class contains a non-empty anonymous union or struct, mark isDouglas Gregor2010-05-031-2/+5
| | | | | | as non-empty. Fixes PR7021. llvm-svn: 102913
* It turns out that basically every caller to RequireCompleteDeclContextJohn McCall2010-05-011-4/+11
| | | | | | | already knows what context it's looking in. Just pass that context in instead of (questionably) recalculating it. llvm-svn: 102818
* Rebuild the nested name specifiers in member-pointer declarator chunks whenJohn McCall2010-04-291-56/+104
| | | | | | | | | entering the current instantiation. Set up a little to preserve type location information for typename types while we're in there. Fixes a Boost failure. llvm-svn: 102673
* Written storage class for declarations inside linkage specifications without ↵Abramo Bagnara2010-04-281-9/+29
| | | | | | braces is none. llvm-svn: 102496
* When checking the redeclaration context of a typedef that refers to aDouglas Gregor2010-04-271-1/+2
| | | | | | | tag of the same name, compare the lookup contexts rather than the actual contexts. Fixes PR6923. llvm-svn: 102437
* Don't look into incomplete types when trying to warn about unusedDouglas Gregor2010-04-271-0/+5
| | | | | | variables. Fixes PR6948. llvm-svn: 102436
OpenPOWER on IntegriCloud