Граф коммитов

448 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor 10738d36b1 Add an AST representation for non-type template parameter
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122527 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-23 23:51:58 +00:00
Douglas Gregor bebbe0d9b7 Variadic templates: extend the Expr class with a bit that specifies
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121831 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-15 01:34:56 +00:00
Argyrios Kyrtzidis e005d19456 Introduce ObjCMessageExpr::getReceiverRange() to get the source range of the receiver.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121517 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 20:08:30 +00:00
Argyrios Kyrtzidis f40f0d5a38 Keep the source location of the selector in ObjCMessageExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121516 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 20:08:27 +00:00
Francois Pichet f187237d91 Remove the TypesCompatibleExprClass AST node. Merge its functionality into BinaryTypeTraitExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121298 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 22:35:30 +00:00
John McCall 4765fa05b5 Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoretical
reason this is limited to C++, and it's certainly not limited to temporaries.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120996 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 08:20:24 +00:00
John McCall 9c5d70cee1 Make IgnoreParenLValueCasts skip __extension__ nodes like IgnoreParens().
Abramo noticed this.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120898 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 08:24:19 +00:00
John McCall f6a1648197 Although we currently have explicit lvalue-to-rvalue conversions, they're
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120890 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 03:47:34 +00:00
John McCall 12f78a6741 Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ObjCPropertyRefExpr
into the latter.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120643 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 01:19:52 +00:00
John McCall 0ae287a498 Restore the lvalue-to-rvalue conversion patch with a minimal fix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120555 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01 04:43:34 +00:00
John McCall 20fbe7c477 L-value to r-value conversion is not ready for prime-time.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120433 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 17:58:55 +00:00
John McCall 7e4857931b Introduce an r-value to l-value cast kind. I'm not promising anything
about the reliability of this yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120422 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 10:13:06 +00:00
Anders Carlsson f8b3015060 Look through parentheses when deciding whether an expr is a temporary object. Fixes PR8683.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120247 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-28 16:40:49 +00:00
John McCall 7eb0a9eb0c Switch a lot of call-sites over to using the new value-kind calculations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120084 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24 05:12:34 +00:00
John McCall f89e55ab1b Calculate the value kind of an expression when it's created and
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119685 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 06:31:45 +00:00
Chris Lattner 08f92e3a5d a metric ton of refactoring later, Sema::getLocationOfStringLiteralByte
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119481 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 07:37:15 +00:00
John McCall e2b768877b Kill CK_Unknown and flesh out the documentation for the existing CastKinds.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119331 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 05:46:29 +00:00
John McCall 7cd7d1ad33 Add a new expression kind, OpaqueValueExpr, which is useful for
certain internal type-checking procedures as well as for representing
certain implicitly-generated operations.  Uses to follow.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119289 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15 23:31:06 +00:00
John McCall daa8e4e888 Assorted work leading towards the elimination of CK_Unknown.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119138 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15 09:13:47 +00:00
John McCall f3ea8cfe6b Add a few more complex-related cast kinds that arise due to arbitrary
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119036 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-14 08:17:51 +00:00
John McCall 2bb5d00fcf Introduce five new cast kinds for various conversions into and
between complex types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118994 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13 09:02:35 +00:00
John McCall 404cd1669c Introduce a null-to-pointer implicit cast kind.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118966 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13 01:35:44 +00:00
Ted Kremenek c4ba51f365 Fix InitListExpr::getSourceRange() to work in the case of no locations for '(' and ')'. This can happen
in the case of transparent unions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118472 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-09 02:11:40 +00:00
Argyrios Kyrtzidis 11ab790309 Emit error when using a bound member function for something other than calling it.
Also avoids IRGen crashes due to accepting invalid code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117943 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-01 18:49:26 +00:00
Argyrios Kyrtzidis 0f279e756e Emit an error when trying to form a pointer-to-member to a bitfield.
As a bonus, avoids a crash on the IRGen side due to accepting invalid code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117842 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-30 19:52:22 +00:00
Chris Lattner 3248854a5d Rename alignof -> alignOf to avoid irritating C++'0x compilers,
PR8423


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117775 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-30 05:14:06 +00:00
John McCall 8e6285af71 Optimize field space usage in CompoundStmt, LabelStmt, Expr, and CastExpr.
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117359 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-26 08:39:16 +00:00
Abramo Bagnara b9eb35ced8 Treat __extension__ like ParenExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116569 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-15 07:51:18 +00:00
Fariborz Jahanian 8ac2d44982 Eliminate usage of ObjCSuperExpr used for
'super' as receiver of property or a setter/getter
methods. //rdar: //8525788



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116483 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-14 16:04:05 +00:00
Fariborz Jahanian ff3a078d2a Patch to support transparent_union arguments
passed to nonnull attributed functions. Implements radar
6857843.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114917 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27 22:42:37 +00:00
Fariborz Jahanian db148be93c Copying result of object property reference expression
into a temporary is elidable as well.
(Finishes up radar 8291337).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114845 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27 17:30:38 +00:00
Abramo Bagnara 5cadfab3f2 Fixed isConstantInitializer for __builtin_choose_expr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114820 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27 07:13:32 +00:00
Argyrios Kyrtzidis d2827af6f9 Warn when an expression result in a LabelStmt is unused.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114314 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-19 21:21:10 +00:00
John McCall 19e60ad937 Right, there are *two* cases of pr-value class-type expressions that don't
derive from temporaries of the same type.  Black-list member expressions
as well.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114071 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16 06:57:56 +00:00
John McCall 58277b57f9 Tweak comment as suggested by Sebastian.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114019 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 20:59:13 +00:00
John McCall 558d2abc7f one piece of code is responsible for the lifetime of every aggregate
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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113962 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 10:14:12 +00:00
Sebastian Redl 0b34cf7399 Test destructors in delete expressions and of temporaries for throwing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113664 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 23:27:10 +00:00
Sebastian Redl 5221d8f2da Address Doug's comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113650 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 22:34:40 +00:00
Sebastian Redl 295995c9c3 First version of a testcase, plus fixes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113624 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 20:55:47 +00:00
Sebastian Redl 369e51fa40 Implement Expr::CanThrow, a function that applies the noexcept operator rules to expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113621 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 20:55:33 +00:00
Sebastian Redl 200121569d Make CallExpr::getCalleeDecl look through pointer derefs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113620 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 20:55:30 +00:00
Argyrios Kyrtzidis 9996a7f06a Fix the memory leak of FloatingLiteral/IntegerLiteral.
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112361 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 09:06:06 +00:00
John McCall 2de56d1d0c GCC didn't care for my attempt at API compatibility, so brute-force everything
to the new constants.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112047 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25 11:45:40 +00:00
John McCall 5baba9d983 More incremental progress towards not including Expr.h in Sema.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112044 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25 10:28:54 +00:00
John McCall 096832c5ed Regularize the API for accessing explicit template arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111584 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 23:49:38 +00:00
Eli Friedman de7e66256b Zap unused UnaryOperator::OffsetOf.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110996 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 01:36:11 +00:00
Abramo Bagnara 2577743c56 Added locations and type source info for DeclarationName.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 22:01:17 +00:00
Douglas Gregor 569c316687 Allow reference binding of a reference of Objective-C object type to
an lvalue of another, compatible Objective-C object type (e.g., a
subclass). Introduce a new initialization sequence step kind to
describe this binding, along with a new cast kind. Fixes PR7741.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110513 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-07 11:51:51 +00:00
John McCall f871d0cc37 Store inheritance paths after CastExprs instead of inside them.
This takes some trickery since CastExpr has subclasses (and indeed,
is abstract).

Also, smoosh the CastKind into the bitfield from Expr.

Drops two words of storage from Expr in the common case of expressions
which don't need inheritance paths.  Avoids a separate allocation and
another word of overhead in cases needing inheritance paths.  Also has
the advantage of not leaking memory, since destructors for AST nodes are
never run.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110507 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-07 06:22:56 +00:00
John McCall 4204f07fc8 Further adjustments to -Wglobal-constructors; works for references and direct
initializations now.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110063 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-02 21:13:48 +00:00