summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/StmtPrinter.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Add a CXXConstructExpr that represents an implicit call to a C++ ↵Anders Carlsson2009-04-231-0/+4
| | | | | | constructor. I think CXXTemporaryObjectExpr is going to become a subclass of CXXConstructExpr, since CXXTemporaryObjectExpr represents a syntactic temporary, for example T() llvm-svn: 69854
* Add a CXXDestroyExpr. Add classof member functions to CXXTempVarDecl.Anders Carlsson2009-04-211-0/+4
| | | | llvm-svn: 69654
* Audit __private_extern__ handling.Daniel Dunbar2009-04-141-9/+3
| | | | | | | | | | | | | | - Exposed quite a few Sema issues and a CodeGen crash. - See FIXMEs in test case, and in SemaDecl.cpp (PR3983). I'm skeptical that __private_extern__ should actually be a storage class value. I think that __private_extern__ basically amounts to extern A __attribute__((visibility("hidden"))) and would be better off handled (a) as that, or (b) with an extra bit in the VarDecl. llvm-svn: 69020
* Propagate the ASTContext to various AST traversal and lookup functions.Douglas Gregor2009-04-091-1/+5
| | | | | | No functionality change (really). llvm-svn: 68726
* Some cleanup and renaming. No functionality changeDouglas Gregor2009-03-311-2/+2
| | | | llvm-svn: 68140
* Revamp our representation of C++ nested-name-specifiers. We now have aDouglas Gregor2009-03-261-2/+2
| | | | | | | | | | | uniqued representation that should both save some memory and make it far easier to properly build canonical types for types involving dependent nested-name-specifiers, e.g., "typename T::Nested::type". This approach will greatly simplify the representation of CXXScopeSpec. That'll be next. llvm-svn: 67799
* Introduce a new expression type, UnresolvedDeclRefExpr, that describesDouglas Gregor2009-03-191-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | dependent qualified-ids such as Fibonacci<N - 1>::value where N is a template parameter. These references are "unresolved" because the name is dependent and, therefore, cannot be resolved to a declaration node (as we would do for a DeclRefExpr or QualifiedDeclRefExpr). UnresolvedDeclRefExprs instantiate to DeclRefExprs, QualifiedDeclRefExprs, etc. Also, be a bit more careful about keeping only a single set of specializations for a class template, and instantiating from the definition of that template rather than a previous declaration. In general, we need a better solution for this for all TagDecls, because it's too easy to accidentally look at a declaration that isn't the definition. We can now process a simple Fibonacci computation described as a template metaprogram. llvm-svn: 67308
* Generalize printing of nested-name-specifier sequences for use in bothDouglas Gregor2009-03-191-20/+2
| | | | | | | | QualifiedNameType and QualifiedDeclRefExpr. We now keep track of the exact nested-name-specifier spelling for a QualifiedDeclRefExpr, and use that spelling when printing ASTs. This fixes PR3493. llvm-svn: 67283
* Remove some now-unneeded calls to llvm::errs().flush().Daniel Dunbar2009-03-101-3/+1
| | | | llvm-svn: 66555
* add some helper methods to AsmStmt and add some comments.Chris Lattner2009-03-101-2/+2
| | | | llvm-svn: 66521
* Fix <rdar://problem/6640991> Exception handling executes wrong clause ↵Steve Naroff2009-03-031-3/+3
| | | | | | | | | | | (Daniel, please verify). Also necessary to fix: <rdar://problem/6632061> [sema] non object types should not be allowed in @catch statements <rdar://problem/6252237> [sema] qualified id should be disallowed in @catch statements llvm-svn: 65964
* Change the AST generated for offsetof a bit so that it looks like a Eli Friedman2009-02-271-1/+1
| | | | | | | | normal expression, and change Evaluate and IRGen to evaluate it like a normal expression. This simplifies the code significantly, and fixes PR3396. llvm-svn: 65622
OpenPOWER on IntegriCloud