summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/TreeTransform.h
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Basic support for representing elaborated type specifiersJohn McCall2009-09-051-0/+20
| | | | | | | | | | | | | | | directly in the AST. The current thinking is to create these only in C++ mode for efficiency. But for now, they're not being created at all; patch to follow. This will let us do things like verify that tags match during template instantation, as well as signal that an elaborated type specifier was used for clients that actually care. Optimally, the TypeLoc hierarchy should be adjusted to carry tag location information as well. llvm-svn: 81057
* Implement AST, semantics, and CodeGen for C++ pseudo-destructorDouglas Gregor2009-09-041-0/+67
| | | | | | | | | | | | | expressions, e.g., p->~T() when p is a pointer to a scalar type. We don't currently diagnose errors when pseudo-destructor expressions are used in any way other than by forming a call. llvm-svn: 81009
* Implement tree transformations for DeclarationNames. Among otherDouglas Gregor2009-09-031-5/+51
| | | | | | | | | | | things, this means that we can properly cope with member access expressions such as t->operator T() where T is a template parameter (or other dependent type). llvm-svn: 80957
* Improve template instantiation for member access expressions thatDouglas Gregor2009-09-031-16/+34
| | | | | | | | | involve qualified names, e.g., x->Base::f. We now maintain enough information in the AST to compare the results of the name lookup of "Base" in the scope of the postfix-expression (determined at template definition time) and in the type of the object expression. llvm-svn: 80953
* Improved handling for dependent, qualified member access expressions, e.g.,Douglas Gregor2009-09-031-20/+51
| | | | | | | | | | | | | | | t->Base::f where t has a dependent type. We save the nested-name-specifier in the CXXUnresolvedMemberExpr then, during instantiation, substitute into the nested-name-specifier with the (transformed) object type of t, so that we get name lookup into the type of the object expression. Note that we do not yet retain information about name lookup into the lexical scope of the member access expression, so several regression tests are still disabled. llvm-svn: 80925
* Rewrite of our handling of name lookup in C++ member access expressions, e.g.,Douglas Gregor2009-09-021-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | x->Base::f We no longer try to "enter" the context of the type that "x" points to. Instead, we drag that object type through the parser and pass it into the Sema routines that need to know how to perform lookup within member access expressions. We now implement most of the crazy name lookup rules in C++ [basic.lookup.classref] for non-templated code, including performing lookup both in the context of the type referred to by the member access and in the scope of the member access itself and then detecting ambiguities when the two lookups collide (p1 and p4; p3 and p7 are still TODO). This change also corrects our handling of name lookup within template arguments of template-ids inside the nested-name-specifier (p6; we used to look into the scope of the object expression for them) and fixes PR4703. I have disabled some tests that involve member access expressions where the object expression has dependent type, because we don't yet have the ability to describe dependent nested-name-specifiers starting with an identifier. llvm-svn: 80843
* Fix a crasher involving template instantiation of non-dependentDouglas Gregor2009-09-011-7/+3
| | | | | | | expressions making use of an overloaded operator. Thanks for the test case, Anders! llvm-svn: 80679
* Don't assert when instantiating member references to fields in anonymous ↵Anders Carlsson2009-09-011-0/+11
| | | | | | structs. llvm-svn: 80657
* Preliminary AST representation and semantic analysis forDouglas Gregor2009-09-011-1/+1
| | | | | | | | | explicitly-specified template argument lists in member reference expressions, e.g., x->f<int>() llvm-svn: 80646
* Eliminate CXXAdornedMemberExpr entirely. Instead, optionally allocateDouglas Gregor2009-08-311-64/+24
| | | | | | | | space within the MemberExpr for the nested-name-specifier and its source range. We'll do the same thing with explicitly-specified template arguments, assuming I don't flip-flop again. llvm-svn: 80642
* Rename CXXQualifiedMemberExpr -> CXXAdornedMemberExpr, since we willDouglas Gregor2009-08-311-13/+18
| | | | | | | also be adding explicit template arguments as an additional "adornment". No functionality change. llvm-svn: 80628
* Implement template instantiation for member operator access.Douglas Gregor2009-08-311-9/+7
| | | | llvm-svn: 80609
* When a member reference expression includes a qualifier on the memberDouglas Gregor2009-08-261-0/+60
| | | | | | | | | | | | | | | | | name, e.g., x->Base::f() retain the qualifier (and its source range information) in a new subclass of MemberExpr called CXXQualifiedMemberExpr. Provide construction, transformation, profiling, printing, etc., for this new expression type. When a virtual function is called via a qualified name, don't emit a virtual call. Instead, call that function directly. Mike, could you add a CodeGen test for this, too? llvm-svn: 80167
* Source location information for ? and : in a ConditionalOperator, from Enea ↵Douglas Gregor2009-08-261-5/+2
| | | | | | Zaffanella llvm-svn: 80097
* Improve support for out-of-line definitions of nested templates andDouglas Gregor2009-08-251-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | their members, including member class template, member function templates, and member classes and functions of member templates. To actually parse the nested-name-specifiers that qualify the name of an out-of-line definition of a member template, e.g., template<typename X> template<typename Y> X Outer<X>::Inner1<Y>::foo(Y) { return X(); } we need to look for the template names (e.g., "Inner1") as a member of the current instantiation (Outer<X>), even before we have entered the scope of the current instantiation. Since we can't do this in general (i.e., we should not be looking into all dependent nested-name-specifiers as if they were the current instantiation), we rely on the parser to tell us when it is parsing a declaration specifier sequence, and, therefore, when we should consider the current scope specifier to be a current instantiation. Printing of complicated, dependent nested-name-specifiers may be somewhat broken by this commit; I'll add tests for this issue and fix the problem (if it still exists) in a subsequent commit. llvm-svn: 80044
* BuildCXXConstructExpr now returns an OwningExprResult.Anders Carlsson2009-08-251-4/+2
| | | | llvm-svn: 79975
* fix a GCC type punning warning.Chris Lattner2009-08-241-4/+2
| | | | llvm-svn: 79895
* Using "ObjCImplicitSetterGetterRefExpr" instead of ↵Fariborz Jahanian2009-08-201-2/+2
| | | | | | | | "ObjCImplctSetterGetterRefExpr". A field rename and more comments. llvm-svn: 79537
* Refactor the instantiation of statements into a generic treeDouglas Gregor2009-08-201-15/+706
| | | | | | transformation. llvm-svn: 79519
* Introduce LocInfoType which is a Sema-specific implementation detail.Argyrios Kyrtzidis2009-08-191-1/+1
| | | | | | | | This is a Type subclass that can hold a DeclaratorInfo* when we have type source info coming out of a declarator that we want to preserve. This is used only at the "border" of Parser/Sema for passing/getting QualTypes, it does not participate in the type system semantics in any way. llvm-svn: 79394
* Renamed ObjCKVCRefExpr to ObjCImplctSetterGetterRefExpr.Fariborz Jahanian2009-08-181-1/+2
| | | | | | | | Removed an unnecessary loop to get to setters incoming argument. Added DoxyGen comments. Still more work to do in this area (WIP). llvm-svn: 79365
* BuildCXXConstructExpr doesn't need to take an ASTContext.Anders Carlsson2009-08-151-2/+1
| | | | llvm-svn: 79149
* Make the CXXDefaultArgExpr constructor protected and add a static Create ↵Anders Carlsson2009-08-141-1/+1
| | | | | | function. llvm-svn: 79013
* Fix DISABLE_SMART_POINTERS buildDouglas Gregor2009-08-111-1/+2
| | | | llvm-svn: 78674
* Refactor the template-instantiation logic for expressions into aDouglas Gregor2009-08-111-21/+2343
| | | | | | | generic tree transformation (also used for recanonicalization) and a small amount of template-instantiation-specific logic. llvm-svn: 78645
* Minor refactoring to introduce a new transformation function,Douglas Gregor2009-08-061-1/+18
| | | | | | TransformStmt, into the tree transformer. llvm-svn: 78347
* When we encounter a dependent type that was parsed before we know thatDouglas Gregor2009-08-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | we were going to enter into the scope of a class template or class template partial specialization, rebuild that type so that it can refer to members of the current instantiation, as in code like template<typename T> struct X { typedef T* pointer; pointer data(); }; template<typename T> typename X<T>::pointer X<T>::data() { ... } Without rebuilding the return type of this out-of-line definition, the canonical return type of the out-of-line definition (a TypenameType) will not match the canonical return type of the declaration (the canonical type of T*). llvm-svn: 78316
* Implement transformation of template names within the generic treeDouglas Gregor2009-08-061-2/+164
| | | | | | | | | | | | | | | transform, then use the result for template instantiation. The generic transformation fixes a few issues: - It copes better with template template parameters and member templates (when they're implemented). - The logic used to replace template template parameters with their arguments is now centralized in TransformDecl, so that it will apply for other declaration-instantiation steps. - The error-recovery strategy is normalized now, so that any error results in a NULL TemplateName. llvm-svn: 78292
* Implement transformation of nested-name-specifiers within the generalDouglas Gregor2009-08-061-4/+135
| | | | | | | tree transformation. Template instantiation uses this general transformation rather than implementing its own transformation. llvm-svn: 78286
OpenPOWER on IntegriCloud