summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement computation of the final overriders for each virtualDouglas Gregor2010-03-231-94/+87
| | | | | | | | | | | | | | | | | | | | function within a class hierarchy (C++ [class.virtual]p2). We use the final-overrider computation to determine when a particular class is ill-formed because it has multiple final overriders for a given virtual function (e.g., because two virtual functions override the same virtual function in the same virtual base class). Fixes PR5973. We also use the final-overrider computation to determine which virtual member functions are pure when determining whether a class is abstract or diagnosing the improper use of an abstract class. The prior approach to determining whether there were any pure virtual functions in a class didn't cope with virtual base class subobjects properly, and could not easily be fixed to deal with the oddities of subobject hiding. Fixes PR6631. llvm-svn: 99351
* A fixed version of r99174 which also includes a test that we emit vtables whenRafael Espindola2010-03-221-1/+1
| | | | | | we see an specialization definition ever if we then see a extern template declaration. llvm-svn: 99226
* revert r99174. It caused PR6677. Will try to debug why tonight.Rafael Espindola2010-03-221-1/+1
| | | | llvm-svn: 99188
* When handling a TSK_ExplicitInstantiationDefinition after aRafael Espindola2010-03-221-1/+1
| | | | | | | | | TSK_ExplicitInstantiationDeclaration make sure we call MaybeMarkVirtualMembersReferenced with a method attached to the definition. Remove the hack that forced vtable emition with declarations. llvm-svn: 99174
* Remember the "found declaration" for an overload candidate, which is theJohn McCall2010-03-191-5/+6
| | | | | | | | | | | | | | | | entity (if applicable) which was actually looked up. If a candidate was found via a using declaration, this is the UsingShadowDecl; otherwise, if the candidate is template specialization, this is the template; otherwise, this is the function. The point of this exercise is that "found declarations" are the entities we do access control for, not their underlying declarations. Broadly speaking, this patch fixes access control for using declarations. There is a *lot* of redundant code calling into the overload-resolution APIs; we really ought to clean that up. llvm-svn: 98945
* Perform access control for the implicit calls to base and member destructorsJohn McCall2010-03-161-33/+15
| | | | | | that occur in constructors (on the unwind path). llvm-svn: 98681
* Access control for implicit calls to copy assignment operators and copyJohn McCall2010-03-161-4/+28
| | | | | | constructors from implicitly-defined members. llvm-svn: 98614
* Perform access control even for the implicit destructor calls from implicitJohn McCall2010-03-161-38/+1
| | | | | | destructor definitions. Remove some code duplication. llvm-svn: 98611
* Perform access control for the implicit base and member destructor callsJohn McCall2010-03-161-20/+54
| | | | | | required when emitting a destructor definition. llvm-svn: 98609
* Fix PR6562. If a type is dependent, we don't know if it will have implicitRafael Espindola2010-03-131-0/+5
| | | | | | destructors. llvm-svn: 98440
* Remember whether a ParmVarDecl was spelled with a default argument orJohn McCall2010-03-121-0/+1
| | | | | | | | whether it inherited one from a previous declaration. Patch by Enea Zaffanella! llvm-svn: 98362
* Maintain type source information for functions through templateJohn McCall2010-03-111-6/+10
| | | | | | | | | | | instantiation. Based on a patch by Enea Zaffanella! I found a way to reduce some of the redundancy between TreeTransform's "standard" FunctionProtoType transformation and TemplateInstantiator's override, and I killed off the old SubstFunctionType by adding type source info for the last cases where we were creating FunctionDecls without TSI (at least that get passed through template instantiation). llvm-svn: 98252
* Create a new InjectedClassNameType to represent bare-word references to the John McCall2010-03-101-13/+18
| | | | | | | | | | | | | 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
* Delay codegen of vtables when handling implicit instantiations.Rafael Espindola2010-03-101-4/+7
| | | | | | This fixes PR6474. llvm-svn: 98123
* Downgrade errors when trying to catch a pointer or reference toDouglas Gregor2010-03-081-3/+10
| | | | | | | | | incomplete type to warnings; GCC (and EDG in GCC compatibility mode) permit such handles. Fixes PR6527. (For real this time) llvm-svn: 97927
* Robustify callers that rebuild typename type nodes again NULL returnDouglas Gregor2010-03-071-0/+3
| | | | | | types. Fixes PR6463. llvm-svn: 97924
* Reference binding via user-defined conversion can compute a bindingDouglas Gregor2010-03-071-10/+13
| | | | | | | that is not reference-related (because it requires another implicit conversion to which we can find). Fixes PR6483. llvm-svn: 97922
* When declaring a catch block in C++, make sure that the type beingDouglas Gregor2010-03-051-5/+26
| | | | | | caught can be copy-initialized and destructed. Fixes PR6518. llvm-svn: 97853
* During codegen assert that any copy assignment, destructor or constructor thatRafael Espindola2010-03-021-43/+75
| | | | | | | | we need to synthesize has been marked as used by Sema. Change Sema to avoid these asserts. llvm-svn: 97589
* Skip dependent virtual base classes; fixes PR6413.Douglas Gregor2010-02-271-1/+4
| | | | llvm-svn: 97291
* Don't try to finalize an ill-formed variable or one whose class type is ↵Douglas Gregor2010-02-251-1/+2
| | | | | | ill-formed. Fixes PR6421 llvm-svn: 97152
* Catch more uses of uninitialized implicit conversion sequences.John McCall2010-02-251-2/+1
| | | | | | | When diagnosing bad conversions, skip the conversion for ignored object arguments. Fixes PR 6398. llvm-svn: 97090
* Eliminate the default arguments to ASTContext::getFunctionType(),Douglas Gregor2010-02-211-7/+34
| | | | | | | | fixing up a few callers that thought they were propagating NoReturn information but were in fact saying something about exception specifications. llvm-svn: 96766
* Support local namespace aliases and permit them to be instantiated.John McCall2010-02-161-1/+1
| | | | llvm-svn: 96335
* Defer covariance checks for dependent types. Add test cases that also ensureChandler Carruth2010-02-151-1/+2
| | | | | | they are re-checked on instantiation. llvm-svn: 96217
* Work around an annoying, non-standard optimization in the glibcDouglas Gregor2010-02-121-3/+1
| | | | | | | | | | | | | | | | | | | | | | headers, where malloc (and many other libc functions) are declared with empty throw specifications, e.g., extern void *malloc (__SIZE_TYPE__ __size) throw () __attribute__ ((__malloc__)) ; The C++ standard doesn't seem to allow this, and redeclaring malloc as the standard permits (as follows) resulted in Clang (rightfully!) complaining about mis-matched exception specifications. void *malloc(size_t size); We work around this by silently propagating an empty throw specification "throw()" from a function with C linkage declared in a system header to a redeclaration that has no throw specifier. Ick. llvm-svn: 95969
* When we have a dependent direct initializer but not a dependentDouglas Gregor2010-02-111-18/+18
| | | | | | | | variable type, we can (and should) still check for completeness of the variable's type. Do so, to work around an assertion that shows up in Boost's shared_ptr. llvm-svn: 95934
* Remove another redundant ASTContext parameterDouglas Gregor2010-02-111-1/+1
| | | | llvm-svn: 95843
* Eliminate a bunch of unnecessary ASTContexts from members functions ofDouglas Gregor2010-02-111-6/+5
| | | | | | Decl subclasses. No functionality change. llvm-svn: 95841
* Eliminate the ASTContext parameter from RecordDecl::getDefinition()Douglas Gregor2010-02-111-2/+2
| | | | | | | and CXXRecordDecl::getDefinition(); it's totally unnecessary. No functionality change. llvm-svn: 95836
* Improve access control diagnostics. Perform access control on member-pointerJohn McCall2010-02-101-8/+15
| | | | | | | conversions. Fix an access-control bug where privileges were not considered at intermediate points along the inheritance path. Prepare for friends. llvm-svn: 95775
* Thread a source location into the template-argument deduction routines. ThereJohn McCall2010-02-081-3/+3
| | | | | | | may be some other places that could take advantage of this new information, but I haven't really looked yet. llvm-svn: 95600
* Add attributes to namespace decls.Anders Carlsson2010-02-071-1/+4
| | | | llvm-svn: 95510
* A function declarator with a non-identifier name in an anonymous classDouglas Gregor2010-02-051-1/+1
| | | | | | is a constructor for that class, right? Fixes PR6238. llvm-svn: 95367
* Extract a common structure for holding information about the definitionJohn McCall2010-02-041-4/+7
| | | | | | | | 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
* Mark dtors for parameter variables and eliminate some redundant type munging.John McCall2010-02-021-6/+5
| | | | llvm-svn: 95079
* Access control for implicit destructor calls. Diagnostic could be orders ofJohn McCall2010-02-021-4/+5
| | | | | | magnitude clearer. llvm-svn: 95078
* In C++, an initializer on a variable doesn't necessarily mean it's the ↵Sebastian Redl2010-02-011-2/+2
| | | | | | definition. With that in mind, rename getDefinition to getAnyInitializer (to distinguish it from getInit) and reimplement it in terms of isThisDeclarationADefinition. Update all code to use this new function. llvm-svn: 94999
* Switch expressions like T() and T(1,2) over to new-style initialization. I'mEli Friedman2010-01-311-102/+0
| | | | | | | not quite sure what we want to do about the AST representation; comments welcome. llvm-svn: 94967
* Rework base and member initialization in constructors, with severalDouglas Gregor2010-01-311-217/+261
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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
* Fix reference-binding when we have a reference to const volatile type;Douglas Gregor2010-01-291-0/+1
| | | | | | | previously, we were allowing this to bind to a temporary. Now, we don't; add test-cases and improve diagnostics. llvm-svn: 94831
* Access control for surrogate function calls. Required a moderately gross hackJohn McCall2010-01-281-0/+5
| | | | | | to get the access bits set properly in conversion sets. llvm-svn: 94744
* Fix a major oversight in the comparison of standard conversionDouglas Gregor2010-01-271-2/+6
| | | | | | | | | | | | | | sequences, where we would occasionally determine (incorrectly) that one standard conversion sequence was a proper subset of another when, in fact, they contained completely incomparable conversions. This change records the types in each step within a standard conversion sequence, so that we can check the specific comparison types to determine when one sequence is a proper subset of the other. Fixes this testcase (thanks, Anders!), which was distilled from PR6095 (also thanks to Anders). llvm-svn: 94660
* Pass access specifiers around in overload resolution.John McCall2010-01-261-3/+6
| | | | llvm-svn: 94485
* No need to canonicalize the type and use dyn_cast. Also, correctly diagnose ↵Anders Carlsson2010-01-221-12/+10
| | | | | | trying to override a function returning an lvalue reference with a function overriding an rvalue reference. llvm-svn: 94183
* Fix an obvious goof that caused us to only see the top level of return typesChandler Carruth2010-01-221-4/+4
| | | | | | | | | when checking for covariance. Added some fun test cases, fixes PR6110. This felt obvious enough to just commit. ;] Let me know if anything needs tweaking. llvm-svn: 94173
* Give UnresolvedSet the ability to store access specifiers for each declaration.John McCall2010-01-201-2/+2
| | | | | | | Change LookupResult to use UnresolvedSet. Also extract UnresolvedSet into its own header and make it templated over an inline capacity. llvm-svn: 93959
* In a mem-initializer, a nested-name-specifier followed by anDouglas Gregor2010-01-191-8/+25
| | | | | | | | | identifier always names a type. In the case of a dependent nested-name-specifier, build a TypenameType to describe the dependent base type. I'd like to move more of this behavior up into the parser, but this fixes PR6062. llvm-svn: 93871
* Reimplement constructor declarator parsing to cope with template-idsDouglas Gregor2010-01-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that name constructors, the endless joys of out-of-line constructor definitions, and various other corner cases that the previous hack never imagined. Fixes PR5688 and tightens up semantic analysis for constructor names. Additionally, fixed a problem where we wouldn't properly enter the declarator scope of a parenthesized declarator. We were entering the scope, then leaving it when we saw the ")"; now, we re-enter the declarator scope before parsing the parameter list. Note that we are forced to perform some tentative parsing within a class (call it C) to tell the difference between C(int); // constructor and C (f)(int); // member function which is rather unfortunate. And, although it isn't necessary for correctness, we use the same tentative-parsing mechanism for out-of-line constructors to improve diagnostics in icky cases like: C::C C::f(int); // error: C::C refers to the constructor name, but // we complain nicely and recover by treating it as // a type. llvm-svn: 93322
* Record some basic information about bad conversion sequences. Use thatJohn McCall2010-01-131-1/+4
| | | | | | | information to feed diagnostics instead of regenerating it. Much room for improvement here, but fixes some unfortunate problems reporting on method calls. llvm-svn: 93316
OpenPOWER on IntegriCloud