Commit Graph

13486 Commits

Author SHA1 Message Date
Sebastian Redl eed3d4c73e Fix the type of a enum non-type template argument within the instantiation.
llvm-svn: 72489
2009-05-27 19:21:29 +00:00
Douglas Gregor cd3a097925 Simplify, and improve the performance of, template instantiation for
declaration references. The key realization is that dependent Decls,
which actually require instantiation, can only refer to the current
instantiation or members thereof. And, since the current context
during instantiation contains all of those members of the current
instantiation, we can simply find the real instantiate that matches up
with the "current instantiation" template.

llvm-svn: 72486
2009-05-27 17:54:46 +00:00
Douglas Gregor b8006fafe8 Add some more tests for instantiation of declaration references. Also,
improve some error recovery with explicit template instantiation.

llvm-svn: 72484
2009-05-27 17:30:49 +00:00
Douglas Gregor 7a74938fca Enumeration declarations that were instantiated from an enumeration
within a template now have a link back to the enumeration from which
they were instantiated. This means that we can now find the
instantiation of an anonymous enumeration.

llvm-svn: 72482
2009-05-27 17:20:35 +00:00
Douglas Gregor f98d9b60db Improve name lookup for and template instantiation of declaration
references. There are several smallish fixes here:

  - Make sure we look through template parameter scope when
    determining whether we're parsing a nested class (or nested class
    *template*). This makes sure that we delay parsing the bodies of
    inline member functions until after we're out of the outermost
    class (template) scope.
  - Since the bodies of member functions are always parsed
    "out-of-line", even when they were declared in-line, teach
    unqualified name lookup to look into the (semantic) parents.
  - Use the new InstantiateDeclRef to handle the instantiation of a
    reference to a declaration (in DeclRefExpr), which drastically
    simplifies template instantiation for DeclRefExprs.
  - When we're instantiating a ParmVarDecl, it must be in the current
    instantiation scope, so only look there.

Also, remove the #if 0's and FIXME's from the dynarray example, which
now compiles and executes thanks to Anders and Eli.

llvm-svn: 72481
2009-05-27 17:07:49 +00:00
Anders Carlsson ddcbfe7b53 IRgen support for calls to functions that return references to aggregate exressions.
llvm-svn: 72479
2009-05-27 16:45:02 +00:00
Anders Carlsson 5063613a3b Fix another test case.
llvm-svn: 72478
2009-05-27 16:38:58 +00:00
Anders Carlsson d48a008b46 Relax an assert to an if check.
llvm-svn: 72477
2009-05-27 16:28:34 +00:00
Fariborz Jahanian a4872a411c Initialize ObjCSenderDispatch in LangOptions.
Patch by Benjamin Kramer.

llvm-svn: 72476
2009-05-27 16:27:50 +00:00
Steve Naroff 4fc95aa0d4 Convert ObjC qualified type clients over to using iterators.
This allows me to remove some API that I don't want to carry over to ObjCObjectPointerType.

No functionality change.

llvm-svn: 72475
2009-05-27 16:21:00 +00:00
Anders Carlsson 98cee2fde0 Create CXXConstructExprs when constructing via copy initialization.
llvm-svn: 72474
2009-05-27 16:10:08 +00:00
Eli Friedman 751aa72b72 Fix up constant expression handling to deal with the address
of a reference correctly.

llvm-svn: 72463
2009-05-27 06:04:58 +00:00
Eli Friedman 55422ad068 Add IRGen support for local variables of reference type.
llvm-svn: 72462
2009-05-27 05:39:06 +00:00
Douglas Gregor 5178331379 Initial stab at a generalized operation for determining the
instantiation of a declaration from the template version (or version
that lives in a template) and a given set of template arguments. This
needs much, much more testing, but it suffices for simple examples
like

  typedef T* iterator;
  iterator begin();

llvm-svn: 72461
2009-05-27 05:35:12 +00:00
Douglas Gregor 2517f334b4 Don't drop the computed implicit conversions when building a call to
overloaded operator[] or overloaded postfix unary operator (++,
--). Thanks to Eli for finding this bug!

llvm-svn: 72460
2009-05-27 05:00:47 +00:00
Eli Friedman b909bf4937 Add IRGen support for return statements in functions with reference
type.

llvm-svn: 72459
2009-05-27 04:56:12 +00:00
Anders Carlsson 4034a95dc8 Handle operator call expressions where the callee is a member function.
llvm-svn: 72458
2009-05-27 04:18:27 +00:00
Anders Carlsson d8b7ae205e Functions that return references can be rvalues as well.
llvm-svn: 72457
2009-05-27 03:37:57 +00:00
Anders Carlsson ace7215dd4 Add another test.
llvm-svn: 72450
2009-05-27 01:46:48 +00:00
Anders Carlsson 4ae70ff9a3 Add support for emitting calls to functions that return references (as lvalues only for now)
llvm-svn: 72449
2009-05-27 01:45:47 +00:00
Mike Stump 3e97f3b35d Fix typo. I also fixed the hard to read case differences, so that no
one else is tempted to copy the style, incorrectly.

llvm-svn: 72448
2009-05-27 01:42:21 +00:00
Anders Carlsson 3a9463bfda Rename an EmitCallExpr function to EmitCall to make it clear that it doesn't emit an expr.
llvm-svn: 72446
2009-05-27 01:22:39 +00:00
Mike Stump de79ea2f51 Update comment.
llvm-svn: 72444
2009-05-26 23:35:31 +00:00
Mike Stump 6adbd62790 And an additional testcase that also works.
llvm-svn: 72441
2009-05-26 23:10:55 +00:00
Douglas Gregor 408c619afc Template instantiation for "typeof" for both types and expressions.
llvm-svn: 72440
2009-05-26 22:09:24 +00:00
Mike Stump ec3cbfe8c6 Fixup codegen for volatile structs in the trivial cases (a a=a and a=a=a).
llvm-svn: 72439
2009-05-26 22:03:21 +00:00
Douglas Gregor c44ba89397 A simple dynamic array class template, to be used as a test-bed for template instantiation
llvm-svn: 72437
2009-05-26 21:27:04 +00:00
Douglas Gregor 28ad4b5da1 Make sure that CodeGen sees template instantiations.
llvm-svn: 72433
2009-05-26 20:50:29 +00:00
Daniel Dunbar bee70bd1e7 Use .data() instead of &...[0].
- Just SmallVectors this time.

llvm-svn: 72432
2009-05-26 19:40:20 +00:00
Mike Stump 25306cacc6 Esnure that if we have a volatile structure as the destination, that
we actually have a destination.

llvm-svn: 72429
2009-05-26 18:57:45 +00:00
Douglas Gregor 31cf12c0a6 When evaluating a VarDecl as a constant or determining whether it is
an integral constant expression, maintain a cache of the value and the
is-an-ICE flag within the VarDecl itself. This eliminates
exponential-time behavior of the Fibonacci template metaprogram.

llvm-svn: 72428
2009-05-26 18:54:04 +00:00
Daniel Dunbar fed44d215e Revert to using &...[0] for std::vector, apparently .data isn't generally
available (and it isn't necessary in this case).

llvm-svn: 72425
2009-05-26 18:00:25 +00:00
Daniel Dunbar 33794edae7 Use .data() vs &...[0]
llvm-svn: 72420
2009-05-26 17:13:50 +00:00
Daniel Dunbar 1518b64ddc When trying to pass an argument on the stack, assume LLVM will do the right
thing for non-aggregate types.
 - Otherwise we unnecessarily pin values to the stack and currently end up
   triggering a backend bug in one case.

 - This loose cooperation with LLVM to implement the ABI is pretty ugly.

 - <rdar://problem/6918722> [irgen] clang miscompile of many pointer varargs on
   x86-64

llvm-svn: 72419
2009-05-26 16:37:37 +00:00
Daniel Dunbar f7323f3f65 The driver/diagnostic client don't need to be on the heap.
llvm-svn: 72418
2009-05-26 16:15:44 +00:00
Anders Carlsson 09ac6f21c3 An Obj-C message send expression can never have a reference type.
llvm-svn: 72417
2009-05-26 15:22:25 +00:00
Douglas Gregor a30d046059 Simplify printing of the statistics for types.
llvm-svn: 72415
2009-05-26 14:40:08 +00:00
Eli Friedman 5cd659fd32 Fix for PR4140: Add the start of a Linux toolchain (basically, just
barely enough to get the given usage of -print-file-name working).

llvm-svn: 72412
2009-05-26 07:52:18 +00:00
Anders Carlsson 00a2759ca9 Add a new CallExpr::getCallReturnType and use it in Expr::isLvalueInternal. No intended functionality change.
llvm-svn: 72410
2009-05-26 04:57:27 +00:00
Anders Carlsson 3b70b300b0 A block that returns a reference is an lvalue.
llvm-svn: 72409
2009-05-26 02:03:20 +00:00
Eli Friedman 895771aa4b Handle the edge case of a weak function with incomplete type correctly.
Found by code inspection; I haven't seen this in real-world code.

llvm-svn: 72408
2009-05-26 01:22:57 +00:00
Anders Carlsson b7e69b06b5 Remove a bunch of unused constructors
llvm-svn: 72407
2009-05-26 01:04:47 +00:00
Anders Carlsson 3562240952 Remove AstGuard.h from Xcode project.
llvm-svn: 72406
2009-05-26 00:57:47 +00:00
Eli Friedman 1fd785f564 Minor build system changes to make ABITest work correctly on Linux.
llvm-svn: 72405
2009-05-25 22:07:09 +00:00
Eli Friedman 1cae3df3cf Some minor corrections: don't use offsetof on a bitfield, and cast
printf operands to long to suppress warnings.

llvm-svn: 72404
2009-05-25 21:38:01 +00:00
Eli Friedman 7ab09572c6 Extend getPreferredTypeAlign to handle _Complex double and long long
correctly.

llvm-svn: 72401
2009-05-25 21:27:19 +00:00
Eli Friedman cf7530ff43 PR4122: Tweak the ambiguity handling to handle (S())() correctly. I've
left out handling for stuff like (S())++ for the moment.

llvm-svn: 72394
2009-05-25 19:41:42 +00:00
Chris Lattner 23464b8f14 tweak non-null check to put the caret on the function, but underline the
argument.  This avoids the argument from being silenced when the argument is
the NULL macro, which is defined in a system header.  This also makes the output
a bit nicer, e.g.:

t.c:8:3: warning: null passed to a callee which requires a non-null argument
  func1(NULL, cp2, i1);
  ^     ~~~~

vs something like:

t.c:8:10: warning: argument is null where non-null is required
  func1(NULL, cp2, i1);
        ^

llvm-svn: 72393
2009-05-25 18:23:36 +00:00
Chris Lattner ae5342094a merge two tests.
llvm-svn: 72392
2009-05-25 18:20:11 +00:00
Chris Lattner c7516835c3 reword a warning for clarity
llvm-svn: 72391
2009-05-25 18:18:56 +00:00
Chris Lattner 31cadd77ef default -Wnonnull to on.
llvm-svn: 72390
2009-05-25 18:13:00 +00:00
Chris Lattner fe5b4250a8 move some format group options around in the file. Move NonNull group into
DiagnosticGroups.td, and add it as part of -Wformat (which gets it into -Wall).

llvm-svn: 72389
2009-05-25 18:10:41 +00:00
Chris Lattner 83bd8281e5 Fix a couple of bugs:
1. When we accept "#garbage" in asm-with-cpp mode, change the token kind
   of the # to unknown so that the preprocessor won't try to process it as
   a real #.  This fixes a crash on the attached example
2. Fix macro definition extents processing to handle #foo at the end of a
   macro to say the definition ends with the foo, not the #.

This is a follow-on fix to r72283, and rdar://6916026

llvm-svn: 72388
2009-05-25 17:16:10 +00:00
Chris Lattner 7ce761d204 improve comment, no functionality change.
llvm-svn: 72386
2009-05-25 16:23:08 +00:00
Chris Lattner fc39bccd2b fix this test to fail when the patch isn't applied.
llvm-svn: 72385
2009-05-25 16:14:52 +00:00
Eli Friedman 2d49c4f98d Make sure an invalid concatentaion doesn't insert whitespace before
the RHS.  Fixes assembler-with-cpp issue reported on cfe-dev.

llvm-svn: 72370
2009-05-24 19:25:46 +00:00
Daniel Dunbar 91b418ea3c Another tweak to the clang Getting Started page.
llvm-svn: 72355
2009-05-24 01:40:10 +00:00
Daniel Dunbar b402d5c32d Minor updates to the clang Getting Started page.
llvm-svn: 72354
2009-05-24 01:00:12 +00:00
Mike Stump b9f2518626 Propagate volatile for implicit property refernces.
llvm-svn: 72353
2009-05-23 23:52:31 +00:00
Mike Stump 9afc476d4a Propagate volatile around for property references.
llvm-svn: 72352
2009-05-23 23:48:13 +00:00
Mike Stump 5e9e61b8d2 Track volatile aggregate copies better. I'm hoping someone else will decide
how to get the backend to know that the operation is volatile.

llvm-svn: 72348
2009-05-23 22:29:41 +00:00
Mike Stump 332ec2ce81 Fix thinko, and implement aggregate volatile reads.
llvm-svn: 72347
2009-05-23 22:01:27 +00:00
Mike Stump 23abd46b79 More volatile fixes. Can't testcase these yet as ultimately volatile
is still ignored.

llvm-svn: 72344
2009-05-23 21:40:07 +00:00
Mike Stump ca9fc09c61 Collapse a few FIXMEs together and refactor to make fixing the code easier.
llvm-svn: 72342
2009-05-23 20:28:01 +00:00
Mike Stump 93700fc988 Add support for volatile RValues.
llvm-svn: 72341
2009-05-23 20:21:36 +00:00
Daniel Dunbar b8fb96905d Fix use after free, found by Benjamin Kramer.
llvm-svn: 72333
2009-05-23 18:55:58 +00:00
Fariborz Jahanian ba74e5daa5 Test for David Chisnall's -fobjc-sender-dependent-dispatch patch.
llvm-svn: 72330
2009-05-23 17:03:50 +00:00
Mike Stump 8673657275 One step to fixing up codegen for a=b, where a is a volatile struct.
llvm-svn: 72315
2009-05-23 04:13:59 +00:00
Eli Friedman 57406b2783 Add IEEE quad support to DefineFloatMacros.
llvm-svn: 72314
2009-05-23 03:50:01 +00:00
Daniel Dunbar 223db1c9e5 Initialize Obj-C GC attributes when emitting BlockDeclRefExprs.
- Otherwise we may incorrectly miss generation of some write barriers.

llvm-svn: 72313
2009-05-23 02:49:02 +00:00
Eli Friedman f98fc352b8 PR4247: Widen the buffer slightly so it can hold all the definitions for
PPC double double.

(No testcase because no normal target uses the format at the moment.)

llvm-svn: 72310
2009-05-23 02:03:39 +00:00
Mike Stump a35af82429 Fix typo.
llvm-svn: 72308
2009-05-23 02:02:29 +00:00
Ted Kremenek 20e2630877 Use 'Exprs.data()' instead of 'Exprs.empty() ? NULL : ...'
llvm-svn: 72304
2009-05-23 00:22:11 +00:00
Douglas Gregor 4a9f481db9 Template instantiation for qualified declaration reference
expressions. We are now missing template instantiation logic for only
three classes of expressions:
  - Blocks-related expressions (BlockExpr, BlockDeclRefExpr)
  - C++ default argument expressions
  - Objective-C expressions

Additionally, our handling of DeclRefExpr is still quite poor, since
it cannot handle references to many kinds of declarations.

As part of this change, converted the TemplateExprInstantiator to use
iteration through all of the expressions via clang/AST/StmtNodes.def,
ensuring that we don't forget to add template instantiation logic for
any new expression node kinds.

llvm-svn: 72303
2009-05-22 23:47:06 +00:00
Douglas Gregor 93fcf93bc6 Template instantiation for the GNU address-of-label extension.
llvm-svn: 72301
2009-05-22 23:25:52 +00:00
Douglas Gregor 36fe6901d4 Template instantiation for ExtVectorElementExpr.
llvm-svn: 72299
2009-05-22 23:07:44 +00:00
Argyrios Kyrtzidis 4a6dad68a3 Add a test case to make sure that an ambiguous paren expression is only parsed once.
llvm-svn: 72298
2009-05-22 23:05:39 +00:00
Douglas Gregor 5ce0f0eccf Fix the parent classes in TypeNodes.def, from Olaf Krzikalla
llvm-svn: 72293
2009-05-22 22:48:45 +00:00
Douglas Gregor 038c338949 Fix lots of PCH crashes caused by the new assertions in
llvm::SmallVector, using data() instead of &[0]. The PCH testsuite now
runs cleanly (again).

llvm-svn: 72292
2009-05-22 22:45:36 +00:00
Ted Kremenek 92f3d1ff1c Fix PCH crash caused by new assertions in llvm::SmallVector. Use
ProtoRefs.data() instead of &ProtoRefs[0] to access the raw buffer.

llvm-svn: 72291
2009-05-22 22:34:23 +00:00
Ted Kremenek ed28b6d028 Modify begin()/end() for AsmStmt iterators to handle the case when Exprs.empty()
is true. Because of recent changes to llvm::SmallVector, using these iterators
when Exprs was empty would cause an assertion failure.

This fixes: PR 4245.

llvm-svn: 72286
2009-05-22 22:03:22 +00:00
Fariborz Jahanian 88fead8c48 Cannot type cast @selector expressions.
llvm-svn: 72284
2009-05-22 21:42:52 +00:00
Daniel Dunbar 0721c2c155 In assembler-with-cpp mode, don't error on '#' (stringize) operator applied to
non-argument names, pass the tokens through.

llvm-svn: 72283
2009-05-22 21:35:34 +00:00
Douglas Gregor efe7c393e1 Add a few tests to ensure that member functions of class templates can
call other member functions of class templates, including after
template instantiation. No functionality change.

llvm-svn: 72282
2009-05-22 21:26:58 +00:00
Douglas Gregor a8db954f24 Representation of and template instantiation for member
expressions. This change introduces another AST node,
CXXUnresolvedMemberExpr, that captures member references (x->m, x.m)
when the base of the expression (the "x") is type-dependent, and we
therefore cannot resolve the member reference yet.

Note that our parsing of member references for C++ is still quite
poor, e.g., we don't handle x->Base::m or x->operator int.

llvm-svn: 72281
2009-05-22 21:13:27 +00:00
Argyrios Kyrtzidis c996521508 Add -fblocks for the test.
llvm-svn: 72280
2009-05-22 21:10:04 +00:00
Argyrios Kyrtzidis f73f2d28a2 The disambiguation process for ambiguous paren expressions is not "side effects free", e.g:
(T(*)(int[x+y]));

is an (invalid) paren expression, but "x+y" will be parsed as part of the (rejected) type-id,
so unnecessary Action calls are made for an unused (and possibly leaked) "x+y".

Use a different scheme, similar to parsing inline methods. The parenthesized tokens are cached,
the context that follows is determined (possibly by parsing a cast-expression),
and then we re-introduce the cached tokens into the token stream and parse them appropriately.

llvm-svn: 72279
2009-05-22 21:09:47 +00:00
Argyrios Kyrtzidis 48ce3b553b The TokenLexer may encounter annotations if the parser enters them using Preprocessor::EnterTokenStream.
So check for annotation before using the Token's IdentifierInfo.

llvm-svn: 72278
2009-05-22 21:09:31 +00:00
Fariborz Jahanian a4404f21d1 This patch adds support for sender-aware dispatch in Objective-C for the GNU runtime, when
compiled with -fobjc-sender-dependent-dispatch.  This is used in AOP, COP, implementing object 
planes, and a few other things.
Patch by David Chisnall.

llvm-svn: 72275
2009-05-22 20:17:16 +00:00
Fariborz Jahanian 162af638a9 Added -fblocks to the test's options.
llvm-svn: 72274
2009-05-22 20:06:10 +00:00
Mike Stump c63428b192 Fixup codegen for __block int i; i += rhs();. Should also slightly
improve codegen in some cases.

llvm-svn: 72273
2009-05-22 19:07:20 +00:00
Daniel Dunbar adeeb052ad Don't warn about -funit-at-a-time, and reject -fno-unit-at-a-time.
- We could just warn about -fno-unit-at-a-time, but in practice people using it
   probably aren't going to get what they want out of clang.

Also, use "clang" specified error for unsupported things instead of driver
unsupported error.

llvm-svn: 72272
2009-05-22 19:02:20 +00:00
Daniel Dunbar 499f3f9c5d x86_64 ABI: Account for sret parameters consuming an integer register.
- PR4242.

llvm-svn: 72268
2009-05-22 17:33:44 +00:00
Fariborz Jahanian db3a4c1388 (Next runtime only) check to see if class implements forwardInvocation method
and objects of this class are derived from 'NSProxy'.
Under such conditions, which means that every method possible is 
implemented in the class, we should not issue "Method definition not found" 
warnings.

llvm-svn: 72267
2009-05-22 17:12:32 +00:00
Argyrios Kyrtzidis 24ad692f30 Some minor comments modifications.
There are no unnecessary action calls period (courtesy of the annotation scheme) and too many 'this means'..

llvm-svn: 72263
2009-05-22 15:12:46 +00:00
Sanjiv Gupta 47e296149e Targets like PIC16 generate Static decls for automatic variables, emit the appropriate debug descriptor as well in that case.
llvm-svn: 72261
2009-05-22 13:54:25 +00:00
Argyrios Kyrtzidis 12179bc014 Handle correctly a very ugly part of the C++ syntax. We cannot disambiguate between a parenthesized type-id and
a paren expression without considering the context past the parentheses.

Behold:
  (T())x;  - type-id
  (T())*x; - type-id
  (T())/x; - expression
  (T());   - expression

llvm-svn: 72260
2009-05-22 10:24:42 +00:00
Argyrios Kyrtzidis 5da1f08587 Factor the compound literal parsing out from ParseParenExpression and into a new ParseCompoundLiteralExpression.
No functionality change.

llvm-svn: 72259
2009-05-22 10:24:05 +00:00
Argyrios Kyrtzidis 9a9c0f4eff Modification to ParseParenExpression.
Now it parses the cast expression unless 'stopIfCastExpr' is true.

llvm-svn: 72258
2009-05-22 10:23:40 +00:00
Argyrios Kyrtzidis 387a334656 Remove ParseSimpleParenExpression.
Embed its functionality into it's only user, ParseCXXCasts.
CXXCasts now get the "actual" expression directly, they no longer always receive a ParenExpr. This is better since the
parentheses are always part of the C++ casts syntax.

llvm-svn: 72257
2009-05-22 10:23:16 +00:00
Argyrios Kyrtzidis 7bd98440b3 Refactor the common code of 'ParseTypeofSpecifier' and 'ParseSizeofAlignofExpression' into a new
'ParseExprAfterTypeofSizeofAlignof' method.

llvm-svn: 72256
2009-05-22 10:22:50 +00:00
Argyrios Kyrtzidis f5cc7ac4d5 Parse typeof-specifier the same way as sizeof/alignof are parsed.
-Makes typeof consistent with sizeof/alignof
-Fixes a bug when '>' is in a typeof expression, inside a template type param:
  A<typeof(x>1)> a;

llvm-svn: 72255
2009-05-22 10:22:18 +00:00
Zhongxing Xu 5a187dd21e Pull EmitRecord() out of loop. It should be called only once.
llvm-svn: 72252
2009-05-22 08:38:27 +00:00
Torok Edwin 5b34933b90 Set correct calling convention even if there is a bitcast in the way.
This attempts to fix PR4239.

llvm-svn: 72251
2009-05-22 07:25:06 +00:00
Daniel Dunbar 51c7f97bea (llvm up) Use llvm::Triple for storing target triples.
- This commit has some messy stuff in it to extend string lifetimes, but that
   will go away once we switch to using the enum'd Triple interfaces.

llvm-svn: 72243
2009-05-22 02:53:45 +00:00
Daniel Dunbar 5bbebfe9bc Don't rely on getArchName() to return a constant string reference.
llvm-svn: 72241
2009-05-22 02:21:04 +00:00
Eli Friedman 7942674be0 A few more tweaks for Solaris; please correct me if it's wrong somehow.
llvm-svn: 72240
2009-05-22 01:12:57 +00:00
Daniel Dunbar 58f345ceb1 Add --analyzer-no-default-checks and --analyzer-output options.
llvm-svn: 72238
2009-05-22 00:38:15 +00:00
Douglas Gregor 4871c4739d Improve target support for Solaris.
llvm-svn: 72237
2009-05-21 23:51:30 +00:00
Douglas Gregor 1c37d9eed5 Template instantiation for C99 compound literals
llvm-svn: 72236
2009-05-21 23:48:18 +00:00
Douglas Gregor 0f9d4003df Template instantiation for GNU array-range designators.
llvm-svn: 72234
2009-05-21 23:30:39 +00:00
Douglas Gregor ca1aeecd37 Template instantiation for C99 designated initializers, because we
can. Also, delay semantic analysis of initialization for
value-dependent as well as type-dependent expressions, since we can't
always properly type-check a value-dependent expression.

llvm-svn: 72233
2009-05-21 23:17:49 +00:00
Douglas Gregor c2607b9a08 Template instantiation for initializer lists
llvm-svn: 72229
2009-05-21 21:38:12 +00:00
Douglas Gregor 122660eb19 Fix CMake build for AST XML dumper
llvm-svn: 72228
2009-05-21 21:21:53 +00:00
Mike Stump aed08f9929 Fixup blocks codegen for { __block i; i = rhs(); }, we want the rhs
evaluated first.  This can also improve codegen just a bit as we might
have another register to play with for the evaluation of the rhs.

llvm-svn: 72226
2009-05-21 21:05:15 +00:00
Fariborz Jahanian 8c46fec43d Fixed a warning bug when receiver is an object via
setting of NSObject attribute.

llvm-svn: 72225
2009-05-21 21:04:28 +00:00
Douglas Gregor 7f5601e55f AST XML dump, from Olaf Krzikalla!
llvm-svn: 72224
2009-05-21 20:55:50 +00:00
Douglas Gregor 31c7e99401 Template instantiation for unary type traits, e.g., __is_pod
llvm-svn: 72220
2009-05-21 18:55:48 +00:00
Fariborz Jahanian cd1a88da02 Check on null arguments in the presense of nonnull attribute.
llvm-svn: 72219
2009-05-21 18:48:51 +00:00
Douglas Gregor aa85d8221c Template instantiation for C++ "typeid" expressions.
llvm-svn: 72218
2009-05-21 18:34:44 +00:00
Douglas Gregor 728d41bbb9 Template instantiation for C++ throw expressions
llvm-svn: 72217
2009-05-21 17:37:52 +00:00
Douglas Gregor 29fe6aeef3 Template instantiation for C++ delete expression
llvm-svn: 72216
2009-05-21 17:21:12 +00:00
Douglas Gregor 269f0b1b69 Merge the ASTVector and ASTOwningVector templates, since they offered
redundant functionality. The result (ASTOwningVector) lives in
clang/Parse/Ownership.h and is used by both the parser and semantic
analysis. No intended functionality change.

llvm-svn: 72214
2009-05-21 16:25:11 +00:00
Sebastian Redl 027de2adcd Avoid using the built-in type checker for assignment in C++ when classes are involved. Patch by Vyacheslav Kononenko.
llvm-svn: 72212
2009-05-21 11:50:50 +00:00
Jay Foad 7d0479f2c2 Use v.data() instead of &v[0] when SmallVector v might be empty.
llvm-svn: 72210
2009-05-21 09:52:38 +00:00
Fariborz Jahanian a6bed8370e Minor refactoring. Uses an existing API to lookup a class method.
llvm-svn: 72203
2009-05-21 01:03:45 +00:00
Douglas Gregor d0fefbafd1 Template instantiation for C++ "new" expressions.
llvm-svn: 72199
2009-05-21 00:00:09 +00:00
Douglas Gregor 920e3af495 Fix template instantiation for compound statements so that it properly
passes the "isStmtExpr" flag, to suppress warnings about unused
expressions.

llvm-svn: 72190
2009-05-20 22:57:03 +00:00
Ted Kremenek 1036912118 Add special cases to retain checker for 'create' methods in QCView, QCRenderer, and CIContext (Apple APIs).
This fixes:

<rdar://problem/6902710> clang: false positives w/QC and CoreImage methods.

llvm-svn: 72187
2009-05-20 22:39:57 +00:00
Douglas Gregor 1301fdd6c4 Introduce a new kind of RAII class, ASTOwningVector, which is an
llvm::SmallVector that owns all of the AST nodes inside of it. This
RAII class is used to ensure proper destruction of AST nodes when
template instantiation fails.

llvm-svn: 72186
2009-05-20 22:33:37 +00:00
Douglas Gregor 06555f134a Template instantiation for CXXExprWithTemporaries, which occurs when
temporaries are generated for some object-constructing expressions in
templates that are not type-dependent. 

Also, be sure to introduce the variable from a CXXConditionDeclExpr
into the set of instantiated local variables.

llvm-svn: 72185
2009-05-20 21:51:01 +00:00
Douglas Gregor e70f108158 Template instantiation for the various kinds of AST nodes that occur
due to C++ type construction of the form T(a1, a2, ..., aN).

llvm-svn: 72183
2009-05-20 21:38:11 +00:00
Douglas Gregor c902c85b6c Tweak test case so that the expected-error text matches on both i686 and x86-64.
llvm-svn: 72181
2009-05-20 20:30:46 +00:00
Douglas Gregor 895ef6e6f9 Add a va_list/template instantiation test suggested by Eli
llvm-svn: 72178
2009-05-20 18:50:16 +00:00
Douglas Gregor ce934146d0 Introduce a new expression type, CXXUnresolvedConstructExpr, to
describe the construction of a value of a given type using function
syntax, e.g.,
  
  T(a1, a2, ..., aN)

when the type or any of its arguments are type-dependent. In this
case, we don't know what kind of type-construction this will be: it
might construct a temporary of type 'T' (which might be a class or
non-class type) or might perform a conversion to type 'T'. Also,
implement printing of and template instantiation for this new
expression type. Due to the change in Sema::ActOnCXXTypeConstructExpr,
our existing tests cover template instantiation of this new expression
node.

llvm-svn: 72176
2009-05-20 18:46:25 +00:00
Fariborz Jahanian d20a03f308 This patch provides preliminary support for non-fragile instance variables on the GNU runtime.
It currently requires a patches to GNU libobjc (and so is not enabled by default) which are currently 
being tested and reviewed by GNUstep before being pushed upstream.
This patch does not allow support for synthesized ivars, but does provide the infrastructure 
needed for supporting them.
Patch by David Chisnall

llvm-svn: 72175
2009-05-20 18:41:51 +00:00
Fariborz Jahanian f1c25029b4 implementation of format_arg for ObjC methods/functions.
Still more to do.

llvm-svn: 72173
2009-05-20 17:41:43 +00:00
Zhongxing Xu 1075cc0b02 Treat AllocaRegion as SymbolicRegion in RegionStore::Retrieve().
llvm-svn: 72166
2009-05-20 09:18:48 +00:00
Zhongxing Xu 1f275ba1b4 Add comments to test case.
llvm-svn: 72165
2009-05-20 09:03:10 +00:00
Zhongxing Xu a7907608fb * API change: we need to pass GRState to GRExprEngine::EvalBinOp() because
RegionStore needs to know the type of alloca region. 
* RegionStoreManager::EvalBinOp() now converts the alloca region to its first
  element region, as what is done to symbolic region.

llvm-svn: 72164
2009-05-20 09:00:16 +00:00
Eli Friedman c21cb44de2 Handle the remaining unhandled cases in EmitReferenceBindingToExpr.
It would be nice if someone could write an ObjC++ testcase for the case 
of passing a property returning a struct to a function taking a const
reference.

llvm-svn: 72159
2009-05-20 02:31:19 +00:00
Zhongxing Xu 050379b865 add header to be built by gcc 4.3 on Linux.
llvm-svn: 72158
2009-05-20 01:55:10 +00:00
Anders Carlsson 02bb7f0ac8 irgen for references to complex rvales (Very important...)
llvm-svn: 72157
2009-05-20 01:35:03 +00:00
Anders Carlsson 387f863dde Bad anders.
llvm-svn: 72156
2009-05-20 01:27:39 +00:00
Anders Carlsson ad007d44b6 Create a temporary if the lvalue is a bitfield. Reported by Eli.
llvm-svn: 72155
2009-05-20 01:24:22 +00:00
Anders Carlsson 145eae5224 Add support for binding references to scalar rvalues.
llvm-svn: 72153
2009-05-20 01:03:17 +00:00
Anders Carlsson 7d4c083c19 Bind references to lvalues correctly.
llvm-svn: 72150
2009-05-20 00:36:58 +00:00
Anders Carlsson 6f5a015bd9 Add EmitReferenceBindingToExpr. Have EmitCallArg use it for now. Doesn't support anything but at least we don't crash ;)
llvm-svn: 72147
2009-05-20 00:24:07 +00:00
Douglas Gregor 95fc37fd8f Start documenting precompiled headers
llvm-svn: 72146
2009-05-20 00:16:32 +00:00
Douglas Gregor 68f1096212 Add FIXMEs for the remaining C and C++ expression types that still
need template instantiation logic. Remove one FIXME by instantiating
the callee in a non-type-dependent CXXOperatorCallExpr.

llvm-svn: 72145
2009-05-19 23:29:16 +00:00