summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/TreeTransform.h
Commit message (Collapse)AuthorAgeFilesLines
* Add an "implicit" bit to CXXThisExpr, so that we can trackDouglas Gregor2010-01-071-3/+5
| | | | | | | implicitness without losing track of the (logical or actual) location where "this" would occur in the source. llvm-svn: 92958
* Get rid of FixedWidthIntType, as suggested by Chris and Eli.Anders Carlsson2009-12-291-10/+0
| | | | llvm-svn: 92246
* Add test case for PR5868, and improve location information slightly for ↵Douglas Gregor2009-12-241-0/+1
| | | | | | implicit "this" expressions llvm-svn: 92141
* When rebuilding a MemberExpr that refers to an anonymous union, beDouglas Gregor2009-12-241-1/+4
| | | | | | | sure to perform derived-to-base conversions on the base expression. Fixes PR5868. Proper testcase is coming soon. llvm-svn: 92139
* When transforming CXXExprWithTemporaries and CXXBindTemporaryExprDouglas Gregor2009-12-241-20/+7
| | | | | | | | | expressions (e.g., for template instantiation), just transform the subexpressions and return those, since the temporary-related nodes will be implicitly regenerated. Fixes PR5867, but I said that before... llvm-svn: 92135
* When we see a CXXDefaultArgExpr during template instantiation, rebuildDouglas Gregor2009-12-231-3/+5
| | | | | | | | the default argument so that we're sure to mark any referenced declarations. This gets us another little step closer to fixing PR5810. llvm-svn: 92078
* When transforming a C++ "new" expression that was not explicitly givenDouglas Gregor2009-12-221-0/+25
| | | | | | | a size, check whether the transformed type is itself an array type. If so, take the major array bound as the size to allocate. Fixes PR5833. llvm-svn: 91907
* When we simply return a retained member expression when instantiating, we ↵Anders Carlsson2009-12-221-1/+6
| | | | | | must also mark the member decl as referenced. llvm-svn: 91887
* Check in a rudimentary FullExpr class that isn't used anywhere yet. Rename ↵Anders Carlsson2009-12-161-6/+6
| | | | | | Action::FullExpr to Action::MakeFullExpr to avoid name clashes. llvm-svn: 91494
* ShouldDestroyTemporaries? I don't think so.Anders Carlsson2009-12-151-2/+1
| | | | llvm-svn: 91450
* Improve template instantiation for object constructions in several ways:Douglas Gregor2009-12-141-31/+22
| | | | | | | | | | | | | - During instantiation, drop default arguments from constructor and call expressions; they'll be recomputed anyway, and we don't want to instantiate them twice. - Rewrote the instantiation of variable initializers to cope with non-dependent forms properly. Together, these fix a handful of problems I introduced with the switch to always rebuild expressions from the source code "as written." llvm-svn: 91315
* When rebuilding CXXConstructExprs after a transformation, useDouglas Gregor2009-12-141-5/+10
| | | | | | CompleteConstructorCall to perform type-checking. llvm-svn: 91279
* Fix template instantiation for non-dependent calls to overloaded callDouglas Gregor2009-12-131-0/+62
| | | | | | operators. Fixes PR5266. llvm-svn: 91252
* Rework the way we handle template instantiation forDouglas Gregor2009-12-121-35/+35
| | | | | | | | | | | | | | | | | | | | | | | implicitly-generated AST nodes. We previously built instantiated nodes for each of these AST nodes, then passed them on to Sema, which was not prepared to see already-type-checked nodes (see PR5755). In some places, we had ugly workarounds to try to avoid re-type-checking (e.g., in VarDecl initializer instantiation). Now, we skip implicitly-generated nodes when performing instantiation, preferring instead to build just the AST nodes that directly reflect what was written in the source code. This has several advantages: - We don't need to instantiate anything that doesn't have a direct correlation to the source code, so we can have better location information. - Semantic analysis sees the same thing at template instantiation time that it would see for a non-template. - At least one ugly hack (VarDecl initializers) goes away. Fixes PR5755. llvm-svn: 91218
* Un-namespace-qualify llvm_unreachable. It's a macro, so the qualification gaveJeffrey Yasskin2009-12-121-2/+2
| | | | | | no extra safety anyway. llvm-svn: 91207
* Implement redeclaration checking and hiding semantics for using ↵John McCall2009-12-101-4/+16
| | | | | | | | | | | declarations. There are a couple of O(n^2) operations in this, some analogous to the usual O(n^2) redeclaration problem and some not. In particular, retroactively removing shadow declarations when they're hidden by later decls is pretty unfortunate. I'm not yet convinced it's worse than the alternative, though. llvm-svn: 91045
* The refactor of implicit member access expressions means we don't need thisJohn McCall2009-12-081-175/+85
| | | | | | | | | horrible isAddressOfOperand hack in TreeTransform, since that syntactic information is managed by the initial parser callbacks now. That's enough insomniac commits for one night. llvm-svn: 90849
* DeclRefExpr stores a ValueDecl internally.John McCall2009-12-081-21/+29
| | | | | | Template instantiation can re-use DeclRefExprs. llvm-svn: 90848
* DeclaratorInfo -> TypeSourceInfo. Makes an effort to rename associated ↵John McCall2009-12-071-22/+22
| | | | | | | | | | | | | | | | | | | | | 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
* reapply my patch for PR4451, which improves diagnostics for :: vs : confusion.Chris Lattner2009-12-071-1/+1
| | | | | | This time with a fix to bail out when in a dependent context. llvm-svn: 90730
* revert my previous patch, it is breaking something and I don't have timeChris Lattner2009-12-061-1/+1
| | | | | | to fix it ATM. llvm-svn: 90717
* implement PR4451, improving error recovery for a mistaken : where a :: wasChris Lattner2009-12-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | intended. On the first testcase in the bug, we now produce: cxx-decl.cpp:12:2: error: unexpected ':' in nested name specifier y:a a2; ^ :: instead of: t.cc:8:1: error: C++ requires a type specifier for all declarations x:a a2; ^ t.cc:8:2: error: invalid token after top level declarator x:a a2; ^ ; t.cc:9:11: error: use of undeclared identifier 'a2' x::a a3 = a2; ^ llvm-svn: 90713
* Fix "using typename" and the instantiation of non-dependent using declarations.John McCall2009-12-041-0/+51
| | | | llvm-svn: 90614
* Make the type of the Decl referred to by a MemberExpr a bit more precise.Eli Friedman2009-12-041-3/+3
| | | | llvm-svn: 90549
* Rework how we support C++ implicit member accesses. If we can resolve anJohn McCall2009-12-011-25/+61
| | | | | | | | | | | | | | | implicit member access to a specific declaration, go ahead and create it as a DeclRefExpr or a MemberExpr (with implicit CXXThisExpr base) as appropriate. Otherwise, create an UnresolvedMemberExpr or DependentScopeMemberExpr with a null base expression. By representing implicit accesses directly in the AST, we get the ability to correctly delay the decision about whether it's actually an instance member access or not until resolution is complete. This permits us to correctly avoid diagnosing the 'problem' of 'MyType::foo()' where the relationship to the type isn't really known until instantiation. llvm-svn: 90266
* Eliminate the use of OverloadedFunctionDecl in member expressions.John McCall2009-11-301-83/+99
| | | | | | | | 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
* Add DeclarationName support for C++0x operator literals. They should now work asAlexis Hunt2009-11-291-0/+1
| | | | | | | function names outside of templates - they'll probably cause some damage there as they're largely untested. llvm-svn: 90064
* 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
OpenPOWER on IntegriCloud