summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/StmtPrinter.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use CXXPseudoDestructorExpr as the stored representation for dependentDouglas Gregor2010-02-251-1/+4
| | | | | | | | | | | | | | | | expressions that look like pseudo-destructors, e.g., p->T::~T() where p has dependent type. At template instantiate time, we determine whether we actually have a pseudo-destructor or a member access, and funnel down to the appropriate routine in Sema. Fixes PR6380. llvm-svn: 97092
* Add an CXXBindReferenceExpr (not used just yet).Anders Carlsson2010-01-291-0/+4
| | | | llvm-svn: 94791
* Fixes a rewrite bug rewriting a block call argument which has a trvialFariborz Jahanian2010-01-131-0/+7
| | | | | | constructor. Fixes radar 7537770. llvm-svn: 93358
* Fix a problem related to rewrite of anonymous unions.Fariborz Jahanian2010-01-111-2/+3
| | | | | | (fixes radar 6948022) llvm-svn: 93186
* Rework how we support C++ implicit member accesses. If we can resolve anJohn McCall2009-12-011-6/+10
| | | | | | | | | | | | | | | 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-0/+18
| | | | | | | | 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
* Remove VISIBILITY_HIDDEN from lib/AST.Benjamin Kramer2009-11-281-2/+1
| | | | llvm-svn: 90043
* Eliminate CXXConditionDeclExpr with extreme prejudice.Douglas Gregor2009-11-251-5/+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
* Rip out TemplateIdRefExpr and make UnresolvedLookupExpr and John McCall2009-11-241-8/+10
| | | | | | | | | | | | 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
* "Incremental" progress on using expressions, by which I mean totally rippingJohn McCall2009-11-211-4/+4
| | | | | | | | | | | | | | | | | | | | | | 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
* Draw a brighter line between "unresolved" expressions, where we have done theJohn McCall2009-11-191-2/+4
| | | | | | | | 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
* Eliminate QualifiedDeclRefExpr, which captured the notion of aDouglas Gregor2009-10-231-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | 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
* While writing source-location entries to a PCH file, go through anDouglas Gregor2009-10-161-1/+1
| | | | | | | interface that can load those source-location entries on demand (from another PCH file). llvm-svn: 84287
* Change all the Type::getAsFoo() methods to specializations of Type::getAs().John McCall2009-09-211-1/+1
| | | | | | | | | | | Several of the existing methods were identical to their respective specializations, and so have been removed entirely. Several more 'leaf' optimizations were introduced. The getAsFoo() methods which imposed extra conditions, like getAsObjCInterfacePointerType(), have been left in place. llvm-svn: 82501
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-69/+68
| | | | llvm-svn: 81346
* Initial stab at implement dependent member references to memberDouglas Gregor2009-09-091-2/+11
| | | | | | | | | | | | | 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
* Implement AST, semantics, and CodeGen for C++ pseudo-destructorDouglas Gregor2009-09-041-0/+14
| | | | | | | | | | | | | 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
* Improved handling for dependent, qualified member access expressions, e.g.,Douglas Gregor2009-09-031-0/+2
| | | | | | | | | | | | | | | 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
* Preliminary AST representation and semantic analysis forDouglas Gregor2009-09-011-0/+6
| | | | | | | | | 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-10/+3
| | | | | | | | 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-1/+1
| | | | | | | also be adding explicit template arguments as an additional "adornment". No functionality change. llvm-svn: 80628
* When a member reference expression includes a qualifier on the memberDouglas Gregor2009-08-261-0/+10
| | | | | | | | | | | | | | | | | 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
* Replace cerr with errs().Benjamin Kramer2009-08-231-1/+0
| | | | llvm-svn: 79854
* Using "ObjCImplicitSetterGetterRefExpr" instead of ↵Fariborz Jahanian2009-08-201-2/+2
| | | | | | | | "ObjCImplctSetterGetterRefExpr". A field rename and more comments. llvm-svn: 79537
* Renamed ObjCKVCRefExpr to ObjCImplctSetterGetterRefExpr.Fariborz Jahanian2009-08-181-2/+5
| | | | | | | | 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
* Take 2 on AltiVec-style vector initializers. Nate Begeman2009-08-101-0/+9
| | | | | | | | | | | | Fixes PR4704 problems Addresses Eli's patch feedback re: ugly cast code Updates all postfix operators to remove ParenListExprs. While this is awful, no better solution (say, in the parser) is obvious to me. Better solutions welcome. llvm-svn: 78621
* Revert r78535, it is causing a number of failures to build projects.Daniel Dunbar2009-08-101-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | --- Reverse-merging r78535 into '.': D test/Sema/altivec-init.c U include/clang/Basic/DiagnosticSemaKinds.td U include/clang/AST/Expr.h U include/clang/AST/StmtNodes.def U include/clang/Parse/Parser.h U include/clang/Parse/Action.h U tools/clang-cc/clang-cc.cpp U lib/Frontend/PrintParserCallbacks.cpp U lib/CodeGen/CGExprScalar.cpp U lib/Sema/SemaInit.cpp U lib/Sema/Sema.h U lib/Sema/SemaExpr.cpp U lib/Sema/SemaTemplateInstantiateExpr.cpp U lib/AST/StmtProfile.cpp U lib/AST/Expr.cpp U lib/AST/StmtPrinter.cpp U lib/Parse/ParseExpr.cpp U lib/Parse/ParseExprCXX.cpp llvm-svn: 78551
* AltiVec-style vector initializer syntax, vec4 a = (vec4)(a, b, c, d);Nate Begeman2009-08-091-0/+9
| | | | | | | | In addition to being defined by the AltiVec PIM, this is also the vector initializer syntax used by OpenCL, so that vector literals are compatible with macro arguments. llvm-svn: 78535
* Allow front-end 'isa' access on object's of type 'id'.Steve Naroff2009-07-241-0/+5
| | | | | | | | Enhance test case to cover 'isa' access on interface types (clang produces an error, GCC produces a warning). Still need back-end CodeGen for ObjCIsaExpr. llvm-svn: 76979
* In Stmt::printPretty(), pass the SourceManager to dump().Argyrios Kyrtzidis2009-07-141-1/+1
| | | | llvm-svn: 75606
* Preliminary parsing and ASTs for template-ids that refer to functionDouglas Gregor2009-06-301-0/+12
| | | | | | | templates, such as make<int&>. These template-ids are only barely functional for function calls; much more to come. llvm-svn: 74563
* Remove the ASTContext parameter from the printing related methods of Decl.Argyrios Kyrtzidis2009-06-301-3/+2
| | | | llvm-svn: 74503
* Key decisions about 'bool' vs '_Bool' to be based on a new flag in langoptions.Chris Lattner2009-06-301-3/+4
| | | | | | | | | | | | This is simple enough, but then I thought it would be nice to make PrintingPolicy get a LangOptions so that various things can key off "bool" and "C++" independently. This spiraled out of control. There are many fixme's, but I think things are slightly better than they were before. One thing that can be improved: CFG should probably have an ASTContext pointer in it, which would simplify its clients. llvm-svn: 74493
* PR4391: Tweak -ast-print output to generate valid output for edge cases Eli Friedman2009-06-141-1/+7
| | | | | | like "int x = + +3;". llvm-svn: 73356
* Add a CXXBindTemporaryExpr.Anders Carlsson2009-05-301-0/+4
| | | | llvm-svn: 72627
* Pass an ASTContext into Stmt::printPretty.Eli Friedman2009-05-301-1/+1
| | | | llvm-svn: 72612
* Add a Stmt::printPretty overload which takes an ASTContext; start Eli Friedman2009-05-301-8/+11
| | | | | | transitioning callers over to pass one in. llvm-svn: 72609
* Expose an API to print a group of decls (like "int a,b;"). Eli Friedman2009-05-301-184/+7
| | | | | | | | | | | | | | | | | Make StmtPrinter use DeclPrinter to print all declarations. Merge declarations in the limited case of an unnamed TagDecl followed by one or more declarations using that TagDecl directly. Change SuppressTypeSpecifiers to the more general SuppressSpecifiers, and use it to suppress stuff like "typedef" and "extern". Replace OwnedTag with SuppressTag, since it's more convenient to print declarations from DeclPrinter at the moment. improvements to declaration printing. Fix pretty-printing for K&R function definitions and __builtin_va_arg. We're now to the point where the pretty-printing output for non-trivial programs can actually be piped back into clang. llvm-svn: 72608
* Fix some test failures involving -ast-print.Eli Friedman2009-05-301-0/+5
| | | | llvm-svn: 72605
* Clean up printing for Objective-C, designated initializers.Douglas Gregor2009-05-301-0/+5
| | | | llvm-svn: 72602
* Some enhancements to DeclStmt printing. Some of this should Eli Friedman2009-05-301-24/+141
| | | | | | | move to DeclPrinter.cpp, but I haven't quite worked out how best to do that. llvm-svn: 72599
* Refactor and clean up the AST printer, so that it uses a DeclVisitor,Douglas Gregor2009-05-301-2/+15
| | | | | | | | | walks through DeclContexts properly, and prints more of the information available in the AST. The functionality is still available via -ast-print, -ast-dump, etc., and also via the new member functions Decl::dump() and Decl::print(). llvm-svn: 72597
* Create a new PrintingPolicy class, which we pass down through the ASTDouglas Gregor2009-05-291-18/+23
| | | | | | | | | printing logic to help customize the output. For now, we use this rather than a special flag to suppress the "struct" when printing "struct X" and to print the Boolean type as "bool" in C++ but "_Bool" in C. llvm-svn: 72590
* Representation of and template instantiation for memberDouglas Gregor2009-05-221-0/+6
| | | | | | | | | | | | expressions. This change introduces another AST node, CXXUnresolvedMemberExpr, that captures member references (x->m, x.m) when the base of the expression (the "x") is type-dependent, and we therefore cannot resolve the member reference yet. Note that our parsing of member references for C++ is still quite poor, e.g., we don't handle x->Base::m or x->operator int. llvm-svn: 72281
* Introduce a new expression type, CXXUnresolvedConstructExpr, toDouglas Gregor2009-05-201-0/+15
| | | | | | | | | | | | | | | | | | describe the construction of a value of a given type using function syntax, e.g., T(a1, a2, ..., aN) when the type or any of its arguments are type-dependent. In this case, we don't know what kind of type-construction this will be: it might construct a temporary of type 'T' (which might be a class or non-class type) or might perform a conversion to type 'T'. Also, implement printing of and template instantiation for this new expression type. Due to the change in Sema::ActOnCXXTypeConstructExpr, our existing tests cover template instantiation of this new expression node. llvm-svn: 72176
* A couple of tweaks to make -ast-print produce code that's closer to Eli Friedman2009-05-171-2/+2
| | | | | | valid C code. llvm-svn: 71971
* Implement C++0x nullptr.Sebastian Redl2009-05-101-0/+4
| | | | llvm-svn: 71405
* Get rid of CXXDestroyExpr.Anders Carlsson2009-05-011-4/+0
| | | | llvm-svn: 70586
* Rename CXXExprWithCleanup to CXXExprWithTemporaries.Anders Carlsson2009-05-011-1/+1
| | | | llvm-svn: 70584
* Add CXXExprWithCleanupAnders Carlsson2009-04-241-0/+5
| | | | llvm-svn: 70000
OpenPOWER on IntegriCloud