summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Give OpaqueValueExpr a source location, because its source locationDouglas Gregor2011-01-281-1/+1
| | | | | | | | might be queried in places where we absolutely require a valid location (e.g., for template instantiation). Fixes some major brokenness in the use of __is_convertible_to. llvm-svn: 124465
* In a ObjCMessageExpr with the super class as receiver, 'super' is actually a ↵Argyrios Kyrtzidis2011-01-251-3/+3
| | | | | | ObjCInterfaceType. llvm-svn: 124158
* Refactor the dependence computation for DeclRefExpr so that we canDouglas Gregor2011-01-191-38/+68
| | | | | | | reuse it for BlockDeclRefExpr. Do so, fixing the dependence calculate for BlockDeclRefExpr. llvm-svn: 123851
* Implement basic support for the use of variadic templates and blocksDouglas Gregor2011-01-191-0/+12
| | | | | | | | | | | | | | | | | together. In particular: - Handle the use of captured parameter pack names within blocks (BlockDeclRefExpr understands parameter packs now) - Handle the declaration and expansion of parameter packs within a block's parameter list, e.g., ^(Args ...args) { ... }) - Handle instantiation of blocks where the return type was not explicitly specified. (unrelated, but necessary for my tests). Together, these fixes should make blocks and variadic templates work reasonably well together. Note that BlockDeclRefExpr is still broken w.r.t. its computation of type and value dependence, which will still cause problems for blocks in templates. llvm-svn: 123849
* Change QualType::getTypePtr() to return a const pointer, then change aJohn McCall2011-01-191-1/+1
| | | | | | thousand other things which were (generally inadvertantly) relying on that. llvm-svn: 123814
* PR3558: mark "logically const" accessor methods in ASTContext as const,Jay Foad2011-01-121-2/+2
| | | | | | | and mark the fields they use as mutable. This allows us to remove a few const_casts. llvm-svn: 123314
* Add Decl::isParameterPack(), which covers both function and templateDouglas Gregor2011-01-051-5/+2
| | | | | | | | parameter packs, along with ParmVarDecl::isParameterPack(), which looks for function parameter packs. Use these routines to fix some obvious FIXMEs. llvm-svn: 122904
* Refactor the tree transform's many loops over sets of expressionsDouglas Gregor2011-01-031-4/+4
| | | | | | | | | | | (transforming each in turn) into calls into one central routine (TransformExprs) that transforms a list of expressions. This refactoring is preparatory work for pack expansions whose in an expression-list. No functionality change. llvm-svn: 122761
* Add an AST representation for non-type template parameterDouglas Gregor2010-12-231-2/+8
| | | | | | | | | | | | | | packs, e.g., template<typename T, unsigned ...Dims> struct multi_array; along with semantic analysis support for finding unexpanded non-type template parameter packs in types, expressions, and so on. Template instantiation involving non-type template parameter packs probably doesn't work yet. That'll come soon. llvm-svn: 122527
* Variadic templates: extend the Expr class with a bit that specifiesDouglas Gregor2010-12-151-32/+136
| | | | | | | | | | | | | | | | | | whether the expression contains an unexpanded parameter pack, in the same vein as the changes to the Type hierarchy. Compute this bit within all of the Expr subclasses. This change required a bunch of reshuffling of dependency calculations, mainly to consolidate them inside the constructors and to fuse multiple loops that iterate over arguments to determine type dependence, value dependence, and (now) containment of unexpanded parameter packs. Again, testing is painfully sparse, because all of the diagnostics will change and it is more important to test the to-be-written visitor that collects unexpanded parameter packs. llvm-svn: 121831
* Introduce ObjCMessageExpr::getReceiverRange() to get the source range of the ↵Argyrios Kyrtzidis2010-12-101-1/+17
| | | | | | receiver. llvm-svn: 121517
* Keep the source location of the selector in ObjCMessageExpr.Argyrios Kyrtzidis2010-12-101-10/+16
| | | | llvm-svn: 121516
* Remove the TypesCompatibleExprClass AST node. Merge its functionality into ↵Francois Pichet2010-12-081-8/+0
| | | | | | BinaryTypeTraitExpr. llvm-svn: 121298
* Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoreticalJohn McCall2010-12-061-3/+3
| | | | | | reason this is limited to C++, and it's certainly not limited to temporaries. llvm-svn: 120996
* Make IgnoreParenLValueCasts skip __extension__ nodes like IgnoreParens().John McCall2010-12-041-3/+11
| | | | | | Abramo noticed this. llvm-svn: 120898
* Although we currently have explicit lvalue-to-rvalue conversions, they'reJohn McCall2010-12-041-2/+44
| | | | | | | | | | | | | | | | | | | not actually frequently used, because ImpCastExprToType only creates a node if the types differ. So explicitly create an ICE in the lvalue-to-rvalue conversion code in DefaultFunctionArrayLvalueConversion() as well as several other new places, and consistently deal with the consequences throughout the compiler. In addition, introduce a new cast kind for loading an ObjCProperty l-value, and make sure we emit those nodes whenever an ObjCProperty l-value appears that's not on the LHS of an assignment operator. This breaks a couple of rewriter tests, which I've x-failed until future development occurs on the rewriter. Ted Kremenek kindly contributed the analyzer workarounds in this patch. llvm-svn: 120890
* Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ↵John McCall2010-12-021-33/+7
| | | | | | | | ObjCPropertyRefExpr into the latter. llvm-svn: 120643
* Restore the lvalue-to-rvalue conversion patch with a minimal fix.John McCall2010-12-011-0/+2
| | | | llvm-svn: 120555
* L-value to r-value conversion is not ready for prime-time.John McCall2010-11-301-2/+0
| | | | llvm-svn: 120433
* Introduce an r-value to l-value cast kind. I'm not promising anythingJohn McCall2010-11-301-0/+2
| | | | | | about the reliability of this yet. llvm-svn: 120422
* Look through parentheses when deciding whether an expr is a temporary ↵Anders Carlsson2010-11-281-4/+4
| | | | | | object. Fixes PR8683. llvm-svn: 120247
* Switch a lot of call-sites over to using the new value-kind calculations.John McCall2010-11-241-1/+1
| | | | llvm-svn: 120084
* Calculate the value kind of an expression when it's created andJohn McCall2010-11-181-24/+38
| | | | | | | | | | | | | store it on the expression node. Also store an "object kind", which distinguishes ordinary "addressed" l-values (like variable references and pointer dereferences) and bitfield, @property, and vector-component l-values. Currently we're not using these for much, but I aim to switch pretty much everything calculating l-valueness over to them. For now they shouldn't necessarily be trusted. llvm-svn: 119685
* a metric ton of refactoring later, Sema::getLocationOfStringLiteralByte Chris Lattner2010-11-171-0/+69
| | | | | | | | no longer depends on Preprocessor, so we can move it out of Sema into a nice new StringLiteral::getLocationOfByte method that can be used by any AST client. llvm-svn: 119481
* Kill CK_Unknown and flesh out the documentation for the existing CastKinds.John McCall2010-11-161-2/+0
| | | | llvm-svn: 119331
* Add a new expression kind, OpaqueValueExpr, which is useful forJohn McCall2010-11-151-0/+6
| | | | | | | certain internal type-checking procedures as well as for representing certain implicitly-generated operations. Uses to follow. llvm-svn: 119289
* Assorted work leading towards the elimination of CK_Unknown.John McCall2010-11-151-0/+8
| | | | llvm-svn: 119138
* Add a few more complex-related cast kinds that arise due to arbitraryJohn McCall2010-11-141-2/+12
| | | | | | | | | | implicit conversions; the last batch was specific to promotions. I think this is the full set we need. I do think dividing the cast kinds into floating and integral is probably a good idea. Annotate a *lot* more C casts with useful cast kinds. llvm-svn: 119036
* Introduce five new cast kinds for various conversions into andJohn McCall2010-11-131-3/+13
| | | | | | between complex types. llvm-svn: 118994
* Introduce a null-to-pointer implicit cast kind.John McCall2010-11-131-0/+2
| | | | llvm-svn: 118966
* Fix InitListExpr::getSourceRange() to work in the case of no locations for ↵Ted Kremenek2010-11-091-0/+29
| | | | | | | | '(' and ')'. This can happen in the case of transparent unions. llvm-svn: 118472
* Emit error when using a bound member function for something other than ↵Argyrios Kyrtzidis2010-11-011-0/+6
| | | | | | | | calling it. Also avoids IRGen crashes due to accepting invalid code. llvm-svn: 117943
* Emit an error when trying to form a pointer-to-member to a bitfield.Argyrios Kyrtzidis2010-10-301-0/+5
| | | | | | As a bonus, avoids a crash on the IRGen side due to accepting invalid code. llvm-svn: 117842
* Rename alignof -> alignOf to avoid irritating C++'0x compilers,Chris Lattner2010-10-301-5/+5
| | | | | | PR8423 llvm-svn: 117775
* Optimize field space usage in CompoundStmt, LabelStmt, Expr, and CastExpr.John McCall2010-10-261-16/+16
| | | | | | | | | There's probably still significant padding waste on x86-64 UNIXen, but the difference in 32-bit compiles should be significant. There are a lot of Expr nodes left that could lose a word this way. llvm-svn: 117359
* Treat __extension__ like ParenExpr.Abramo Bagnara2010-10-151-14/+48
| | | | llvm-svn: 116569
* Eliminate usage of ObjCSuperExpr used forFariborz Jahanian2010-10-141-9/+21
| | | | | | | 'super' as receiver of property or a setter/getter methods. //rdar: //8525788 llvm-svn: 116483
* Patch to support transparent_union argumentsFariborz Jahanian2010-09-271-0/+7
| | | | | | | passed to nonnull attributed functions. Implements radar 6857843. llvm-svn: 114917
* Copying result of object property reference expressionFariborz Jahanian2010-09-271-1/+6
| | | | | | | into a temporary is elidable as well. (Finishes up radar 8291337). llvm-svn: 114845
* Fixed isConstantInitializer for __builtin_choose_expr.Abramo Bagnara2010-09-271-0/+3
| | | | llvm-svn: 114820
* Warn when an expression result in a LabelStmt is unused.Argyrios Kyrtzidis2010-09-191-1/+5
| | | | llvm-svn: 114314
* Right, there are *two* cases of pr-value class-type expressions that don'tJohn McCall2010-09-161-3/+8
| | | | | | | derive from temporaries of the same type. Black-list member expressions as well. llvm-svn: 114071
* Tweak comment as suggested by Sebastian.John McCall2010-09-151-1/+1
| | | | llvm-svn: 114019
* one piece of code is responsible for the lifetime of every aggregateJohn McCall2010-09-151-35/+20
| | | | | | | | | | | | | slot. The easiest way to do that was to bundle up the information we care about for aggregate slots into a new structure which demands that its creators at least consider the question. I could probably be convinced that the ObjC 'needs GC' bit should be rolled into this structure. Implement generalized copy elision. The main obstacle here is that IR-generation must be much more careful about making sure that exactly llvm-svn: 113962
* Test destructors in delete expressions and of temporaries for throwing.Sebastian Redl2010-09-101-3/+23
| | | | llvm-svn: 113664
* Address Doug's comments.Sebastian Redl2010-09-101-1/+6
| | | | llvm-svn: 113650
* First version of a testcase, plus fixes.Sebastian Redl2010-09-101-2/+5
| | | | llvm-svn: 113624
* Implement Expr::CanThrow, a function that applies the noexcept operator ↵Sebastian Redl2010-09-101-0/+201
| | | | | | rules to expressions. llvm-svn: 113621
* Make CallExpr::getCalleeDecl look through pointer derefs.Sebastian Redl2010-09-101-0/+8
| | | | llvm-svn: 113620
* Fix the memory leak of FloatingLiteral/IntegerLiteral.Argyrios Kyrtzidis2010-08-281-0/+38
| | | | | | | | | | | For large floats/integers, APFloat/APInt will allocate memory from the heap to represent these numbers. Unfortunately, when we use a BumpPtrAllocator to allocate IntegerLiteral/FloatingLiteral nodes the memory associated with the APFloat/APInt values will never get freed. I introduce the class 'APNumericStorage' which uses ASTContext's allocator for memory allocation and is used internally by FloatingLiteral/IntegerLiteral. Fixes rdar://7637185 llvm-svn: 112361
OpenPOWER on IntegriCloud