summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* DeclaratorInfo -> TypeSourceInfo. Makes an effort to rename associated ↵John McCall2009-12-071-28/+28
| | | | | | | | | | | | | | | | | | | | | variables, but the results are imperfect. For posterity, I did: cat <<EOF > $cmdfile s/DeclaratorInfo/TypeSourceInfo/g s/DInfo/TInfo/g s/TypeTypeSourceInfo/TypeSourceInfo/g s/SourceTypeSourceInfo/TypeSourceInfo/g EOF find lib -name '*.cpp' -not -path 'lib/Parse/*' -exec sed -i '' -f $cmdfile '{}' \; find lib -name '*.h' -exec sed -i '' -f $cmdfile '{}' \; find include -name '*.h' -not -path 'include/clang/Parse/*' -not -path 'include/clang/Basic/*' -exec sed -i '' -f $cmdfile '{}' \; llvm-svn: 90743
* Fix a slight oversight in computing whether a copy constructor is elidable.Eli Friedman2009-12-061-2/+4
| | | | | | Fixes PR5695. llvm-svn: 90702
* Fix for PR5693: shift some code into SetClassDeclAttributesFromBase so thatEli Friedman2009-12-051-5/+15
| | | | | | it gets called during template instantiation. llvm-svn: 90682
* Fix "using typename" and the instantiation of non-dependent using declarations.John McCall2009-12-041-30/+53
| | | | llvm-svn: 90614
* Unify the end-of-class code paths used by the parser and templateDouglas Gregor2009-12-031-14/+25
| | | | | | | | | | | | | | instantiation, to ensure that we mark class template specilizations as abstract when we need to and perform checking of abstract classes. Also, move the checking that determines whether we are creating a variable of abstract class type *after* we check whether the type is complete. Otherwise, we won't see when we have an abstract class template specialization that is implicitly instantiated by this declaration. This is the "something else" that Sebastian had noted earlier. llvm-svn: 90467
* When instantiating a class, if a base specifier is not dependent we still ↵Anders Carlsson2009-12-031-11/+18
| | | | | | need to copy its attributes down to the instantiated class. llvm-svn: 90463
* Honor using declarations in overload resolution. Most of the code forJohn McCall2009-12-031-5/+10
| | | | | | | | | | | overloaded-operator resolution is wildly untested, but the parallel code for methods seems to satisfy some trivial tests. Also change some overload-resolution APIs to take a type instead of an expression, which lets us avoid creating a spurious CXXThisExpr when resolving implicit member accesses. llvm-svn: 90410
* Improve source location information for C++ member initializers in aDouglas Gregor2009-12-021-35/+64
| | | | | | | constructor, by keeping the DeclaratorInfo* rather than just the type and a single location. llvm-svn: 90355
* In Sema, whenever we think that a function is going to cause a vtable to be ↵Anders Carlsson2009-12-021-4/+33
| | | | | | generated, we mark any virtual implicit member functions as referenced. llvm-svn: 90327
* Make sure to call AddOverriddenMethods for implicit copy assignment operators;Eli Friedman2009-12-021-0/+1
| | | | | | it's rare, but possible, for the difference to be significant. llvm-svn: 90301
* Fix a code gen. crash synthesizing a destructor.Fariborz Jahanian2009-12-011-2/+3
| | | | | | Fixes pr5660. llvm-svn: 90283
* Move the checking of overridden virtual functions into the code pathDouglas Gregor2009-12-011-0/+20
| | | | | | | | | | | | | | | common to both parsing and template instantiation, so that we'll find overridden virtuals for member functions of class templates when they are instantiated. Additionally, factor out the checking for pure virtual functions, so that it will be executed both at parsing time and at template instantiation time. These changes fix PR5656 (for real), although one more tweak w.r.t. member function templates will be coming along shortly. llvm-svn: 90241
* Don't automatically assume that an id-expression refers to aDouglas Gregor2009-12-011-5/+5
| | | | | | | | | | ValueDecl, because that isn't always the case in ill-formed code. Diagnose a common mistake (forgetting to provide a template argument list for a class template, PR5655) and dyn_cast so that we handle the general problem of referring to a non-value declaration gracefully. llvm-svn: 90239
* When we're trying to define an implicit virtual destructor, make sure that ↵Anders Carlsson2009-11-301-7/+22
| | | | | | we have a valid delete operator. llvm-svn: 90156
* Remove remaining VISIBILITY_HIDDEN from anonymous namespaces.Benjamin Kramer2009-11-281-5/+3
| | | | llvm-svn: 90044
* Add Parser support for C++0x literal operators ('operator "" i').Alexis Hunt2009-11-281-0/+1
| | | | | | DeclarationName can't handle them yet, so right now Parser just errors out on them. llvm-svn: 90027
* When adding an implicit destructor, make sure to mark it as virtual if it ↵Anders Carlsson2009-11-261-0/+2
| | | | | | overrides existing destructors. llvm-svn: 89967
* Better diagnostic on deleted constructor when noFariborz Jahanian2009-11-251-2/+5
| | | | | | initializer name is available. llvm-svn: 89885
* Diagnose ill-formed uses of default template arguments inDouglas Gregor2009-11-251-2/+1
| | | | | | | | | | | function templates (in C++98), friend function templates, and out-of-line definitions of members of class templates. Also handles merging of default template arguments from previous declarations of function templates, for C++0x. However, we don't yet make use of those default template arguments. llvm-svn: 89872
* Eliminate CXXConditionDeclExpr with extreme prejudice.Douglas Gregor2009-11-251-0/+36
| | | | | | | | | | | | | | | | | All statements that involve conditions can now hold on to a separate condition declaration (a VarDecl), and will use a DeclRefExpr referring to that VarDecl for the condition expression. ForStmts now have such a VarDecl (I'd missed those in previous commits). Also, since this change reworks the Action interface for if/while/switch/for, use FullExprArg for the full expressions in those expressions, to ensure that we're emitting Note that we are (still) not generating the right cleanups for condition variables in for statements. That will be a follow-on commit. llvm-svn: 89817
* Have the parser tell sema whether a member declaration is a function ↵Sebastian Redl2009-11-241-2/+3
| | | | | | definition. This allows sema to not emit spurious diagnostics in some invalid code. llvm-svn: 89816
* Refactor argument collection of constructor calls usingFariborz Jahanian2009-11-241-48/+12
| | | | | | the common routine. llvm-svn: 89802
* Let using directives refer to namespace aliases. Fixes PR5479.Sebastian Redl2009-11-231-17/+14
| | | | llvm-svn: 89657
* Do not mark declarations as used when performing overload resolution. Fixes ↵Douglas Gregor2009-11-231-0/+2
| | | | | | PR5541 llvm-svn: 89652
* Encapsulate "an array of TemplateArgumentLocs and two angle bracket ↵John McCall2009-11-231-1/+2
| | | | | | | | | | locations" into a new class. Use it pervasively throughout Sema. My fingers hurt. llvm-svn: 89638
* "Incremental" progress on using expressions, by which I mean totally rippingJohn McCall2009-11-211-16/+7
| | | | | | | | | | | | | | | | | | | | | | into pretty much everything about overload resolution in order to wean BuildDeclarationNameExpr off LookupResult::getAsSingleDecl(). Replace UnresolvedFunctionNameExpr with UnresolvedLookupExpr, which generalizes the idea of a non-member lookup that we haven't totally resolved yet, whether by overloading, argument-dependent lookup, or (eventually) the presence of a function template in the lookup results. Incidentally fixes a problem with argument-dependent lookup where we were still performing ADL even when the lookup results contained something from a block scope. Incidentally improves a diagnostic when using an ObjC ivar from a class method. This just fell out from rewriting BuildDeclarationNameExpr's interaction with lookup, and I'm too apathetic to break it out. The only remaining uses of OverloadedFunctionDecl that I know of are in TemplateName and MemberExpr. llvm-svn: 89544
* Added rudimentary C++0x attribute support.Alexis Hunt2009-11-211-0/+20
| | | | | | | | | | | | | | The following attributes are currently supported in C++0x attribute lists (and in GNU ones as well): - align() - semantics believed to be conformant to n3000, except for redeclarations and what entities it may apply to - final - semantics believed to be conformant to CWG issue 817's proposed wording, except for redeclarations - noreturn - semantics believed to be conformant to n3000, except for redeclarations - carries_dependency - currently ignored (this is an optimization hint) llvm-svn: 89543
* Overhaul previous-declaration and overload checking to work on lookup resultsJohn McCall2009-11-181-11/+11
| | | | | | | rather than NamedDecl*. This is a major step towards eliminating OverloadedFunctionDecl. llvm-svn: 89263
* Split LookupResult into its own header.John McCall2009-11-181-7/+5
| | | | llvm-svn: 89199
* Incremental progress on using declarations. Split UnresolvedUsingDecl intoJohn McCall2009-11-181-12/+50
| | | | | | | | | | two classes, one for typenames and one for values; this seems to have some support from Doug if not necessarily from the extremely-vague-on-this-point standard. Track the location of the 'typename' keyword in a using-typename decl. Make a new lookup result for unresolved values and deal with it in most places. llvm-svn: 89184
* Silence some warnings produced by Clang, and add a missing headerDouglas Gregor2009-11-171-1/+1
| | | | llvm-svn: 89051
* Instead of hanging a using declaration's target decls directly off the using John McCall2009-11-171-10/+50
| | | | | | | decl, create shadow declarations and put them in scope like normal. Work in progress. llvm-svn: 89048
* Unify the way destructor epilogues are generated for synthesized and regular ↵Anders Carlsson2009-11-171-59/+45
| | | | | | destructors. Also fix PR5529. llvm-svn: 89034
* Carry lookup configuration throughout lookup on the LookupResult. GiveJohn McCall2009-11-171-18/+19
| | | | | | | | | | | | | LookupResult RAII powers to diagnose ambiguity in the results. Other diagnostics (e.g. access control and deprecation) will be moved to automatically trigger during lookup as part of this same mechanism. This abstraction makes it much easier to encapsulate aliasing declarations (e.g. using declarations) inside the lookup system: eventually, lookup will just produce the aliases in the LookupResult, and the standard access methods will naturally strip the aliases off. llvm-svn: 89027
* Simplify the AST a bit by skipping creating member initializers for membersEli Friedman2009-11-161-8/+14
| | | | | | with a trivial constructor. llvm-svn: 88990
* First part of changes to eliminate problems with cv-qualifiers andDouglas Gregor2009-11-161-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sugared types. The basic problem is that our qualifier accessors (getQualifiers, getCVRQualifiers, isConstQualified, etc.) only look at the current QualType and not at any qualifiers that come from sugared types, meaning that we won't see these qualifiers through, e.g., typedefs: typedef const int CInt; typedef CInt Self; Self.isConstQualified() currently returns false! Various bugs (e.g., PR5383) have cropped up all over the front end due to such problems. I'm addressing this problem by splitting each qualifier accessor into two versions: - the "local" version only returns qualifiers on this particular QualType instance - the "normal" version that will eventually combine qualifiers from this QualType instance with the qualifiers on the canonical type to produce the full set of qualifiers. This commit adds the local versions and switches a few callers from the "normal" version (e.g., isConstQualified) over to the "local" version (e.g., isLocalConstQualified) when that is the right thing to do, e.g., because we're printing or serializing the qualifiers. Also, switch a bunch of Context.getCanonicalType(T1).getUnqualifiedType() == Context.getCanonicalType(T2).getQualifiedType() expressions over to Context.hasSameUnqualifiedType(T1, T2) llvm-svn: 88969
* Make sure that virtual destructors have delete operators.Anders Carlsson2009-11-151-3/+23
| | | | llvm-svn: 88877
* Don't gratuitously mark the default constructors of base or member ↵Douglas Gregor2009-11-151-22/+4
| | | | | | initializers as used llvm-svn: 88847
* - Have TryStaticImplicitCast set the cast kind to NoOp when binding a ↵Sebastian Redl2009-11-141-4/+12
| | | | | | | | | reference. CheckReferenceInit already inserts implicit casts to the necessary types. This fixes an assertion in CodeGen for some casts and brings a fix for PR5453 close, if I understand that bug correctly. - Also, perform calculated implicit cast sequences if they're determined to work. This finally diagnoses static_cast to ambiguous or implicit bases and fixes two long-standing fixmes in the test case. For the C-style cast, this requires propagating the access check suppression pretty deep into other functions. - Pass the expressions for TryStaticCast and TryStaticImplicitCast by reference. This should lead to a better AST being emitted for such casts, and also fixes a memory leak, because CheckReferenceInit and PerformImplicitConversion wrap the node passed to them. These wrappers were previously lost. llvm-svn: 88809
* When type-checking a static cast (or the static_cast part of a C-styleDouglas Gregor2009-11-141-46/+106
| | | | | | | | cast) that is converting to a class type, enumerate its constructors as in any other direct initialization. This ensures that we get the proper conversion sequence. llvm-svn: 88751
* If we attempt to add a constructor template specialization that looksDouglas Gregor2009-11-141-1/+6
| | | | | | | | | | | | like a copy constructor to the overload set, just ignore it. This ensures that we don't try to use such a constructor as a copy constructor *without* triggering diagnostics at the point of declaration. Note that we *do* diagnose such copy constructors when explicitly written by the user (e.g., as an explicit specialization). llvm-svn: 88733
* Clear temporaries in more places.Anders Carlsson2009-11-131-0/+9
| | | | llvm-svn: 88687
* Fix bug Doug noticed.Anders Carlsson2009-11-131-0/+13
| | | | llvm-svn: 88679
* When transforming an expression statement (e.g., for templateDouglas Gregor2009-11-131-1/+1
| | | | | | | | | instantiation), be sure to finish the expression statement by providing a FullExprArg, making sure that temporaries get destroyed. Fixes an obscure failure when parsing llvm/LinkAllPasses.h. llvm-svn: 88668
* 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
OpenPOWER on IntegriCloud