summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/StmtSerialization.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove ScopedDecl, collapsing all of its functionality into Decl, soDouglas Gregor2009-01-201-34/+4
| | | | | | | | | | | | | | | | 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
* Part one of handling C++ functional casts. This handles semanticDouglas Gregor2009-01-161-0/+38
| | | | | | | | 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
* Add QualifiedDeclRefExpr, which retains additional source-locationDouglas Gregor2009-01-061-0/+14
| | | | | | | | | | | | | | | | | | | 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/+19
| | | | | | | | | | | | | | | 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
* Fix try statement deserialization.Sebastian Redl2008-12-241-0/+3
| | | | llvm-svn: 61421
* Full AST support and better Sema support for C++ try-catch.Sebastian Redl2008-12-221-0/+16
| | | | llvm-svn: 61346
* Partial AST and Sema support for C++ try-catch.Sebastian Redl2008-12-221-0/+17
| | | | llvm-svn: 61337
* Add support for member references (E1.E2, E1->E2) with C++ semantics,Douglas Gregor2008-12-201-1/+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
* Removed a slot in ObjCMemRegExpr used inFariborz Jahanian2008-12-181-1/+1
| | | | | | code gen which did not belong there. llvm-svn: 61203
* Warning fixes to operator precedence warnings.Eli Friedman2008-12-161-1/+1
| | | | | | | Someone should double-check that I didn't somehow break ObjC serialization; I think the change there actually changes the semantics. llvm-svn: 61098
* Patch for ObjCIvarRefExpr containing the fieldFariborz Jahanian2008-12-131-1/+1
| | | | | | matching the storage layout for this ivar llvm-svn: 60996
* Add support for calls to dependent names within templates, e.g.,Douglas Gregor2008-12-061-0/+17
| | | | | | | | | | | | | | | | | | 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
* Fix some type punning errors in SizeOfAlignOf and Typeid AST nodes. This ↵Sebastian Redl2008-12-031-1/+1
| | | | | | should satisfy compilers and language lawyers alike. llvm-svn: 60511
* Handle new by passing the Declaration to the Action, not a processed type.Sebastian Redl2008-12-021-7/+9
| | | | llvm-svn: 60413
* Use EmitInt, not Emit, to emit unsigned valuesDouglas Gregor2008-12-011-2/+2
| | | | llvm-svn: 60364
* Implement the GNU __null extensionDouglas Gregor2008-11-291-0/+17
| | | | llvm-svn: 60235
* Support for implicit property assignment. Error assigning toFariborz Jahanian2008-11-221-1/+1
| | | | | | 'implicit' property with no 'setter'. llvm-svn: 59878
* New AST node to access "implicit" setter/getter using property dor syntax.Fariborz Jahanian2008-11-221-15/+19
| | | | | | | 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/+69
| | | | | | 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-3/+6
| | | | | | | | | | | | | | | | | | | 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
* Implement support for operator overloading using candidate operatorDouglas Gregor2008-11-121-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | functions for built-in operators, e.g., the builtin bool operator==(int const*, int const*) can be used for the expression "x1 == x2" given: struct X { operator int const*(); } x1, x2; The scheme for handling these built-in operators is relatively simple: for each candidate required by the standard, create a special kind of candidate function for the built-in. If overload resolution picks the built-in operator, we perform the appropriate conversions on the arguments and then let the normal built-in operator take care of it. There may be some optimization opportunity left: if we can reduce the number of built-in operator overloads we generate, overload resolution for these cases will go faster. However, one must be careful when doing this: GCC generates too few operator overloads in our little test program, and fails to compile it because none of the overloads it generates match. Note that we only support operator overload for non-member binary operators at the moment. The other operators will follow. As part of this change, ImplicitCastExpr can now be an lvalue. llvm-svn: 59148
* Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof ↵Sebastian Redl2008-11-111-7/+18
| | | | | | expressions, both of values and types. llvm-svn: 59057
* Implement C++ 'typeid' parsing and sema.Sebastian Redl2008-11-111-0/+28
| | | | llvm-svn: 59042
* Add a new expression class, ObjCSuperExpr, to handle the Objective-C ↵Douglas Gregor2008-11-041-0/+14
| | | | | | 'super'. Remove ObjCThis from PredefinedExpr llvm-svn: 58698
* Create a new expression class, CXXThisExpr, to handle the C++ 'this' primary ↵Douglas Gregor2008-11-041-1/+15
| | | | | | expression. Remove CXXThis from PredefinedExpr llvm-svn: 58695
* Fix <rdar://problem/6339636> clang ObjC rewriter: Assertion failed: FileID-1 ↵Steve Naroff2008-11-031-3/+5
| | | | | | < FileIDs.size() && "Invalid FileID!", file c:\cygwin\home\Administrator\llvm\tools\clang\include\clang/Basic/SourceManager.h, line 513 llvm-svn: 58654
* Rename ExplicitCCastExpr to CStyleCastExprDouglas Gregor2008-10-281-5/+5
| | | | llvm-svn: 58331
* Refactor the expression class hierarchy for casts. Most importantly:Douglas Gregor2008-10-271-7/+50
| | | | | | | | | | | | | | | | | | | | | | - 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
* Preliminary support for function overloadingDouglas Gregor2008-10-211-2/+2
| | | | llvm-svn: 57909
* Use BatchEmitOwnedPtrs for writing multiple child exprs, per review.Daniel Dunbar2008-10-151-12/+28
| | | | | | Also added serialization support to OverloadExpr. llvm-svn: 57588
* Add serialization support in several missing places.Daniel Dunbar2008-10-141-0/+105
| | | | llvm-svn: 57502
* - Add BlockDecl AST node.Steve Naroff2008-10-081-9/+3
| | | | | | | | | | - 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
* Migrate DeclStmt over to using a DeclGroup instead of a pointer to a ↵Ted Kremenek2008-10-071-4/+4
| | | | | | | | ScopedDecl*. This also removes the ugly hack needed in CFG.cpp for subclassing DeclStmt to create a DeclStmt with one Decl*. llvm-svn: 57275
* Don't use DeclStmt::getDecl() to serialize out DeclStmt; use TheDecl directly.Ted Kremenek2008-10-061-1/+1
| | | | | | This patch precedes removing getDecl() DeclStmt::entirely. llvm-svn: 57205
* Remove BlockStmtExpr. Steve Naroff2008-09-171-2/+2
| | | | | | | | Block literals are now represented by the concrete BlockExpr class. This is cleanup (removes a FIXME). No functionality change. llvm-svn: 56288
* Add semantic analysis for "blocks". Steve Naroff2008-09-031-0/+32
| | | | | | | | | | | | | | | Highlights... - 4 new AST nodes, BlockExpr, BlockStmtExpr, BlockExprExpr, BlockDeclRefExpr. - Sema::ActOnBlockStart(), ActOnBlockError(), ActOnBlockStmtExpr(), ActOnBlockExprExpr(), ActOnBlockReturnStmt(). Next steps... - hack Sema::ActOnIdentifierExpr() to deal with block decl refs. - add attribute handler for byref decls. - add test cases. llvm-svn: 55710
* Fix ObjCPropertRefExpr to be able to encode all the information forDaniel Dunbar2008-09-031-2/+15
| | | | | | | uses which refer to methods not properties. - Not yet wired in Sema. llvm-svn: 55681
* Add support for C++'s "type-specifier ( expression-list )" expression:Argyrios Kyrtzidis2008-08-221-0/+36
| | | | | | | | | | -The Parser calls a new "ActOnCXXTypeConstructExpr" action. -Sema, depending on the type and expressions number: -If the type is a class, it will treat it as a class constructor. [TODO] -If there's only one expression (i.e. "int(0.5)" ), creates a new "CXXFunctionalCastExpr" Expr node -If there are no expressions (i.e "int()" ), creates a new "CXXZeroInitValueExpr" Expr node. llvm-svn: 55177
* Add ExplicitCastExpr to replace the current CastExpr, and have ↵Argyrios Kyrtzidis2008-08-181-8/+8
| | | | | | | | | | | ImplicitCastExpr and ExplicitCastExpr derive from a common base class (CastExpr): Expr -> CastExpr -> ExplicitCastExpr -> ImplicitCastExpr llvm-svn: 54955
* Cleanup ObjCSuperRefExpr (remove last usage and AST node:-).Steve Naroff2008-08-101-11/+0
| | | | llvm-svn: 54617
* rename PreDefinedExpr -> PredefinedExprChris Lattner2008-08-101-5/+5
| | | | llvm-svn: 54605
* Fix serialization of DeclStmt.Ted Kremenek2008-08-061-19/+3
| | | | llvm-svn: 54428
* Reorder serialization methods.Ted Kremenek2008-08-061-20/+35
| | | | | | When serializing DeclStmt, encode a bit indicating whether or not the DeclStmt owns the Decl. This is an interim solution. llvm-svn: 54410
* Update serialization for ObjCMessageExpr to handle additional bit-swizziling ↵Ted Kremenek2008-06-241-8/+12
| | | | | | of receiver information. llvm-svn: 52679
* This patch is motivated by numerous strict-aliasing warnings when compilingTed Kremenek2008-06-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | clang as a Release build. The big change is that all AST nodes (subclasses of Stmt) whose children are Expr* store their children as Stmt* or arrays of Stmt*. This is to remove strict-aliasing warnings when using StmtIterator. None of the interfaces of any of the classes have changed (except those with arg_iterators, see below), as the accessor methods introduce the needed casts (via cast<>). While this extra casting may seem cumbersome, it actually adds some important sanity checks throughout the codebase, as clients using StmtIterator can potentially overwrite children that are expected to be Expr* with Stmt* (that aren't Expr*). The casts provide extra sanity checks that are operational in debug builds to catch invariant violations such as these. For classes that have arg_iterators (e.g., CallExpr), the definition of arg_iterator has been replaced. Instead of it being Expr**, it is an actual class (called ExprIterator) that wraps a Stmt**, and provides the necessary operators for iteration. The nice thing about this class is that it also uses cast<> to type-checking, which introduces extra sanity checks throughout the codebase that are useful for debugging. A few of the CodeGen functions that use arg_iterator (especially from OverloadExpr) have been modified to take begin and end iterators instead of a base Expr** and the number of arguments. This matches more with the abstraction of iteration. This still needs to be cleaned up a little bit, as clients expect that ExprIterator is a RandomAccessIterator (which we may or may not wish to allow for efficiency of representation). This is a fairly large patch. It passes the tests (except CodeGen/bitfield.c, which was already broken) on both a Debug and Release build, but it should obviously be reviewed. llvm-svn: 52378
* capture whether a CharacterLiteral was wide or not in the AST. Chris Lattner2008-06-071-1/+3
| | | | | | Patch by Mike Stump! llvm-svn: 52081
* Fix <rdar://problem/5979875> clang on xcode: error: use of undeclared ↵Steve Naroff2008-06-021-0/+11
| | | | | | identifier 'super' llvm-svn: 51888
* Add basic support for properties references (a missing feature).Steve Naroff2008-05-301-0/+15
| | | | | | While it is far from complete, it does fix the following <rdar://problem/5967199> clang on xcode: error: member reference is not to a structure or union llvm-svn: 51719
* - Move ObjC Expresssion AST's from Expr.h => ExprObjC.hSteve Naroff2008-05-291-0/+1
| | | | | | - #include ExprObjC.h in many places llvm-svn: 51703
OpenPOWER on IntegriCloud