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

457 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor def0354384 Implement proper (de-)serialization for explicit template argument
lists with zero template arguments. Fixes some seriously scary
crashers in C++ PCH.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124862 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 12:01:24 +00:00
Douglas Gregor b608b98771 Give OpaqueValueExpr a source location, because its source location
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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124465 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-28 02:26:04 +00:00
Argyrios Kyrtzidis ee8a6cafe8 In a ObjCMessageExpr with the super class as receiver, 'super' is actually a ObjCInterfaceType.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124158 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 00:03:48 +00:00
Douglas Gregor d967e31ee7 Refactor the dependence computation for DeclRefExpr so that we can
reuse it for BlockDeclRefExpr. Do so, fixing the dependence calculate
for BlockDeclRefExpr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123851 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-19 21:52:31 +00:00
Douglas Gregor a779d9ca2f Implement basic support for the use of variadic templates and blocks
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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123849 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-19 21:32:01 +00:00
John McCall f4c7371fb1 Change QualType::getTypePtr() to return a const pointer, then change a
thousand other things which were (generally inadvertantly) relying on that.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123814 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-19 06:33:43 +00:00
Jay Foad 4ba2a17694 PR3558: mark "logically const" accessor methods in ASTContext as const,
and mark the fields they use as mutable. This allows us to remove a few
const_casts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123314 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-12 09:06:06 +00:00
Douglas Gregor 1fe85ea697 Add Decl::isParameterPack(), which covers both function and template
parameter packs, along with ParmVarDecl::isParameterPack(), which
looks for function parameter packs. Use these routines to fix some
obvious FIXMEs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122904 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05 21:11:38 +00:00
Douglas Gregor aa165f8458 Refactor the tree transform's many loops over sets of expressions
(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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122761 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03 19:04:46 +00:00
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