summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/TreeTransform.h
Commit message (Collapse)AuthorAgeFilesLines
* Some fancy footwork to move the decision on how Fariborz Jahanian2009-11-251-1/+2
| | | | | | to build casted expression-list AST to Sema. llvm-svn: 89827
* Eliminate CXXConditionDeclExpr with extreme prejudice.Douglas Gregor2009-11-251-62/+58
| | | | | | | | | | | | | | | | | 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
* Clean up the AST for while loops and fix several problems withDouglas Gregor2009-11-241-1/+12
| | | | | | | | | | | | | | | | | cleanups for while loops: 1) Make sure that we destroy the condition variable of a while statement each time through the loop for, e.g., while (shared_ptr<WorkInt> p = getWorkItem()) { // ... } 2) Make sure that we always enter a new cleanup scope for the body of the while loop, even when there is no compound expression, e.g., while (blah) RAIIObject raii(blah+1); llvm-svn: 89800
* Rip out TemplateIdRefExpr and make UnresolvedLookupExpr and John McCall2009-11-241-97/+99
| | | | | | | | | | | | 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
* Explicitly store the condition variable within switch statements, andDouglas Gregor2009-11-241-1/+12
| | | | | | | make sure that this variable is destroyed when we exit the switch statement. llvm-svn: 89776
* Explicitly track the condition variable within an "if" statement,Douglas Gregor2009-11-231-2/+14
| | | | | | | | | 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
* Centralize and complete the computation of value- and type-dependence for ↵Douglas Gregor2009-11-231-1/+1
| | | | | | DeclRefExprs llvm-svn: 89649
* Encapsulate "an array of TemplateArgumentLocs and two angle bracket ↵John McCall2009-11-231-70/+42
| | | | | | | | | | 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-12/+21
| | | | | | | | | | | | | | | | | | | | | | 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
* Cope with extraneous "template" keyword when providing an out-of-lineDouglas Gregor2009-11-201-2/+4
| | | | | | definition of a member template (or a member thereof). Fixes PR5566. llvm-svn: 89512
* Draw a brighter line between "unresolved" expressions, where we have done theJohn McCall2009-11-191-10/+10
| | | | | | | | appropriate lookup and simply can't resolve the referrent yet, and "dependent scope" expressions, where we can't do the lookup yet because the entity we need to look into is a dependent type. llvm-svn: 89402
* The sub-statement of a case statement is not an unevaluated context!Eli Friedman2009-11-191-10/+13
| | | | llvm-svn: 89303
* First part of changes to eliminate problems with cv-qualifiers andDouglas Gregor2009-11-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix PR5488: special-case the overloaded arrow operator so that we don't try toEli Friedman2009-11-161-0/+3
| | | | | | treat it as a unary operator. llvm-svn: 88938
* 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
* Introduce a new representation for template templateDouglas Gregor2009-11-111-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | parameters. Rather than storing them as either declarations (for the non-dependent case) or expressions (for the dependent case), we now (always) store them as TemplateNames. The primary change here is to add a new kind of TemplateArgument, which stores a TemplateName. However, making that change ripples to every switch on a TemplateArgument's kind, also affecting TemplateArgumentLocInfo/TemplateArgumentLoc, default template arguments for template template parameters, type-checking of template template arguments, etc. This change is light on testing. It should fix several pre-existing problems with template template parameters, such as: - the inability to use dependent template names as template template arguments - template template parameter default arguments cannot be instantiation However, there are enough pieces missing that more implementation is required before we can adequately test template template parameters. llvm-svn: 86777
* When transforming an InitListExpr, if we already computed a non-dependent ↵Douglas Gregor2009-11-091-3/+13
| | | | | | type for the InitListExpr, keep it llvm-svn: 86559
* When instantiating a UnaryOperator, allow the resulting expression toDouglas Gregor2009-11-051-10/+3
| | | | | | | | | | | | | still be dependent or invoke an overloaded operator. Previously, we only supported builtin operators. BinaryOperator/CompoundAssignOperator didn't have this issue because we always built a CXXOperatorCallExpr node, even when name lookup didn't find any functions to save until instantiation time. Now, that code builds a BinaryOperator or CompoundAssignOperator rather than a CXXOperatorCallExpr, to save some space. llvm-svn: 86087
* When instantiating a MemberExpr, be sure to instantiate theDouglas Gregor2009-11-041-4/+33
| | | | | | explicitly-specified template arguments, too! llvm-svn: 86066
* Preserve type source information in sizeof/alignof expressions, and pass itJohn McCall2009-11-041-7/+8
| | | | | | through to indexing. llvm-svn: 86018
* When performing template instantiation (transformation) ofDouglas Gregor2009-11-041-88/+169
| | | | | | | | | expressions, keep track of whether we are immediately taking the address of the expression. Pass this flag when building a declaration name expression so that we handle pointer-to-member constants properly. llvm-svn: 86017
* Implement support for parsing dependent template-ids that refer toDouglas Gregor2009-11-041-8/+53
| | | | | | | | overloaded operators, e.g., p->template operator+<T>() llvm-svn: 85989
* Parsing and semantic analysis for template-ids that name overloadedDouglas Gregor2009-11-031-2/+3
| | | | | | | | | | | | operators, e.g., operator+<int> which now works in declarators, id-expressions, and member access expressions. This commit only implements the non-dependent case, where we can resolve the template-id to an actual declaration. llvm-svn: 85966
* Replace the code that parses member access expressions after "." orDouglas Gregor2009-11-031-3/+3
| | | | | | | | | | | | "->" 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
* Report accurate source-location information when rebuilding types duringJohn McCall2009-10-301-80/+93
| | | | | | template instantiation. llvm-svn: 85545
* Slightly improve source-location information during template instantiationDouglas Gregor2009-10-291-0/+1
| | | | llvm-svn: 85529
* Properly instantiate usage of overloaded operator []. Fixes PR5345.Sebastian Redl2009-10-291-4/+13
| | | | llvm-svn: 85524
* A few TemplateArgumentLoc clean-ups. Try to remember the Expr for a ↵John McCall2009-10-291-11/+27
| | | | | | | | declaration. Provide an API for getting the SourceRange of a TAL and use it judiciously. llvm-svn: 85520
* Yet more instantiation-location information. Fixes PR5336.Douglas Gregor2009-10-291-0/+2
| | | | llvm-svn: 85516
* Track source information for template arguments and template specializationJohn McCall2009-10-291-83/+177
| | | | | | | 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
* Slightly improve source location information during template instantiationDouglas Gregor2009-10-281-0/+10
| | | | llvm-svn: 85353
* Only set the point of instantiation for an implicit or explicitDouglas Gregor2009-10-271-0/+5
| | | | | | | | | | instantiation once we have committed to performing the instantiation. As part of this, make our makeshift template-instantiation location information suck slightly less. Fixes PR5264. llvm-svn: 85209
* Apply the special enum restrictions from [over.match.oper]p3b2 in ↵Sebastian Redl2009-10-231-1/+2
| | | | | | argument-dependent lookup too. This fixes PR5244. llvm-svn: 84963
* Eliminate QualifiedDeclRefExpr, which captured the notion of aDouglas Gregor2009-10-231-50/+34
| | | | | | | | | | | | | | | | | | | | | | | | qualified reference to a declaration that is not a non-static data member or non-static member function, e.g., namespace N { int i; } int j = N::i; Instead, extend DeclRefExpr to optionally store the qualifier. Most clients won't see or care about the difference (since QualifierDeclRefExpr inherited DeclRefExpr). However, this reduces the number of top-level expression types that clients need to cope with, brings the implementation of DeclRefExpr into line with MemberExpr, and simplifies and unifies our handling of declaration references. Extended DeclRefExpr to (optionally) store explicitly-specified template arguments. This occurs when naming a declaration via a template-id (which will be stored in a TemplateIdRefExpr) that, following template argument deduction and (possibly) overload resolution, is replaced with a DeclRefExpr that refers to a template specialization but maintains the template arguments as written. llvm-svn: 84962
* Rebuild dependently-sized ext vectors if either the element type or the sizeJohn McCall2009-10-231-1/+2
| | | | | | changed under the transform. llvm-svn: 84953
* Silence GCC 4.3 warning.Benjamin Kramer2009-10-231-2/+1
| | | | | | TreeTransform.h:2333: warning: suggest parentheses around && within || llvm-svn: 84949
* When building types from declarators, instead of building two types (one forJohn McCall2009-10-221-46/+4
| | | | | | | | | | | | | | | | | | | | | 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
* When building and instantiating a template-id reference expression, such asDouglas Gregor2009-10-221-5/+17
| | | | | | | | | | | N::f<int> keep track of the full nested-name-specifier. This is mainly QoI and relatively hard to test; will try to come up with a printing-based test once we also retain the explicit template arguments past overload resolution. llvm-svn: 84869
* Initialize using the base location provided by the derived implementation,John McCall2009-10-211-1/+1
| | | | | | not the default one (which is always empty). llvm-svn: 84721
* Rewrite TreeTransform to transform types as DeclaratorInfos rather than as bareJohn McCall2009-10-211-256/+655
| | | | | | QualTypes. Don't actually exploit this yet. llvm-svn: 84716
* Handle substitutions into the "first qualifier in scope" of aDouglas Gregor2009-10-201-5/+19
| | | | | | | qualified member access expression (e.g., t->U::member) when that first qualifier refers to a template parameters. llvm-svn: 84612
* Parse a simple-template-id following a '~' when calling a destructor, e.g.,Douglas Gregor2009-10-191-8/+31
| | | | | | | | t->~T<A0, A1>() Fixes PR5213. llvm-svn: 84545
* When performing template-substitution into a type, don't just replace theJohn McCall2009-10-181-0/+7
| | | | | | | | | | | | | | | | | | TemplateTypeParmType with the substituted type directly; instead, replace it with a SubstTemplateTypeParmType which will note that the type was originally written as a template type parameter. This makes it reasonable to preserve source information even through template substitution. Also define the new SubstTemplateTypeParmType class, obviously. For consistency with current behavior, we stringize these types as if they were the underlying type. I'm not sure this is the right thing to do. At any rate, I paled at adding yet another clause to the don't-desugar 'if' statement, so I extracted a function to do it. The new function also does The Right Thing more often, I think: e.g. if we have a chain of typedefs leading to a vector type, we will now desugar all but the last one. llvm-svn: 84412
* Remove the ConstantArrayType subtypes. This information is preserved in theJohn McCall2009-10-161-92/+0
| | | | | | | | | | TypeLoc records for declarations; it should not be necessary to represent it directly in the type system. Please complain if you were using these classes and feel you can't replicate previous functionality using the TypeLoc API. llvm-svn: 84222
* Introduce ObjCProtocolListType type subclass.Argyrios Kyrtzidis2009-09-291-0/+7
| | | | | | | | | This is used only for keeping detailed type source information for protocol references, it should not participate in the semantics of the type system. Its protocol list is not canonicalized. llvm-svn: 83093
* Refactor the representation of qualifiers to bring ExtQualType out of theJohn McCall2009-09-241-25/+22
| | | | | | | | 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
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-1110/+1109
| | | | llvm-svn: 81346
* Initial stab at implement dependent member references to memberDouglas Gregor2009-09-091-40/+112
| | | | | | | | | | | | | templates, e.g., x.template get<T> We can now parse these, represent them within an UnresolvedMemberExpr expression, then instantiate that expression node in simple cases. This allows us to stumble through parsing LLVM's Casting.h. llvm-svn: 81300
* BuildCXXConstructExpr now takes a MultiExprArg.Anders Carlsson2009-09-071-3/+1
| | | | llvm-svn: 81160
* Pass the ConstructLoc to BuildCXXConstructExpr.Anders Carlsson2009-09-051-1/+3
| | | | llvm-svn: 81068
OpenPOWER on IntegriCloud