summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/StmtPrinter.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Create a new TypeNodes.def file that enumerates all of the types,Douglas Gregor2009-02-261-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | giving them rough classifications (normal types, never-canonical types, always-dependent types, abstract type representations) and making it far easier to make sure that we've hit all of the cases when decoding types. Switched some switch() statements on the type class over to using this mechanism, and filtering out those things we don't care about. For example, CodeGen should never see always-dependent or non-canonical types, while debug info generation should never see always-dependent types. More switch() statements on the type class need to be moved over to using this approach, so that we'll get warnings when we add a new type then fail to account for it somewhere in the compiler. As part of this, some types have been renamed: TypeOfExpr -> TypeOfExprType FunctionTypeProto -> FunctionProtoType FunctionTypeNoProto -> FunctionNoProtoType There shouldn't be any functionality change... llvm-svn: 65591
* rip out __builtin_overloadChris Lattner2009-02-181-9/+0
| | | | llvm-svn: 64961
* Add private extern to pretty printer(s).Mike Stump2009-02-101-5/+6
| | | | llvm-svn: 64258
* Fixup -ast-print so that:Mike Stump2009-02-101-11/+26
| | | | | | | | | | | | | | We handle indentation of decls better. We Indent extern "C" { } stuff better. We print out structure contents more often. We handle pass indentation information into the statement printer, so that nested things come out more indented. We print out FieldDecls. We print out Vars. We print out namespaces. We indent functions better. llvm-svn: 64232
* Fix pretty-printing of if conditions. Patch by Ben Lickly.Sebastian Redl2009-02-071-1/+2
| | | | llvm-svn: 64027
* Fix our semantic analysis ofDouglas Gregor2009-02-041-2/+2
| | | | | | | | | | | | | | | | | | | | | unqualified-id '(' in C++. The unqualified-id might not refer to any declaration in our current scope, but declarations by that name might be found via argument-dependent lookup. We now do so properly. As part of this change, CXXDependentNameExpr, which was previously designed to express the unqualified-id in the above constructor within templates, has become UnresolvedFunctionNameExpr, which does effectively the same thing but will work for both templates and non-templates. Additionally, we cope with all unqualified-ids, since ADL also applies in cases like operator+(x, y) llvm-svn: 63733
* Introduce a new expression node, ImplicitValueInitExpr, thatDouglas Gregor2009-01-291-0/+4
| | | | | | | | | | | | | represents an implicit value-initialization of a subobject of a particular type. This replaces the (ab)use of CXXZeroValueInitExpr within initializer lists for the "holes" that occur due to the use of C99 designated initializers. The new test case is currently XFAIL'd, because CodeGen's ConstExprEmitter (in lib/CodeGen/CGExprConstant.cpp) needs to be taught to value-initialize when it sees ImplicitValueInitExprs. llvm-svn: 63317
* Code generation support for C99 designated initializers.Douglas Gregor2009-01-281-3/+30
| | | | | | | | | | | | | | | | | | | | The approach I've taken in this patch is relatively straightforward, although the code itself is non-trivial. Essentially, as we process an initializer list we build up a fully-explicit representation of the initializer list, where each of the subobject initializations occurs in order. Designators serve to "fill in" subobject initializations in a non-linear way. The fully-explicit representation makes initializer lists (both with and without designators) easy to grok for codegen and later semantic analyses. We keep the syntactic form of the initializer list linked into the AST for those clients interested in exactly what the user wrote. Known limitations: - Designating a member of a union that isn't the first member may result in bogus initialization (we warn about this) - GNU array-range designators are not supported (we warn about this) llvm-svn: 63242
* Initial implementation of semantic analysis and ASTs for C99Douglas Gregor2009-01-221-0/+4
| | | | | | | | | | | | | | | | | | designated initializers. This implementation should cover all of the constraints in C99 6.7.8, including long, complex designations and computing the size of incomplete array types initialized with a designated initializer. Please see the new test-case and holler if you find cases where this doesn't work. There are still some wrinkles with GNU's anonymous structs and anonymous unions (it isn't clear how these should work; we'll just follow GCC's lead) and with designated initializers for the members of a union. I'll tackle those very soon. CodeGen is still nonexistent, and there's some leftover code in the parser's representation of designators that I'll also need to clean up. llvm-svn: 62737
* Remove ScopedDecl, collapsing all of its functionality into Decl, soDouglas Gregor2009-01-201-7/+3
| | | | | | | | | | | | | | | | that every declaration lives inside a DeclContext. Moved several things that don't have names but were ScopedDecls (and, therefore, NamedDecls) to inherit from Decl rather than NamedDecl, including ObjCImplementationDecl and LinkageSpecDecl. Now, we don't store empty DeclarationNames for these things, nor do we try to insert them into DeclContext's lookup structure. The serialization tests are temporarily disabled. We'll re-enable them once we've sorted out the remaining ownership/serialiazation issues between DeclContexts and TranslationUnion, DeclGroups, etc. llvm-svn: 62562
* make ast-print handle random non-printable characters correctly with octal ↵Chris Lattner2009-01-161-3/+13
| | | | | | escapes. llvm-svn: 62337
* Part one of handling C++ functional casts. This handles semanticDouglas Gregor2009-01-161-0/+13
| | | | | | | | analysis and AST-building for the cases where we have N != 1 arguments. For N == 1 arguments, we need to finish the C++ implementation of explicit type casts (C++ [expr.cast]). llvm-svn: 62329
* Revert my previous, failed attempt to pretty-print anonymous struct/union ↵Douglas Gregor2009-01-081-4/+5
| | | | | | accesses well. Added a FIXME so we know to revisit this later llvm-svn: 61951
* Fix printing of member references to avoid displaying implicitly-generated ↵Douglas Gregor2009-01-071-2/+4
| | | | | | member references, e.g., for anonymous struct/unions or implicit 'this' in member functions llvm-svn: 61885
* Add QualifiedDeclRefExpr, which retains additional source-locationDouglas Gregor2009-01-061-0/+30
| | | | | | | | | | | | | | | | | | | information for declarations that were referenced via a qualified-id, e.g., N::C::value. We keep track of the location of the start of the nested-name-specifier. Note that the difference between QualifiedDeclRefExpr and DeclRefExpr does have an effect on the semantics of function calls in two ways: 1) The use of a qualified-id instead of an unqualified-id suppresses argument-dependent lookup 2) If the name refers to a virtual function, the qualified-id version will call the function determined statically while the unqualified-id version will call the function determined dynamically (by looking up the appropriate function in the vtable). Neither of these features is implemented yet, but we do print out qualified names for QualifiedDeclRefExprs as part of the AST printing. llvm-svn: 61789
* PODness and Type TraitsSebastian Redl2009-01-051-0/+26
| | | | | | | | | | | | | | | Make C++ classes track the POD property (C++ [class]p4) Track the existence of a copy assignment operator. Implicitly declare the copy assignment operator if none is provided. Implement most of the parsing job for the G++ type traits extension. Fully implement the low-hanging fruit of the type traits: __is_pod: Whether a type is a POD. __is_class: Whether a type is a (non-union) class. __is_union: Whether a type is a union. __is_enum: Whether a type is an enum. __is_polymorphic: Whether a type is polymorphic (C++ [class.virtual]p1). llvm-svn: 61746
* Full AST support and better Sema support for C++ try-catch.Sebastian Redl2008-12-221-2/+18
| | | | llvm-svn: 61346
* Partial AST and Sema support for C++ try-catch.Sebastian Redl2008-12-221-0/+11
| | | | llvm-svn: 61337
* Add support for calls to overloaded member functions. Things to note:Douglas Gregor2008-12-221-0/+4
| | | | | | | | | | | | - Overloading has to cope with having both static and non-static member functions in the overload set. - The call may or may not have an implicit object argument, depending on the syntax (x.f() vs. f()) and the context (static vs. non-static member function). - We now generate MemberExprs for implicit member access expression. - We now cope with mutable whenever we're building MemberExprs. llvm-svn: 61329
* Add support for member references (E1.E2, E1->E2) with C++ semantics,Douglas Gregor2008-12-201-4/+1
| | | | | | | | | | which can refer to static data members, enumerators, and member functions as well as to non-static data members. Implement correct lvalue computation for member references in C++. Compute the result type of non-static data members of reference type properly. llvm-svn: 61294
* Add support for calls to dependent names within templates, e.g.,Douglas Gregor2008-12-061-0/+4
| | | | | | | | | | | | | | | | | | template<typename T> void f(T x) { g(x); // g is a dependent name, so don't even bother to look it up g(); // error: g is not a dependent name } Note that when we see "g(", we build a CXXDependentNameExpr. However, if none of the call arguments are type-dependent, we will force the resolution of the name "g" and replace the CXXDependentNameExpr with its result. GCC actually produces a nice error message when you make this mistake, and even offers to compile your code with -fpermissive. I'll do the former next, but I don't plan to do the latter. llvm-svn: 60618
* Several things...Steve Naroff2008-12-041-1/+1
| | | | | | | | | | | - Implement RewritePropertySetter(). While the routine is simple, there were some tricky changes to RewriteFunctionBodyOrGlobalInitializer(), the main rewriter loop. It also required some additional instance data to distinguish setters from getters, as well as some changes to RewritePropertyGetter(). - Implement FIXME: for pretty printing ObjCPropertyRefExpr's. - Changed ObjCPropertyRefExpr::getSourceRange() to point to the end of the property name (not the beginning). Also made a minor name change from "Loc"->"IdLoc" (to make it clear the Loc does not point to the "."). llvm-svn: 60540
* Correct pretty printing of array new expressions.Sebastian Redl2008-12-021-4/+9
| | | | llvm-svn: 60444
* Handle new by passing the Declaration to the Action, not a processed type.Sebastian Redl2008-12-021-0/+3
| | | | llvm-svn: 60413
* Implement the GNU __null extensionDouglas Gregor2008-11-291-0/+4
| | | | llvm-svn: 60235
* Migrate some stuff from NamedDecl::getName() to Chris Lattner2008-11-241-12/+12
| | | | | | NamedDecl::getNameAsString() to make it more explicit. llvm-svn: 59937
* Rename Selector::getName() to Selector::getAsString(), and addChris Lattner2008-11-241-1/+1
| | | | | | | | | | | | | a new NamedDecl::getAsString() method. Change uses of Selector::getName() to just pass in a Selector where possible (e.g. to diagnostics) instead of going through an std::string. This also adds new formatters for objcinstance and objcclass as described in the dox. llvm-svn: 59933
* New AST node to access "implicit" setter/getter using property dor syntax.Fariborz Jahanian2008-11-221-0/+8
| | | | | | | Issuing diagnostics when assigning to read-only properties. This is work in progress. llvm-svn: 59874
* Implementation of new and delete parsing and sema.Sebastian Redl2008-11-211-0/+43
| | | | | | This version uses VLAs to represent arrays. I'll try an alternative way next, but I want this safe first. llvm-svn: 59835
* Add a new expression node, CXXOperatorCallExpr, which expresses aDouglas Gregor2008-11-141-0/+43
| | | | | | | | | | | | | | | | | | | function call created in response to the use of operator syntax that resolves to an overloaded operator in C++, e.g., "str1 + str2" that resolves to std::operator+(str1, str2)". We now build a CXXOperatorCallExpr in C++ when we pick an overloaded operator. (But only for binary operators, where we actually implement overloading) I decided *not* to refactor the current CallExpr to make it abstract (with FunctionCallExpr and CXXOperatorCallExpr as derived classes). Doing so would allow us to make CXXOperatorCallExpr a little bit smaller, at the cost of making the argument and callee accessors virtual. We won't know if this is going to be a win until we can parse lots of C++ code to determine how much memory we'll save by making this change vs. the performance penalty due to the extra virtual calls. llvm-svn: 59306
* Don't require us to manually number the statements and expressions in ↵Douglas Gregor2008-11-141-1/+1
| | | | | | StmtNodes.def. We don't need stable numbers yet, renumbering is a pain, and LAST_STMT had the wrong value anyway. llvm-svn: 59300
* Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof ↵Sebastian Redl2008-11-111-6/+9
| | | | | | expressions, both of values and types. llvm-svn: 59057
* Implement C++ 'typeid' parsing and sema.Sebastian Redl2008-11-111-0/+10
| | | | llvm-svn: 59042
* Add a new expression class, ObjCSuperExpr, to handle the Objective-C ↵Douglas Gregor2008-11-041-3/+4
| | | | | | 'super'. Remove ObjCThis from PredefinedExpr llvm-svn: 58698
* Create a new expression class, CXXThisExpr, to handle the C++ 'this' primary ↵Douglas Gregor2008-11-041-0/+4
| | | | | | expression. Remove CXXThis from PredefinedExpr llvm-svn: 58695
* Rename ExplicitCCastExpr to CStyleCastExprDouglas Gregor2008-10-281-1/+1
| | | | llvm-svn: 58331
* Refactor the expression class hierarchy for casts. Most importantly:Douglas Gregor2008-10-271-4/+23
| | | | | | | | | | | | | | | | | | | | | | - CastExpr is the root of all casts - ImplicitCastExpr is (still) used for all explicit casts - ExplicitCastExpr is now the root of all *explicit* casts - ExplicitCCastExpr (new name needed!?) is a C-style cast in C or C++ - CXXFunctionalCastExpr inherits from ExplicitCastExpr - CXXNamedCastExpr inherits from ExplicitCastExpr and is the root of all of the C++ named cast expression types (static_cast, dynamic_cast, etc.) - Added classes CXXStaticCastExpr, CXXDynamicCastExpr, CXXReinterpretCastExpr, and CXXConstCastExpr to Also, fixed returned-stack-addr.cpp, which broke once when we fixed reinterpret_cast to diagnose double->int* conversions and again when we eliminated implicit conversions to reference types. The fix is in both testcase and SemaChecking.cpp. Most of this patch is simply support for the renaming. There's very little actual change in semantics. llvm-svn: 58264
* - Add BlockDecl AST node.Steve Naroff2008-10-081-6/+7
| | | | | | | | | | - Modify BlockExpr to reference the BlockDecl. This is "cleanup" necessary to improve our lookup semantics for blocks (to fix <rdar://problem/6272905> clang block rewriter: parameter to function not imported into block?). Still some follow-up work to finish this (forthcoming). llvm-svn: 57298
OpenPOWER on IntegriCloud