summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Give CanQual<T> an implicit conversion to bool, so that it can be usedDouglas Gregor2009-11-121-1/+1
| | | | | | | | | | in "if" statements like: if (CanQual<ReferenceType> RefType = T.getAs<ReferenceType>()) Thanks to Clang for pointing out this mistake :) llvm-svn: 86995
* Random const correctness, and incidentally use computeDeclContext when buildingJohn McCall2009-11-121-17/+6
| | | | | | a using declaration. llvm-svn: 86942
* Diagnose illegally typed operator new/new[].Fariborz Jahanian2009-11-101-2/+21
| | | | llvm-svn: 86755
* Improve parsing of template arguments to lay the foundation forDouglas Gregor2009-11-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | handling template template parameters properly. This refactoring: - Parses template template arguments as id-expressions, representing the result of the parse as a template name (Action::TemplateTy) rather than as an expression (lame!). - Represents all parsed template arguments via a new parser-specific type, ParsedTemplateArgument, which stores the kind of template argument (type, non-type, template) along with all of the source information about the template argument. This replaces an ad hoc set of 3 vectors (one for a void*, which was either a type or an expression; one for a bit telling whether the first was a type or an expression; and one for a single source location pointing at the template argument). - Moves TemplateIdAnnotation into the new Parse/Template.h. It never belonged in the Basic library anyway. llvm-svn: 86708
* Use PP.getLocForEndOfToken as suggested by John.Anders Carlsson2009-11-101-2/+2
| | | | llvm-svn: 86661
* If a function with a default argument is redefined and the new function also ↵Anders Carlsson2009-11-101-1/+10
| | | | | | has a defualt argument then add a fixit hint that removes the default argument. Fixes PR5444. llvm-svn: 86659
* Add additional note to mark the cause of synthesized constructors. MarkEli Friedman2009-11-091-3/+20
| | | | | | | declaration invalid if the constructor can't be properly built. Addresses remaining review comments from Fariborz for r86500. llvm-svn: 86579
* Remove a useless variable that got left behind.Eli Friedman2009-11-091-4/+0
| | | | llvm-svn: 86501
* Unify the codepaths used to verify base and member initializers for explicitlyEli Friedman2009-11-091-104/+35
| | | | | | | | | | | | | | | | and implicitly defined constructors. This has a number of benefits: 1. Less code. 2. Explicit and implicit constructors get the same diagnostics. 3. The AST explicitly contains constructor calls from implicit default constructors. This allows handing some cases that previously weren't handled correctly in IRGen without any additional code. Specifically, implicit default constructors containing calls to constructors with default arguments are now handled correctly. llvm-svn: 86500
* Always make sure we're using an unqualified type when building aDouglas Gregor2009-11-081-2/+2
| | | | | | constructor name. Fixes PR5418. llvm-svn: 86441
* Make sure isCopyAssignment is only true for actual copy assignment operators,Eli Friedman2009-11-071-1/+0
| | | | | | | | 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
* This patch implements Sema for clause 13.3.3.1p4.Fariborz Jahanian2009-11-061-0/+1
| | | | | | | It has to do with vararg constructors used as conversion functions. Code gen needs work. This is WIP. llvm-svn: 86207
* Fixed two places where we needed to force completion of a typeDouglas Gregor2009-11-051-7/+10
| | | | | | | | | | | | (without complaining if it fails) to get proper semantics: reference binding with a derived-to-base conversion and the enumeration of constructors for user-defined conversions. There are probably more cases to fix, but my prior attempt at statically ensuring that complete-type checking always happens failed. Perhaps I'll try again. With this change, Clang can parse include/llvm/*.h! llvm-svn: 86129
* Comments, formatting. Based on patch by Brandon Pearcy!John McCall2009-11-041-2/+8
| | | | llvm-svn: 86065
* Diagnose using a field to initialize itself. Patch by Brandon Pearcy!John McCall2009-11-041-0/+59
| | | | llvm-svn: 86061
* Don't try to check the initialization of fields with dependentDouglas Gregor2009-11-041-7/+16
| | | | | | | | types. Fixes PR5352. Fariborz, please review. llvm-svn: 86031
* Switch parsing of using declarations over to ParseUnqualifiedId.Douglas Gregor2009-11-041-12/+27
| | | | llvm-svn: 86027
* Introduce a new class, UnqualifiedId, that provides a parsedDouglas Gregor2009-11-031-7/+7
| | | | | | | | | | | | | | | | representation of a C++ unqualified-id, along with a single parsing function (Parser::ParseUnqualifiedId) that will parse all of the various forms of unqualified-id in C++. Replace the representation of the declarator name in Declarator with the new UnqualifiedId class, simplifying declarator-id parsing considerably and providing more source-location information to Sema. In the future, I hope to migrate all of the other unqualified-id-parsing code over to this single representation, then begin to merge actions that are currently only different because we didn't have a unqualified notion of the name in the parser. llvm-svn: 85851
* Make sure to call CompleteConstructorCall for bases and members that are ↵Anders Carlsson2009-10-291-28/+53
| | | | | | initialized implicitly in constructors so that default arguments etc are set correctly. Fixes PR5283. llvm-svn: 85510
* Use array's base element type in getting to itsFariborz Jahanian2009-10-281-1/+1
| | | | | | constructor. WIP. llvm-svn: 85420
* Removed an unnecessary arguement passed to InitializeVarWithConstructorFariborz Jahanian2009-10-281-3/+2
| | | | | | | which should come from the variable and wasn't correct for arrays in any case. No change in functionality. llvm-svn: 85415
* remove a nonsensical todoChris Lattner2009-10-251-1/+0
| | | | llvm-svn: 85067
* change Sema::ActOnFriendTypeDecl to use GetTypeForDeclarator instead Chris Lattner2009-10-251-5/+6
| | | | | | | | | of ConvertDeclSpecToType, which I'd like to keep private to SemaType.cpp. We do this by cons'ing up a trivial Declarator for the type. John, please review. llvm-svn: 85060
* Audit the code for places where it is assumed that every base specifier ↵Sebastian Redl2009-10-251-0/+2
| | | | | | refers to a RecordType. Add assertions or conditions as appropriate. This fixes another crash in the Apache stdlib vector. llvm-svn: 85055
* When building types from declarators, instead of building two types (one forJohn McCall2009-10-221-2/+1
| | | | | | | | | | | | | | | | | | | | | the DeclaratorInfo, one for semantic analysis), just build a single type whose canonical type will reflect the semantic analysis (assuming the type is well-formed, of course). To make that work, make a few changes to the type system: * allow the nominal pointee type of a reference type to be a (possibly sugared) reference type. Also, preserve the original spelling of the reference type. Both of these can be ignored on canonical reference types. * Remove ObjCProtocolListType and preserve the associated source information on the various ObjC TypeLocs. Preserve the spelling of protocol lists except in the canonical form. * Preserve some level of source type structure on parameter types, but canonicalize on the canonical function type. This is still a WIP. Drops code size, makes strides towards accurate source location representation, slight (~1.7%) progression on Cocoa.h because of complexity drop. llvm-svn: 84907
* Don't (directly) call RequireCompleteType with an invalid source location.Douglas Gregor2009-10-211-1/+1
| | | | llvm-svn: 84793
* Change FixOverloadedFunctionReference to return a (possibly new) expression. ↵Anders Carlsson2009-10-211-1/+1
| | | | | | Substitute TemplateIdRefExprs with DeclRefExprs. Doug, plz review :) llvm-svn: 84763
* It's OK for a pure virtual function to override another pure virtual ↵Anders Carlsson2009-10-181-4/+2
| | | | | | function. Fixes PR5222. llvm-svn: 84428
* Testing and some minor fixes for explicit template instantiation.Douglas Gregor2009-10-141-1/+1
| | | | llvm-svn: 84129
* Handle ambiguity of reference initialization.Fariborz Jahanian2009-10-141-1/+10
| | | | | | Removes a FIXME. llvm-svn: 84068
* Remove some non-ASCII charactersDouglas Gregor2009-10-131-2/+2
| | | | llvm-svn: 84058
* Unify our diagnostic printing for errors of the form, "we didn't likeDouglas Gregor2009-10-131-1/+2
| | | | | | | | | | what we found when we looked into <blah>", where <blah> is a DeclContext*. We can now format DeclContext*'s in nice ways, e.g., "namespace N", "the global namespace", "'class Foo'". This is part of PR3990, but we're not quite there yet. llvm-svn: 84028
* Diagnose attempts to add default function arguments to aDouglas Gregor2009-10-131-0/+16
| | | | | | specialization. This completes C++ [temp.expl.spec]! llvm-svn: 83980
* Improve the internal representation and semantic analysis of friendDouglas Gregor2009-10-131-3/+2
| | | | | | | | | | | | | | | function templates. This commit ensures that friend function templates are constructed as FunctionTemplateDecls rather than partial FunctionDecls (as they previously were). It then implements template instantiation for friend function templates, injecting the friend function template only when no previous declaration exists at the time of instantiation. Oh, and make sure that explicit specialization declarations are not friends. llvm-svn: 83970
* Test exception spec compatibility on return type and parameters.Sebastian Redl2009-10-111-10/+0
| | | | | | | Along the way, use RequireCompleteType when testing exception spec types. Separate all the ugly spec stuff into its own file. llvm-svn: 83764
* Implement the core checking for compatible exception specifications in ↵Sebastian Redl2009-10-101-1/+7
| | | | | | | | | assignment and initialization. The exception specification of the assignee must be the same or a subset of the target. In addition, exception specifications on arguments and return types must be equivalent, but this is not implemented yet. This currently produces two diagnostics for every invalid assignment/initialization, due to the diagnostic produced outside PerformImplicitConversion, e.g. in CheckSingleInitializer. I don't know how to suppress this; in any case I think it is the wrong place for a diagnostic, since there are other diagnostics produced inside the function. So I'm leaving it as it is for the moment. llvm-svn: 83710
* Refactor the LookupResult API to simplify most common operations. Require ↵John McCall2009-10-091-17/+26
| | | | | | | | | users to pass a LookupResult reference to lookup routines. Call out uses which assume a single result. llvm-svn: 83674
* Fix up error reporting when object cannot be constructed Fariborz Jahanian2009-10-081-2/+3
| | | | | | | because of missing default constructor of a member. Fixes pr5154. llvm-svn: 83583
* Refactoring around friend class templates. Better error message for friend ↵John McCall2009-10-071-17/+9
| | | | | | | | enums. Don't create a new declaration for friend classes if a declaration already exists. llvm-svn: 83505
* Refactor the code that walks a C++ inheritance hierarchy, searchingDouglas Gregor2009-10-061-4/+138
| | | | | | | | | for bases, members, overridden virtual methods, etc. The operations isDerivedFrom and lookupInBases are now provided by CXXRecordDecl, rather than by Sema, so that CodeGen and other clients can use them directly. llvm-svn: 83396
* Anonymous namespaces, sema + codegen. A lot of semantics are still broken,John McCall2009-10-011-1/+32
| | | | | | apparently because using directives aren't quite working correctly. llvm-svn: 83184
* Issue good diagnostics when initializing a refernce type withFariborz Jahanian2009-09-301-3/+8
| | | | | | a bad initializer. Fixes pr4274. llvm-svn: 83169
* Desugaring optimizations. Add single-step desugaring methods to allJohn McCall2009-09-291-3/+3
| | | | | | | | | concrete types. Use unqualified desugaring for getAs<> and sundry. Fix a few users to either not desugar or use qualified desugar, as seemed appropriate. Removed Type's qualified desugar method, as it was easy to accidentally use instead of QualType's. llvm-svn: 83116
* Introduce ObjCProtocolListLoc for keeping source location information for ↵Argyrios Kyrtzidis2009-09-291-1/+2
| | | | | | protocol references. llvm-svn: 83094
* Minor API change. No change in functionality.Fariborz Jahanian2009-09-281-1/+1
| | | | llvm-svn: 83022
* Improve handling of friend function templates somewhatDouglas Gregor2009-09-281-41/+19
| | | | llvm-svn: 82950
* Rework the Parse-Sema interaction for friends to better support friendDouglas Gregor2009-09-261-8/+0
| | | | | | | | | class templates. We now treat friend class templates much more like normal class templates, except that they still get special name lookup rules. Fixes PR5057 and eliminates a bunch of spurious diagnostics in <iostream>. llvm-svn: 82848
* Refactor the representation of qualifiers to bring ExtQualType out of theJohn McCall2009-09-241-11/+9
| | | | | | | | 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
* Use Doug's DeclLoc to pinpoint location of the declarationFariborz Jahanian2009-09-241-1/+1
| | | | | | in a reference initialization diagnostic. llvm-svn: 82671
* Improve diagnostic location information when checking the initialization of ↵Douglas Gregor2009-09-231-14/+11
| | | | | | a reference llvm-svn: 82666
OpenPOWER on IntegriCloud