Commit Graph

6604 Commits

Author SHA1 Message Date
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 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
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
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 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
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
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
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
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
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
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 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
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 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 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 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 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
Douglas Gregor ad3150cd38 Template instantiation for __builtin_va_arg.
llvm-svn: 72144
2009-05-19 23:10:31 +00:00
Douglas Gregor 0df91121ba Template instantiation for __builtin_choose_expr.
llvm-svn: 72143
2009-05-19 22:43:30 +00:00
Douglas Gregor f907cbf634 Ban the use of __builtin_types_compatible_p in C++; g++ doesn't support it,
and it isn't clear exactly what it's supposed to mean. Thanks Eli!

llvm-svn: 72142
2009-05-19 22:28:02 +00:00
Douglas Gregor c25f766065 Template instantiation for __builtin_shufflevector.
llvm-svn: 72139
2009-05-19 22:10:17 +00:00
Eli Friedman 58ed0f2a80 Build fixes for r72135.
llvm-svn: 72136
2009-05-19 21:16:18 +00:00
Eli Friedman 5b5bd90a21 Move AnalysisConsumer.h and Analyses.def from tools/clang-cc to
include/clang/Frontend, and move AnalysisConsumer.cpp from 
tools/clang-cc to lib/Frontend.

llvm-svn: 72135
2009-05-19 21:10:40 +00:00
Douglas Gregor 4b58ca02c5 Template instantiation for __builtin_types_compatible_p.
llvm-svn: 72134
2009-05-19 20:55:31 +00:00
Anders Carlsson 2d228cef50 Improve support for irgen of references.
llvm-svn: 72133
2009-05-19 20:40:02 +00:00
Douglas Gregor 8d7fef3cf2 Template instantiation for GNU statement expressions
llvm-svn: 72129
2009-05-19 20:31:21 +00:00
Douglas Gregor 115652db4a Fix handling of the GNU "t ? : f" extension to the conditional
operator in C++, and verify that template instantiation for the
condition operator does the right thing.

llvm-svn: 72127
2009-05-19 20:13:50 +00:00
Douglas Gregor 3234db1e13 Template instantiation for compound assignment operators.
llvm-svn: 72126
2009-05-19 20:02:01 +00:00
Anders Carlsson 29a1be34b7 Only do the bitcast in EmitStoreOfScalar if the type is a boolean.
llvm-svn: 72125
2009-05-19 19:36:19 +00:00
Douglas Gregor 71b6a37bc4 Template instantiation for cast expressions.
llvm-svn: 72119
2009-05-19 19:05:47 +00:00
Anders Carlsson 8370964257 Pass the destination QualType to EmitStoreOfScalar. No functionality change.
llvm-svn: 72118
2009-05-19 18:50:41 +00:00
Anders Carlsson 775640d248 Don't always zext the result of the not unary operator to an int.
llvm-svn: 72117
2009-05-19 18:44:53 +00:00
Fariborz Jahanian 960910a159 Patch finishes off application of printf attribute on blocks.
llvm-svn: 72111
2009-05-19 17:08:59 +00:00
Duncan Sands ca3a465b76 Add missing include for stderr and fprintf, needed
when compiling with gcc-4.4.

llvm-svn: 72109
2009-05-19 12:06:47 +00:00
Eli Friedman 69329a52cf Fix a crash with -emit-html from stdin.
llvm-svn: 72104
2009-05-19 05:28:52 +00:00
Anders Carlsson c82b86dfaa Have AggExprEmitter::VisitCXXConstructExpr make new variables if necessary. Stub out VisitCXXExprWithTemporaries.
llvm-svn: 72103
2009-05-19 04:48:36 +00:00
Anders Carlsson 549c5bd824 Create CXXConstructExpr calls for arguments passed to functions.
llvm-svn: 72102
2009-05-19 04:45:15 +00:00
Eli Friedman cec35d7e6a Clean up some unnecessary includes.
llvm-svn: 72101
2009-05-19 04:30:57 +00:00
Eli Friedman e15ecf04a4 CMake updates for r72099; untested, so please tell me if there are any
issues.

llvm-svn: 72100
2009-05-19 04:21:30 +00:00
Eli Friedman 16b7b6f511 Move clang-cc.h to lib/Frontend/Utils.h, and move the associated .cpp
files to lib/Frontend.

llvm-svn: 72099
2009-05-19 04:14:29 +00:00
Anders Carlsson 97c793ad1c When assigning from an rvalue to a const reference, the implicit cast from T -> const T is not an lvalue cast.
llvm-svn: 72082
2009-05-19 00:38:24 +00:00
Douglas Gregor be81045db7 Template instantiation for call expressions.
llvm-svn: 72081
2009-05-19 00:38:01 +00:00
Fariborz Jahanian b27c94199f This patch allows clang to generate code for declared properties on the GNU runtime. As with @synchronized, this requires some extra functions that are included with other libraries (not with the GNU runtime itself) and so will cause linker errors when these are not present.
Patch by David Chisnall.

llvm-svn: 72079
2009-05-19 00:28:43 +00:00
Douglas Gregor 7a77a6bcf9 Template instantiation for array subscript expressions. This was far
easier than expected because of the limitation that subscript
operators must be member functions.

llvm-svn: 72076
2009-05-19 00:01:19 +00:00
Fariborz Jahanian 5f1f9d7a46 BlockDecl node must be complete before block attributes
can be processed. No change in functionality.

llvm-svn: 72066
2009-05-18 23:17:46 +00:00
Ted Kremenek 501ba0365a Fix PR 4230: Don't flag leaks of NSAutoreleasePools until we know that we aren' at the top-most scope of autorelease pools.
llvm-svn: 72065
2009-05-18 23:14:34 +00:00
Eli Friedman 351fa4b1b2 Attempted CMake build fixes for r72060; this is untested, so please tell
me if there are any issues.

llvm-svn: 72063
2009-05-18 23:06:15 +00:00
Daniel Dunbar 13c358d9b8 Remove -fprintf-source-range-info from the Driver (this was renamed)
llvm-svn: 72061
2009-05-18 23:01:24 +00:00
Eli Friedman 9f30fc33d9 Move ASTConsumers.h to include/clang/Frontend, and move the associated
.cpp files to lib/Frontend.  (As proposed on cfe-dev.)

llvm-svn: 72060
2009-05-18 22:50:54 +00:00
Douglas Gregor 38e7f8bd6d Template instantiation for imaginary literals, because they were next in Expr.h
llvm-svn: 72058
2009-05-18 22:38:38 +00:00
Douglas Gregor 8e35e2d7ae "This patch fixes an obvious buffer overrun in
SelectInterestingSourceRegion()," from Jay Foad!

llvm-svn: 72049
2009-05-18 22:09:16 +00:00
Douglas Gregor 4182e32172 Fix sorting of using directives, from Jay Foad
llvm-svn: 72048
2009-05-18 22:06:54 +00:00
Daniel Dunbar 82b22101e6 Reformat a comment
llvm-svn: 72046
2009-05-18 21:47:54 +00:00
Douglas Gregor 655fc35fcd Deal with an icky corner case where we were complaining that a catch
statement was using an rvalue reference during the template
definition. However, template instantiations based on an lvalue
reference type are well-formed, so we delay checking of these property
until template instantiation time.

llvm-svn: 72041
2009-05-18 21:08:14 +00:00
Fariborz Jahanian c1585be6bd more printf attribute on block declaration and
checking when block is envoked. In progress.

llvm-svn: 72039
2009-05-18 21:05:18 +00:00
Daniel Dunbar c61d0bd8f1 Debug info: Initialize runtime language field correctly for Objective-C
interface types.

llvm-svn: 72036
2009-05-18 20:51:58 +00:00
Douglas Gregor 5e16fbe562 Template instantiation for C++ try/catch statements.
llvm-svn: 72035
2009-05-18 20:51:54 +00:00
Anders Carlsson 9b02760923 Since we miscompile many cases when declaring a variable with a reference type, make them unsupported for now.
llvm-svn: 72034
2009-05-18 19:55:29 +00:00
Anders Carlsson 8dd2947696 Remove an unused builtin.
llvm-svn: 72033
2009-05-18 19:25:54 +00:00
Anders Carlsson 2081200b8c Add 'cmp' SSE builtins and get rid of a bunch of other builtins.
llvm-svn: 72032
2009-05-18 19:16:46 +00:00
Douglas Gregor 2f547c7e3e Include StmtNodes.def to declare Visit methods for all of the known
kinds of statements (in the instantiation logic). No functionality
change, but now we'll get linker errors if we add a statement but
forget to introduce its instantiation logic.

llvm-svn: 72031
2009-05-18 19:08:47 +00:00
Douglas Gregor eaf847ab97 Simplify struct/class tag mismatch warning, per Sebastian's suggestion
llvm-svn: 72027
2009-05-18 18:46:22 +00:00
Fariborz Jahanian 28c433dcda Minor tweak to support format attribute on blocks. No change in functionality.
llvm-svn: 72020
2009-05-18 17:39:25 +00:00
Daniel Dunbar 70f924df8a Avoid potential out-of-bounds access in SourceManager::getLineNumber.
- Chris, please see added FIXMEs.

llvm-svn: 72019
2009-05-18 17:30:52 +00:00
Douglas Gregor 8567358cc9 When instantiating the definition of a member function of a class
template, introduce that member function into the template
instantiation stack. Also, add diagnostics showing the member function
within the instantiation stack and clean up the qualified-name
printing so that we get something like:

  note: in instantiation of member function 'Switch1<int, 2, 2>::f'
  requested here

in the template instantiation backtrace.

llvm-svn: 72015
2009-05-18 17:01:57 +00:00
Daniel Dunbar 29f36b4c9a Silence a Release-Asserts warning.
llvm-svn: 72013
2009-05-18 16:48:48 +00:00
Eli Friedman e6eb2edb50 Fix for PR2386: distinguish between insertion and replacements in the
delta tree.

The issue is roughly a conflict in ReplaceText between two kinds of 
uses. One, it should be possible to replace a replacement: for example, the
ObjC rewriter calls ReplaceStmt for an expression, then replaces the resulting
expression with another expression.  Two, it should be possible to 
replace text that already has text inserted before it: for example, the 
HTML rewriter inserts a bunch of tags at the beginning of the line, then 
tries to escape the first character on the line.  This patch 
distinguishes the two cases by storing the deltas separately; 
essentially, replacements and insertions no longer interfere with 
each other.

Another possibility would be to add some sort of flag to ReplaceText, but
this seems a bit more intuitive and flexible.

There are a few downsides to the current solution: one is that there isn't
any way to remove/replace an insertion without touching additional
surrounding text; if such an operation turns out to be useful, an
additional method or flag can be added.  Another is that an insertion 
and replacing a string of length zero are distinct operations; I'm not 
sure how to resolve this, or whether it will be confusing in practice.

This is relatively sensitive code, so please test and tell me if 
anything breaks.

llvm-svn: 72000
2009-05-18 13:56:52 +00:00
Eli Friedman 174c310967 Remove unused parameter.
llvm-svn: 71996
2009-05-18 07:39:39 +00:00
Anders Carlsson ee13926fbe Make ActOnWhileStmt take a FullExprArg for the condition expr.
llvm-svn: 71990
2009-05-17 21:22:26 +00:00
Anders Carlsson 24824e5009 Make ActOnExprStmt take a FullExprArg.
llvm-svn: 71989
2009-05-17 21:11:30 +00:00