summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* When we're building a CXXExprWithTemporaries, only include thoseDouglas Gregor2009-12-031-4/+7
| | | | | | | | | | | temporaries that are within our current evaluation context. That way, nested evaluation contexts (e.g., within a sizeof() expression) won't see temporaries from outer contexts. Also, make sure to push a new evaluation context when instantiating the initializer of a variable; this may be an unevaluated context or a potentially-evaluated context, depending on whether it's an in-class initializer or not. Fixes PR5672. llvm-svn: 90460
* In Sema, whenever we think that a function is going to cause a vtable to be ↵Anders Carlsson2009-12-021-4/+1
| | | | | | generated, we mark any virtual implicit member functions as referenced. llvm-svn: 90327
* Rip out the last remaining implicit use of OverloadedFunctionDecl in Sema:John McCall2009-12-021-2/+1
| | | | | | | LookupResult::getAsSingleDecl() is no more. Shift Sema::LookupSingleName to return null on overloaded results. llvm-svn: 90309
* Fix a code gen. crash synthesizing a destructor.Fariborz Jahanian2009-12-011-1/+4
| | | | | | Fixes pr5660. llvm-svn: 90283
* Eliminate the use of OverloadedFunctionDecl in member expressions.John McCall2009-11-301-29/+11
| | | | | | | | Create a new UnresolvedMemberExpr for these lookups. Assorted hackery around qualified member expressions; this will all go away when we implement the correct (i.e. extremely delayed) implicit-member semantics. llvm-svn: 90161
* More work on ScalarExprEmitter::EmitCastExpr: for every cast kind, eitherEli Friedman2009-11-271-11/+15
| | | | | | | | | | | implement it explicitly or assert that it doesn't make sense for a scalar. This caught a couple interesting issues: one, CK_BaseToDerivedMemberPointer casts were getting silently miscompiled, and two, Sema was constructing some strange implicit casts of type CK_UserDefinedConversion. The change in SemaExprCXX makes sure the cast kinds are getting set correctly. llvm-svn: 89987
* Refactor our handling of expression evaluation contexts, so that SemaDouglas Gregor2009-11-261-3/+4
| | | | | | | | | | | | maintains a stack of evaluation contexts rather than having the parser do it. This change made it simpler to track in which contexts temporaries were created, so that we could... "Forget" about temporaries created within unevaluated contexts, so that we don't build a CXXExprWithTemporaries and, therefore, destroy the integral-constness of our expressions. Fixes PR5609. llvm-svn: 89908
* Eliminate CXXConditionDeclExpr with extreme prejudice.Douglas Gregor2009-11-251-59/+0
| | | | | | | | | | | | | | | | | 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
* Refactor argument collection of constructor calls usingFariborz Jahanian2009-11-241-1/+1
| | | | | | the common routine. llvm-svn: 89802
* More cleanup of argument call collection.Fariborz Jahanian2009-11-241-1/+3
| | | | llvm-svn: 89789
* Rip out TemplateIdRefExpr and make UnresolvedLookupExpr and John McCall2009-11-241-1/+1
| | | | | | | | | | | | DependentScopeDeclRefExpr support storing templateids. Unite the common code paths between ActOnDeclarationNameExpr and ActOnTemplateIdExpr. This gets us to a point where we don't need to store function templates in the AST using TemplateNames, which is critical to ripping out OverloadedFunction. Also resolves a few FIXMEs. llvm-svn: 89785
* Refactor collection of call arguments in common code.Fariborz Jahanian2009-11-241-20/+9
| | | | | | | Add support for variadic collection functions. More to do here. llvm-svn: 89781
* Un-break instantiation of if statements with conditional variablesDouglas Gregor2009-11-241-1/+10
| | | | llvm-svn: 89767
* Explicitly track the condition variable within an "if" statement,Douglas Gregor2009-11-231-0/+21
| | | | | | | | | rather than burying it in a CXXConditionDeclExpr (that occassionally hides behind implicit conversions). Similar changes for switch, while, and do-while will follow, then the removal of CXXConditionDeclExpr. This commit is the canary. llvm-svn: 89717
* Handle converting member pointers to bool.Anders Carlsson2009-11-231-2/+7
| | | | llvm-svn: 89692
* Do not mark declarations as used when performing overload resolution. Fixes ↵Douglas Gregor2009-11-231-4/+4
| | | | | | PR5541 llvm-svn: 89652
* "Incremental" progress on using expressions, by which I mean totally rippingJohn McCall2009-11-211-8/+8
| | | | | | | | | | | | | | | | | | | | | | 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
* When checking the base object of a member access expression (b.foo,Douglas Gregor2009-11-201-3/+3
| | | | | | b->foo), don't look through pointers unless we have an -> operator. llvm-svn: 89480
* Don't build an explicit conversion to a reference typeDouglas Gregor2009-11-201-2/+3
| | | | llvm-svn: 89441
* When we have a non-dependent expression such asDouglas Gregor2009-11-201-5/+0
| | | | | | | | | | | | | | | | A::f that occurs within a non-static member function with a type-dependent "this", don't consider this to be a case for introduction of an implicit "(*this)." to refer to a specific member function unless we know (at template definition time) that A is a base class of *this. There is some disagreement here between GCC, EDG, and Clang about the handling of this case. I believe that Clang now has the correct, literal interpretation of the standard, but have asked for clarification (c++std-core-15483). llvm-svn: 89425
* Patch to implement new-operators with default args.Fariborz Jahanian2009-11-191-3/+31
| | | | | | Fixes pr5547. llvm-svn: 89370
* ignore parens surounding the type when diagnosingFariborz Jahanian2009-11-181-1/+1
| | | | | | pointer-to-member cast types used in expressions. llvm-svn: 89255
* This patch fixes a bug in misdiagnosing correctFariborz Jahanian2009-11-181-0/+6
| | | | | | use of pointer to data member. llvm-svn: 89251
* Split LookupResult into its own header.John McCall2009-11-181-0/+1
| | | | llvm-svn: 89199
* Require the object type of a member access expression ("." or "->") toDouglas Gregor2009-11-171-1/+8
| | | | | | be complete. llvm-svn: 89042
* Carry lookup configuration throughout lookup on the LookupResult. GiveJohn McCall2009-11-171-9/+7
| | | | | | | | | | | | | 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
* First part of changes to eliminate problems with cv-qualifiers andDouglas Gregor2009-11-161-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Repair broken FindCompositePointerType. Correct early termination condition. ↵Sebastian Redl2009-11-161-12/+14
| | | | | | Get CVR qualifiers from canonical types. Traverse collected qualifiers in reverse order on rebuilding the pointer, so that we don't swap inner and outer qualifiers. That last one fixes PR5509. llvm-svn: 88960
* Factor finding a deallocation function for a record type out into a separate ↵Anders Carlsson2009-11-151-40/+62
| | | | | | function. llvm-svn: 88857
* If we find a deallocation function in the class scope, but it is a placement ↵Anders Carlsson2009-11-151-1/+16
| | | | | | function we should not look for a deallocation function in the global scope. llvm-svn: 88851
* - Have TryStaticImplicitCast set the cast kind to NoOp when binding a ↵Sebastian Redl2009-11-141-7/+10
| | | | | | | | | 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
* Diagnose ambiguity of operator delete and operator delete[]. Sebastian, ↵Anders Carlsson2009-11-141-1/+6
| | | | | | please review. llvm-svn: 88747
* Improve source-location information for implicitly-generated member call ↵Douglas Gregor2009-11-121-1/+1
| | | | | | expressions llvm-svn: 86989
* Fix use-after-free bug.Eli Friedman2009-11-081-3/+2
| | | | llvm-svn: 86485
* When we encounter a derived-to-base conversion when performing anDouglas Gregor2009-11-061-1/+11
| | | | | | | implicit conversion sequence, check the validity of this conversion and then perform it. llvm-svn: 86210
* Minor cleanup of my last patch.Fariborz Jahanian2009-11-061-1/+1
| | | | llvm-svn: 86209
* This patch implements Sema for clause 13.3.3.1p4.Fariborz Jahanian2009-11-061-9/+12
| | | | | | | It has to do with vararg constructors used as conversion functions. Code gen needs work. This is WIP. llvm-svn: 86207
* Implement the conditional-operator part of -Wsign-compare. TurnJohn McCall2009-11-051-0/+2
| | | | | | | | | | | | DiagnoseSignCompare into Sema::CheckSignCompare and call it from more places. Add some enumerator tests. These seem to expose some oddities in the types we're converting C++ enumerators to; in particular, they're converting to unsigned before int, which seems to contradict 4.5 [conv.prom] p2. Note to self: stop baiting Doug in my commit messages. llvm-svn: 86128
* When starting a C++ member access expression, make sure to compute theDouglas Gregor2009-11-041-1/+7
| | | | | | | | | type of the object even when it is dependent. Specifically, this makes sure that we get the right type for "this->", which is important when performing name lookup into this scope to determine whether an identifier or operator-function-id is a template name. llvm-svn: 86060
* Remove previous patch for pr5296 due to further clarificationFariborz Jahanian2009-11-031-29/+1
| | | | | | of value-initialization and trivial constructors. llvm-svn: 85935
* Replace the code that parses member access expressions after "." orDouglas Gregor2009-11-031-104/+0
| | | | | | | | | | | | "->" with a use of ParseUnqualifiedId. Collapse ActOnMemberReferenceExpr, ActOnDestructorReferenceExpr (both of them), ActOnOverloadedOperatorReferenceExpr, ActOnConversionOperatorReferenceExpr, and ActOnMemberTemplateIdReferenceExpr into a single, new action ActOnMemberAccessExpr that does the same thing more cleanly (and can keep more source-location information). llvm-svn: 85930
* Use ParseUnqualifiedId when parsing id-expressions. This eliminatesDouglas Gregor2009-11-031-35/+0
| | | | | | | | | | | yet another copy of the unqualified-id parsing code. Also, use UnqualifiedId to simplify the Action interface for building id-expressions. ActOnIdentifierExpr, ActOnCXXOperatorFunctionIdExpr, ActOnCXXConversionFunctionExpr, and ActOnTemplateIdExpr have all been removed in favor of the new ActOnIdExpression action. llvm-svn: 85904
* Within a template, qualified name lookup can refer to a non-dependent typeDouglas Gregor2009-11-011-0/+6
| | | | | | | | | that is not known to be a base class at template definition time due to some dependent base class. Treat qualified name lookup that refers to a non-static data member or function as implicit class member access when the "this" type would be dependent. llvm-svn: 85718
* Track source information for template arguments and template specializationJohn McCall2009-10-291-1/+1
| | | | | | | types. Preserve it through template instantiation. Preserve it through PCH, although TSTs themselves aren't serializable, so that's pretty much meaningless. llvm-svn: 85500
* Generate constructor for value-initialization cases, even if the Fariborz Jahanian2009-10-271-2/+29
| | | | | | | implementation technique doesn't call the constructor at that point. DR302. Fixes pr5296. llvm-svn: 85249
* Add 'fixit' hint on mis-use of pointer-to-memberFariborz Jahanian2009-10-261-2/+5
| | | | | | binary operators. llvm-svn: 85153
* Remove the Skip parameter from GetTypeForDeclarator and dependents. Take the ↵Sebastian Redl2009-10-251-8/+18
| | | | | | opportunity to improve an error message and fix PR4498. llvm-svn: 85068
* Fix overload resolution when calling a member template or taking theDouglas Gregor2009-10-241-0/+1
| | | | | | | address of a member template when explicit template arguments are provided. llvm-svn: 84991
* Diagnose misuse of '.*' and '->*' operators during parseFariborz Jahanian2009-10-231-1/+1
| | | | | | instead of crashing in code gen. llvm-svn: 84968
* Fixed a code gen bug (by fixing the AST) involving user-definedFariborz Jahanian2009-10-231-0/+4
| | | | | | | pointer-to-member type conversion follwed by a pointer-to-member standard conversion. llvm-svn: 84955
OpenPOWER on IntegriCloud