Commit Graph

26040 Commits

Author SHA1 Message Date
Douglas Gregor 2c84482abd Teach libclang to enable multithreading in LLVM, since libclang clients are likely to be multithreaded. Also move the printing of timers to somewhere better for multithreaded libclang clients
llvm-svn: 114760
2010-09-24 21:18:36 +00:00
Daniel Dunbar 4ed214a191 Driver: Add -fallow-unsupported which disables some of the eager error'ing we do
to prevent users from trying unsupported stuff. Useful for testing.

llvm-svn: 114749
2010-09-24 19:39:37 +00:00
Fariborz Jahanian aa0f2b3016 Fix rewriting of property declared in @protocol's.
Fixed //rdar://8472487.

llvm-svn: 114741
2010-09-24 18:36:58 +00:00
Fariborz Jahanian 8fb87aec78 Patch implements passing arrays to functions expecting
vla. Implements pr7827.

llvm-svn: 114737
2010-09-24 17:30:16 +00:00
Douglas Gregor 3aa045491f Update Clang man page to say a little bit more about C++
llvm-svn: 114735
2010-09-24 17:26:14 +00:00
Ted Kremenek 45c42ec2f1 Remove this test for now until I figure out how to get it to work with c-index-test in a portable way.
llvm-svn: 114721
2010-09-24 02:43:32 +00:00
Ted Kremenek 2c2d146488 Pass -fobjc-nonfragile-abi2 in test.
llvm-svn: 114720
2010-09-24 02:00:46 +00:00
Ted Kremenek f93eb1b09e Since this test depends on default ivar synthesis, specify the target triple. This hopefully unbreaks the buildbot
on some archs.

llvm-svn: 114716
2010-09-24 01:51:38 +00:00
Ted Kremenek 25cfb3b511 Update comment in test with reference to bug report.
llvm-svn: 114715
2010-09-24 01:24:15 +00:00
Ted Kremenek 74a9f98522 Default synthesized ivars don't really have a location in the source. Using the location of the @implementation
is just confusing for clients that want to use SourceLocations for syntactic references.

Fixes: <rdar://problem/8470540>
llvm-svn: 114714
2010-09-24 01:23:01 +00:00
Nick Lewycky 6e1ce29b01 Revert r114712 due to failure on darwin buildbot.
llvm-svn: 114713
2010-09-24 00:46:53 +00:00
Nick Lewycky e351fed104 Make -M/-MM behave like in gcc; use -MF first then -o else use stdout.
llvm-svn: 114712
2010-09-23 23:49:25 +00:00
Nick Lewycky e47c245b90 Fix header comment so we don't break emacs.
llvm-svn: 114711
2010-09-23 23:48:20 +00:00
Douglas Gregor 0ac41389a4 Synchronize globally-cached code completion results with the results
provided when the optimization is disabled. In particular, split
the completion context CCC_Other into two contexts: CCC_Other, which
means that it's an undisclosed context for which any other results are
unwelcome, and CCC_Recovery, which is used in recovery cases.

Since we're now using the completion context within the completion
results builder, make sure that it's always set to something.

Fixes <rdar://problem/8470644>.

llvm-svn: 114704
2010-09-23 23:01:17 +00:00
Nick Lewycky f2b22ab044 Fix typo.
llvm-svn: 114697
2010-09-23 21:43:57 +00:00
Ted Kremenek 6274be47fa When warning about comparing an unsigned int to being >= 0, don't issue a warning if the zero value was an
enum or was expanded from a macro.

Fixes: <rdar://problem/8414119>
llvm-svn: 114695
2010-09-23 21:43:44 +00:00
Ted Kremenek 24fb1d03d3 Add test case for c-index-test showing that @property declarations added in class extensions don't get reported
in the @interface.

llvm-svn: 114694
2010-09-23 21:25:13 +00:00
Ted Kremenek cba5849c0b For properties declared in a @protocol and redeclared in a class extension, use the class extension
as the lexical DeclContext for the @property declaration that gets auto-created for the @interface.

Fixes: <rdar://problem/8467189>
llvm-svn: 114693
2010-09-23 21:18:05 +00:00
Douglas Gregor ca5b053920 Add some missing concurrency checks into libclang
llvm-svn: 114682
2010-09-23 18:47:53 +00:00
Argyrios Kyrtzidis e619e99a1b Fix bogus compiler errors when declaring anonymous union, outside a class, with
members with the same name as a decl outside the scope where the members are actually introduced.
Fixes http://llvm.org/PR6741

llvm-svn: 114641
2010-09-23 14:26:01 +00:00
Argyrios Kyrtzidis 4f92016ed3 If -fcolor-diagnostics is explicitly passed to the driver respect that even if the driver is of the opinion that
stderr can't handle them. (see http://llvm.org/PR8150)
Patch by Frits van Bommel!

llvm-svn: 114638
2010-09-23 12:56:06 +00:00
Argyrios Kyrtzidis 719a46bbf1 Don't crash on _Imaginary.
llvm-svn: 114637
2010-09-23 09:40:31 +00:00
Argyrios Kyrtzidis 3446898e90 Use -emit-llvm-only in the test.
llvm-svn: 114636
2010-09-23 09:40:20 +00:00
Ted Kremenek fd5856adcb Refactor GRExprEngine::VisitCall() to use EvalArguments(), just like VisitCXXMemberCallExpr(). Ideally we should unify these code paths as much as possible, since they only differ by a few details.
llvm-svn: 114628
2010-09-23 05:14:51 +00:00
Daniel Dunbar 1fae17a8e5 Tweak test to pass -ffreestanding, to avoid platform dependent header issues.
llvm-svn: 114627
2010-09-23 04:40:10 +00:00
Daniel Dunbar 19964dbe3b IRgen/ABI/ARM: Return large vectors in memory.
llvm-svn: 114619
2010-09-23 01:54:32 +00:00
Daniel Dunbar b34b08098c IRgen/ABI/ARM: Trust the backend to pass vectors correctly for the given ABI.
- Therefore, we can lower out the NEON wrapper structs and pass the vectors
   directly. This makes a huge difference in the cleanliness of the IR after
   optimization.
 - I will trust, but verify, via future ABITest testing (for APCS-GNU, at
   least).

llvm-svn: 114618
2010-09-23 01:54:28 +00:00
Ted Kremenek 866ac0a0da Update checker build.
llvm-svn: 114615
2010-09-23 00:35:46 +00:00
Douglas Gregor 0576ce730a Implement libclang API functions for retrieving the lexical and
semantic parents of the given cursor.

llvm-svn: 114587
2010-09-22 21:22:29 +00:00
Devang Patel f063cb49d8 Testcase for r114585.
llvm-svn: 114586
2010-09-22 21:13:48 +00:00
Tom Care 14fefab721 Fix an inverse boolean and unnecessary new line in warning output from AnalyzerStatsChecker.
llvm-svn: 114581
2010-09-22 21:07:51 +00:00
Sebastian Redl c1d035f6a3 Change source manager serialization to be less tied to the PCH model.
llvm-svn: 114575
2010-09-22 20:19:08 +00:00
Douglas Gregor a1ed39be76 Fix a hard-to-reproduce crash-on-invalid, where we weren't checking for a valid result from ActOnIdExpression
llvm-svn: 114548
2010-09-22 16:33:13 +00:00
Argyrios Kyrtzidis ca0d0cd3b9 Implement -Wpadded and -Wpacked.
-Wpadded warns when undesired padding is introduced in a struct. (rdar://7469556)
-Wpacked warns if a struct is given the packed attribute, but the packed attribute has no effect
  on the layout or the size of the struct. Such structs may be mis-aligned for little benefit.

The warnings are emitted at the point where layout is calculated, that is at RecordLayoutBuilder.
To avoid calculating the layouts of all structs regardless of whether they are needed or not,
I let the layouts be lazily constructed when needed. This has the disadvantage that the above warnings
will be emitted only when they are used for IR gen, and not e.g with -fsyntax-only:

$ cat t.c
struct S {
  char c;
  int i;
};
void f(struct S* s) {}

$ clang -fsyntax-only -Wpadded t.c
$ clang -c -Wpadded t.c -o t.o
t.c:3:7: warning: padding struct 'struct S' with 3 bytes to align 'i' [-Wpadded]
  int i;
      ^
1 warning generated.

This is a good tradeoff between providing the warnings and not calculating layouts for all
structs in case the user has enabled a couple of rarely used warnings.

llvm-svn: 114544
2010-09-22 14:32:24 +00:00
Chris Lattner 775e635b5a update a bunch of tests that are using the x86 backend instead of grepping IR :(
llvm-svn: 114535
2010-09-22 06:09:31 +00:00
Sebastian Redl 96371b446e Only preload SLocEntries after the entire PCH chain was loaded.
llvm-svn: 114518
2010-09-22 00:42:30 +00:00
Sebastian Redl 949fe9e03b Reshuffle PerFileData's members to make more sense.
llvm-svn: 114517
2010-09-22 00:42:27 +00:00
Daniel Dunbar da4f6b5151 Driver/Darwin: Add a runtime library just for ___eprintf -- when targeting i386
some projects still depend on ___eprintf being available.

llvm-svn: 114509
2010-09-22 00:03:52 +00:00
Chris Lattner b2f659b7a0 fix the rest of rdar://8461279 - clang miscompiles address-space qualified atomics
llvm-svn: 114503
2010-09-21 23:40:48 +00:00
Chris Lattner c9066d3072 same bug as before, this time with __sync_val_compare_and_swap.
llvm-svn: 114502
2010-09-21 23:35:30 +00:00
Chris Lattner 7cf46bfda0 fix __sync_bool_compare_and_swap to work with address-space qualified types.
llvm-svn: 114498
2010-09-21 23:24:52 +00:00
Chris Lattner 65dce5eeee filecheckize.
llvm-svn: 114497
2010-09-21 23:22:41 +00:00
Fariborz Jahanian 521c72c756 Fixes an IRgen ICE due to cast of null pointer to
a vla type (fixes pr7827).

llvm-svn: 114495
2010-09-21 22:53:33 +00:00
John Thompson c467aa2fa4 Fixed pr20314-2.c failure, added E, F, p constraint letters.
llvm-svn: 114490
2010-09-21 22:04:54 +00:00
Ted Kremenek 2f07563f47 Correctly register the class extension as the lexical DeclContext for ObjC methods declared with @property in class extensions.
This matches the behavior for setters.

Also pass the class extension to ProcessPropertyDecl as the lexical DeclContext, even when not redeclaring the @property.

This fixes the remaining issues in <rdar://problem/7410145>.

llvm-svn: 114477
2010-09-21 20:52:59 +00:00
Fariborz Jahanian cb75021034 IRgen for gnu extension's conditional lvalue expression
with missing LHS. radar 8453812. Executable test is checked 
into llvm test suite.

llvm-svn: 114457
2010-09-21 18:32:21 +00:00
Ted Kremenek e3a7d1ba40 For ObjCPropertyDecls in class extensions, use the class extension as the lexical DeclContext for newly created
ObjCMethodDecls.  Further, use the location of the new property declaration as the location of new ObjCMethodDecls
(if they didn't previously exist).

This fixes more of the issues reported in <rdar://problem/7410145>.

llvm-svn: 114456
2010-09-21 18:28:43 +00:00
Douglas Gregor 0212fd7169 Add code completion for C++ constructors wherever we see the class (or
class template) and are in a context where we can have a value.

llvm-svn: 114441
2010-09-21 16:06:22 +00:00
Benjamin Kramer 3e0c527dcc Adjust for debug info API change.
llvm-svn: 114438
2010-09-21 15:59:59 +00:00
Argyrios Kyrtzidis 03f0e2b5b4 Do not warn with -Wuninitialized when the member is used in a sizeof or address-of expression.
Fixes rdar://8331312.

llvm-svn: 114426
2010-09-21 10:47:20 +00:00
Marcin Swiderski c0ca7316bc Added:
- definitions of interfaces for CFGInitializer and CFGAutomaticObjDtor,
- support for above classes to print_elem function (renamed print_stmt),
- support for VarDecls in StmtPrinterHelper.

llvm-svn: 114403
2010-09-21 05:58:15 +00:00
Ted Kremenek 0030e1d3cd Fix indentation.
llvm-svn: 114394
2010-09-21 04:47:01 +00:00
Ted Kremenek c2eb0116cc Check for null ObjCInterfaceDecls returned from getClassInterface() when generating USRs. While I have no test case for this (could not create one), this shows up in crash reports. Tentatively fixes <rdar://problem/8452791>.
llvm-svn: 114392
2010-09-21 04:45:46 +00:00
Bill Wendling 7108ece077 Add a comment explaining why the MMX builtins are segregated and what we plan on
doing with them. It's a "FIXME" right now because this change hasn't been
implemented yet.

llvm-svn: 114385
2010-09-21 01:39:34 +00:00
Douglas Gregor 7466127a4b When providing code completions for an argument in an Objective-C
message send, e.g.,

  [[NSString alloc] initWithCString:<CC>

look up all of the possible methods and determine the preferred type
for the argument expression based on the type of the corresponding
parameter.

llvm-svn: 114379
2010-09-21 00:03:25 +00:00
Fariborz Jahanian 8162d4ad31 Implements in IRgen gnu extensions missing LHS for
complex conditionals. Radar 8453812.

llvm-svn: 114376
2010-09-20 23:50:22 +00:00
Douglas Gregor f86e4da7ae Refactor code completion for expressions that occur as arguments in
Objective-C message sends. There is no functionality change here; this
is prep work for using the parameter types to help guide the
expression results when code-completing the argument.

llvm-svn: 114375
2010-09-20 23:34:21 +00:00
Douglas Gregor 5fb901deee Code completion has no reason to prefer values over types, especially
at the statement level or in Objective-C message receivers. Therefore,
just give types and declarations the same basic priority, and adjust
from there.

llvm-svn: 114374
2010-09-20 23:11:55 +00:00
Nate Begeman abb5a7370d Check in support for OpenCL conditional operator on vector types.
llvm-svn: 114371
2010-09-20 22:41:17 +00:00
Douglas Gregor 50832e0215 Slight refactoring in code-completion results generation, placing the
various priority adjustments for preferences (based on selectors,
types) in a single function to make extension easier.

llvm-svn: 114370
2010-09-20 22:39:41 +00:00
Douglas Gregor db5c09a8cd Get rid of the lame attempt to prioritize "void" functions at
statement context; it really isn't helpful in practice (remember
printf!) and we'll be doing other adjustments for statements very soon.

llvm-svn: 114358
2010-09-20 21:25:19 +00:00
Douglas Gregor 9dcf58a546 Tweak priorities for some types and macros:
- In Objective-C, we prefer BOOL to bool for historic reasons;
  slightly penalize "bool".
  - Treat Nil macro as a NULL pointer constant.
  - Treat YES, NO, true, and false macros as constants.
  - Treat the bool macro as a type.

llvm-svn: 114356
2010-09-20 21:11:48 +00:00
Bill Wendling c9cb0caeb7 The builtins __builtin_ia32_paddq and __builtin_ia32_psubq were missing.
llvm-svn: 114349
2010-09-20 20:40:00 +00:00
Douglas Gregor 8af2ff89f7 Introduce a simple, substitution-based compression scheme for USRs, so
that redundant types don't result in super-long USRs. Fixes
<rdar://problem/8447875>.

llvm-svn: 114347
2010-09-20 20:37:39 +00:00
Douglas Gregor 8f78579f9d Fix CMake clangIndex library dependencies, from Logan Chien
llvm-svn: 114336
2010-09-20 18:32:29 +00:00
Daniel Dunbar c1dd0e97f3 Driver/Objective-C: Retool Objective-C ABI flags to be more usable, and actually
document behavior. Will wonders never cease.

llvm-svn: 114334
2010-09-20 18:19:55 +00:00
Douglas Gregor db8c6fd18f Check that an overloaded function name, when used by the ! operator,
actually resolves to a particular function. Fixes PR8181, from Faisal
Vali!

llvm-svn: 114331
2010-09-20 17:13:33 +00:00
Douglas Gregor 7319327007 Give implicitly-defined default constructors and destructors empty
bodies, from Martin Vejnar!

llvm-svn: 114329
2010-09-20 16:48:21 +00:00
Argyrios Kyrtzidis 40cec8326c Revert r114316, -Wunused-value enabled by default was intended.
llvm-svn: 114318
2010-09-19 23:03:35 +00:00
Argyrios Kyrtzidis 3698bf1c6d Make -Wunused-value off by default, matching GCC. Fixes rdar://7126194.
llvm-svn: 114316
2010-09-19 21:21:44 +00:00
Argyrios Kyrtzidis 72664df103 Implement -Wunused-label.
llvm-svn: 114315
2010-09-19 21:21:25 +00:00
Argyrios Kyrtzidis 9096341310 Warn when an expression result in a LabelStmt is unused.
llvm-svn: 114314
2010-09-19 21:21:10 +00:00
Daniel Dunbar 549decf4cc Update users manual comments on X86 and ARM support.
llvm-svn: 114311
2010-09-19 19:26:59 +00:00
Fariborz Jahanian 4fbf4af0f6 Fixes IRgen bug in objc++ reference binding of a
getter expression. 
Fixes // rdar://8437240

llvm-svn: 114299
2010-09-18 20:47:25 +00:00
Fariborz Jahanian 2b1d88abfb Problem with gnu conditional extension with missing
LHS and when conditional expression is an array. Since
it will be decayed, saved expression must be saved with
decayed expression. This is necessary to preserve semantics
of this extension (and prevent an IRGen crash which expects
an array to always be decayed). I am sure there will be other
cases in c++ (aggregate conditionals for example) when saving of the 
expression must happen after some transformation on conditional
expression has happened. 
Doug, please review.  Fixes // rdar://8446940

llvm-svn: 114296
2010-09-18 19:38:38 +00:00
Douglas Gregor 521db40c15 Give the Objective-C _cmd an "unlikely" code completion priority; it's
very rarely used.

llvm-svn: 114286
2010-09-18 15:16:27 +00:00
Gabor Greif bf98608a3d do not rely on the implicit-dereference semantics of dyn_cast_or_null
llvm-svn: 114281
2010-09-18 13:00:17 +00:00
John McCall 386dfc738e static local variables with destructors don't require a global destructor
unless we're on a platform without __cxa_atexit (or use thereof has been
disabled).  This patch actually just disables the check completely for
static locals, but I've filed http://llvm.org/bugs/show_bug.cgi?id=8176 to
track the platform-specific fix.

llvm-svn: 114269
2010-09-18 05:25:11 +00:00
John McCall f09d96f76d Adjust a fixup's starting branch if it's being resolved because
it reached the outermost scope and it hasn't yet been forwarded
to a cleanup.  Fixed PR8175.

llvm-svn: 114259
2010-09-18 02:24:39 +00:00
Douglas Gregor 112b51e72d Add another text for code completion after recovery
llvm-svn: 114257
2010-09-18 02:10:40 +00:00
Douglas Gregor eda7e545e6 Continue parsing more postfix expressions, even after semantic
errors. Improves code completion in yet another case.

llvm-svn: 114255
2010-09-18 01:28:11 +00:00
John Thompson 1224061281 Added '|' delimiter to separate inline asm multiple alternative constraints for Clang side of support.
llvm-svn: 114253
2010-09-18 01:15:13 +00:00
John Thompson 9a587aaaa9 Add more error checking to attribute vecreturn
llvm-svn: 114251
2010-09-18 01:12:07 +00:00
John McCall 8ea46b6654 Fix a bug with binding l-values to elided temporaries, and leave a couple
helpful asserts behind.

llvm-svn: 114250
2010-09-18 00:58:34 +00:00
Anton Yartsev 79d6af3839 formatted everything to fit within 80 columns
llvm-svn: 114249
2010-09-18 00:39:16 +00:00
Bill Wendling cbacefd36f Testcase for r114239.
llvm-svn: 114247
2010-09-18 00:26:29 +00:00
Tom Care 0bd3431a5e Revert r114244 since it breaks a test in Analysis.
llvm-svn: 114246
2010-09-18 00:17:17 +00:00
Tom Care 0f99e64305 IdempotentOperationChecker no longer reports errors that are post-dominated by a sink. This fixes some false positives that were flagged because a path was incomplete (usually in a loop).
llvm-svn: 114244
2010-09-18 00:06:34 +00:00
Bill Wendling d632616f86 The MMX shift-with-immediate builtins require the equivalent
shift-with-immediate LLVM intrinsics.

llvm-svn: 114239
2010-09-17 23:46:16 +00:00
Bill Wendling 30983bfcd5 Remove FIXME. The type is correct.
llvm-svn: 114238
2010-09-17 23:45:24 +00:00
Daniel Dunbar 60785eb0f2 Sema/transparent_union: Make sure to add implicit cast when constructing
implicit union values for the transparent_union extension.

llvm-svn: 114236
2010-09-17 23:21:43 +00:00
Ted Kremenek 3586938d37 Tweak in DeclPrinter printing of uses of copy constructors. Patch by Jim Goodnow II.
llvm-svn: 114235
2010-09-17 23:04:38 +00:00
Douglas Gregor 196cf88a01 Update test
llvm-svn: 114234
2010-09-17 23:01:08 +00:00
Douglas Gregor ec06c124f1 Improve recovery when the middle expression of a ternary operator is ill-formed
llvm-svn: 114231
2010-09-17 22:41:34 +00:00
Douglas Gregor 29d907de03 When we run into an error parsing or type-checking the left-hand side
of a binary expression, continue on and parse the right-hand side of
the binary expression anyway, but don't call the semantic actions to
type-check. Previously, we would see the error and then, effectively,
skip tokens until the end of the statement. 

The result should be more useful recovery, both in the normal case
(we'll actually see errors beyond the first one in a statement), but
it also helps code completion do a much better job, because we do
"real" code completion on the right-hand side of an invalid binary
expression rather than completing with the recovery completion. For
example, given

  x = p->y

if there is no variable named "x", we can still complete after the p->
as a member expression. Along the recovery path, we would have
completed after the "->" as if we were in an expression context, which
is mostly useless.

llvm-svn: 114225
2010-09-17 22:25:06 +00:00
Fariborz Jahanian b3e8712a14 Diagnose use of incomplete type on method argument type of
method definitions instead of crashing in code gen.
Fixes radar 8421082.

llvm-svn: 114223
2010-09-17 22:07:07 +00:00
Douglas Gregor 21fd023d44 Update C++0x status
llvm-svn: 114217
2010-09-17 21:37:49 +00:00
Chris Lattner bb3bcd868a fix rdar://8445858 - __sync_* intrinsics erroneously reject ObjC pointers
llvm-svn: 114209
2010-09-17 21:12:38 +00:00
Fariborz Jahanian aaf44b2237 Only assignment operator triggers property setter call.
Fixes radar 8437253.

llvm-svn: 114207
2010-09-17 20:45:45 +00:00
Douglas Gregor f9088c93be When traversing an InitListExpr, there may not be a syntactic form;
check for NULL and visit the InitListExpr we have if there is no
syntactic form.

llvm-svn: 114203
2010-09-17 20:26:51 +00:00
Shantonu Sen afeb03b41d Driver: implement driver automagic support for -lcc_kext
Rewrite linker arguments to use libclang_rt.cc_kext.a
instead of gcc-specific libcc_kext.a

Resolves Radar 7808495

llvm-svn: 114193
2010-09-17 18:39:08 +00:00
David Chisnall dd84ef1e62 Add a -ftrapv-handler= option which allows a handler to invoke instead of simply aborting when a signed operation overflows. This mirrors the (GCC-incompatible) behaviour from clang 1.0 and 1.1 when -ftrapv was specified, but allows the handler to be defined for each compilation unit.
llvm-svn: 114192
2010-09-17 18:29:54 +00:00
Argyrios Kyrtzidis d059997000 Use a temporary file for output which gets renamed after all the writing is finished.
This mainly prevents failures and/or crashes when multiple processes try to read/write the same PCH file. (rdar://8392711&8294781); suggestion & review by Daniel!

llvm-svn: 114187
2010-09-17 17:38:48 +00:00
John McCall 00f1a67ad3 Fix test for no-asserts builds.
llvm-svn: 114185
2010-09-17 17:03:41 +00:00
Fariborz Jahanian 5bbd1b0051 Patch to add IRgen support for Gnu's conditional operator
extension when missing LHS. This patch covers scalar
conditionals only. Others are wip.
(pr7726, radar 8353567).

llvm-svn: 114182
2010-09-17 15:51:28 +00:00
Gabor Greif 433c9e146a rename variable, 'Type' seems to be present in
the enclosing scope, which confuses gcc v3.4 to no end

llvm-svn: 114174
2010-09-17 10:21:45 +00:00
Daniel Dunbar 00aff04c8d Driver/DarwinClang: Add GCC libexec paths so we can find the cc1 binaries if we
ever use fallback.
 - Not necessary for clang as a compiler, but useful for testing purposes.

llvm-svn: 114172
2010-09-17 08:22:12 +00:00
Daniel Dunbar 195fa00399 IRgen: Change CodeGenPasses to be a PassManager, so it can have CallGraphSCC or
Module. Patch by Mike Gist!

llvm-svn: 114171
2010-09-17 07:35:16 +00:00
Daniel Dunbar 14287de654 Reapply "Driver/Darwin: Time for another spin at switching to the DarwinClang",
now that eprintf symbol issue is resolved.

llvm-svn: 114166
2010-09-17 04:25:28 +00:00
Daniel Dunbar e4f65f3885 Revert "Driver/Darwin: Time for another spin at switching to the DarwinClang
toolchain.", while I investigate the totally non-surprising ensuing breakage.

llvm-svn: 114164
2010-09-17 03:46:37 +00:00
Daniel Dunbar 7eba1bf0b7 Fix this test to use -cc1.
llvm-svn: 114156
2010-09-17 02:47:35 +00:00
Daniel Dunbar 1b09e04f9e Driver: Support -dumpmachine.
llvm-svn: 114155
2010-09-17 02:47:28 +00:00
John McCall 769250ea70 Currently we're initializing the vtable pointers of a class only after
the bases are completely initialized.  This won't work --- base
initializer expressions can rely on the vtables having been set up.
Check for uses of 'this' in the initializers and force a vtable
initialization if found.

This might not be good enough;  we might need to extend this to handle
the possibility of arbitrary code finding an external reference to this
(not yet completely-constructed!) object and accessing through it,
in which case we'll probably find ourselves doing a lot more unnecessary
stores.

llvm-svn: 114153
2010-09-17 02:31:44 +00:00
Daniel Dunbar a7afcf92d1 Driver/Darwin: Time for another spin at switching to the DarwinClang toolchain.
llvm-svn: 114149
2010-09-17 01:56:41 +00:00
Daniel Dunbar 3f7796fc22 Driver: Fix spelling of AddCXXStdlibLibArgs, which I copy-n-pasto'd.
llvm-svn: 114147
2010-09-17 01:20:05 +00:00
Daniel Dunbar 8fa86b1a44 Driver/DarwinClang: The new toolchain definition is going to drop the -L inside
the GCC dir. Unfortunately, this breaks -lstdc++ on SnowLeopard, etc. because
the libstdc++ dylib was hiding there. Workaround this by providing the path to
the right -lstdc++.6 (the only version used in recent memory) if we can't see an
obvious -lstdc++, but can find = -lstdc++.6.

llvm-svn: 114146
2010-09-17 01:16:06 +00:00
John McCall 7f9c92a9a0 When emitting a new-expression inside a conditional expression,
the cleanup might not be dominated by the allocation code.
In this case, we have to store aside all the delete arguments
in case we need them later.  There's room for optimization here
in cases where we end up not actually needing the cleanup in
different branches (or being able to pop it after the
initialization code).

Also make sure we only call this operator delete along the path
where we actually allocated something.

Fixes rdar://problem/8439196.

llvm-svn: 114145
2010-09-17 00:50:28 +00:00
Daniel Dunbar 2cc3f17a26 Driver: Add magic handling for "reserved library names", starting with
-lstdc++. This is the best gross solution for a gross problem.

This issue is that historically, GCC has add -L options to its internally
library directories. This has allowed users and platforms to end up depending on
the layout of GCC's internal library directories.

We want to correct this mistake by eliminating that -L, but this means that
existing libraries which are in the GCC lib dir won't be found. We are going to
handle this by treating those -l names as "reserved", and requiring toolchains
to know how to add the right full path to the reserved library.

The immediately side effect of this is that users trying to use -L to find their
own -lstdc++ will need to start using -nostdlib (which is a good idea
anyway). Another side effect is that -stdlib=libc++ -lstdc++ will now do the
"right" thing, for curious definitions of right.

llvm-svn: 114144
2010-09-17 00:45:02 +00:00
Ted Kremenek 6174ca456f Handle '#line' in '-E' that has an empty file name. Fixes <rdar://problem/8439412>.
llvm-svn: 114142
2010-09-17 00:41:18 +00:00
Daniel Dunbar 54423b2a86 Driver: Factor out AddLinkerInputs() function.
llvm-svn: 114138
2010-09-17 00:24:54 +00:00
Daniel Dunbar 62123a12f1 Driver: Add a toolchain hook for whether the system has native LLVM support.
llvm-svn: 114137
2010-09-17 00:24:52 +00:00
Douglas Gregor 009f69979a When dealing with an anonymous enumeration declared in function
prototype scope, temporarily set the context of the enumeration
declaration to the translation unit. We do the same thing for
parameters, until we have an actual function declaration on which to
hang them. Fixes <rdar://problem/8435682>.

There is more work to do in this area, since we have existing bugs
with tags being declared/defined in function parameter lists. This fix
is correct, and we'll end up extending it when we deal with those
existing bugs.

llvm-svn: 114135
2010-09-16 23:58:57 +00:00
Daniel Dunbar dd38fbc7fb IRgen/ABI/x86-32: Realign indirect arguments when the ABI requires us to pass
them with a smaller alignment than the rest of codegen expects.

llvm-svn: 114115
2010-09-16 20:42:06 +00:00
Daniel Dunbar 7b7c2937ef IRgen/ABI: Add support for realigning structures which are passed by indirect
reference.

llvm-svn: 114114
2010-09-16 20:42:02 +00:00
Daniel Dunbar ed23de3348 IRgen/ABI/x86_32/Darwin: On Darwin, only structures with SSE vector types get passed
with a non-default-stack-ABI-alignment (of 16).
 - This fixes the ABI convenient, but breaks codegen since we now have
   underaligned arguments. Marginal improvement overall though, and will be
   fixed in next commit.

llvm-svn: 114113
2010-09-16 20:42:00 +00:00
Daniel Dunbar 8a6c91ff76 IRgen/x86_32/Linux: Linux seems to align all stack objects to 4 bytes, unlike
Darwin. Checked vs the handiest Linux llvm-gcc I had around, someone on Linux is
welcome to investigate more.

llvm-svn: 114112
2010-09-16 20:41:56 +00:00
Chris Lattner e3c1b9317a add a compatibility note about vector builtins
llvm-svn: 114101
2010-09-16 18:17:55 +00:00
Chris Lattner 516790870e improve the "enumeration value 'g' not handled in switch"
warning to handle multiple enumerators with one warning.

llvm-svn: 114093
2010-09-16 17:09:42 +00:00
Douglas Gregor e9e641cce1 Swap the priorities of constants and types, so that we prefer types.
llvm-svn: 114086
2010-09-16 16:21:35 +00:00
Fariborz Jahanian c58ec3a9e5 Removes unused setter.
llvm-svn: 114085
2010-09-16 16:14:34 +00:00
Douglas Gregor 1154e27b4f Don't add two code-completion results for the same selector; it
doesn't add any value. Instead, we'll just take the first method with
that selector that we find and create a completion for it.

llvm-svn: 114082
2010-09-16 16:06:31 +00:00
Douglas Gregor f37c9498bf When collecting Objective-C methods for message send completions, be
sure to visit the protocols of protocols.

llvm-svn: 114079
2010-09-16 15:34:59 +00:00
Douglas Gregor bfcea8b5b1 Implement code completion for Objective-C class message sends that are
missing the opening bracket '[', e.g.,

  NSArray <CC>

at function scope. Previously, we would only give trivial completions
(const, volatile, etc.), because we're in a "declaration name"
scope. Now, we also provide completions for class methods of NSArray,
e.g.,

  alloc

Note that we already had support for this after the first argument,
e.g.,

  NSArray method:x <CC>

would get code completion for class methods of NSArray whose selector
starts with "method:". This was already present because we recover
as if NSArray method:x were a class message send missing the opening
bracket (which was committed in r114057).

llvm-svn: 114078
2010-09-16 15:14:18 +00:00
Douglas Gregor ae18530d03 Fix a silly typo and its pasteo. Thanks to Francois Pichet for noticing my mistake
llvm-svn: 114075
2010-09-16 13:54:00 +00:00
John McCall f4ee1ddfa2 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.

llvm-svn: 114071
2010-09-16 06:57:56 +00:00
John McCall 0bdb1fd477 Opportunistically use the C++ personality function in ObjC++
translation units that don't catch ObjC types.  rdar://problem/8434851

llvm-svn: 114070
2010-09-16 06:16:50 +00:00
Daniel Dunbar 0bd7a9345b Basic: Add f{dim,ma,max,min}[lf]? builtins.
llvm-svn: 114068
2010-09-16 05:20:04 +00:00
Tom Care 58191966bc Refactored BugReporter to refer to EndNode as ErrorNode. We currently make the assumption that EndNode == ErrorNode, but upcoming changes will break this.
llvm-svn: 114065
2010-09-16 03:50:38 +00:00
Zhongxing Xu d38fb8466c Tidy up.
llvm-svn: 114062
2010-09-16 03:28:18 +00:00
John McCall 2a8b9a3caa Further beautification: this pointer can now be typed.
llvm-svn: 114061
2010-09-16 03:16:41 +00:00
John McCall 58649dc609 Initialize AggValueSlot's flags along all paths, plus minor beautification.
Prospective fix for broken commit in r114045.

llvm-svn: 114060
2010-09-16 03:13:23 +00:00
John McCall 561cd86acf Fix the clang build after Zhongxing Xu's commit.
llvm-svn: 114059
2010-09-16 03:09:43 +00:00
Douglas Gregor abf4a3e4c6 Implement automatic bracket insertion for Objective-C class message
sends. These are far trickier than instance messages, because we
typically have something like

  NSArray alloc]

where it appears to be a declaration of a variable named "alloc" up
until we see the ']' (or a ':'), and at that point we can't backtrace.
So, we use a combination of syntactic and semantic disambiguation to
treat this as a message send only when the type is an Objective-C type
and it has the syntax of a class message send (which would otherwise
be ill-formed).

llvm-svn: 114057
2010-09-16 01:51:54 +00:00
Zhongxing Xu 2cd7a78c76 Introduce new CFGElement hierarchy to support C++ CFG, based on Marcin's patch
and discussions with Ted and Jordy.

llvm-svn: 114056
2010-09-16 01:25:47 +00:00
Daniel Dunbar 2126aae674 build: Add support for a CLANG_ORDER_FILE build variable to specify the path to
the order file to use for the clang executable.

llvm-svn: 114052
2010-09-16 00:42:38 +00:00
Ted Kremenek 8eeec5bd03 Do not warn about empty bodies for 'if' statements if the body is expanded from a macro.
Fixes <rdar://problem/8436021>.

llvm-svn: 114049
2010-09-16 00:37:05 +00:00
Fariborz Jahanian b60e70f963 Patch to move RequiresGCollection bit to
AggValueSlot slot.

llvm-svn: 114045
2010-09-16 00:20:07 +00:00
Ted Kremenek 853734e558 For self-comparison warning, check the source location of both the LHS and RHS to see if they
are expanded from macros (and if so, omit the warning).  Previously we were just looking at the
location of the binary expression.

Fixes <rdar://problem/8435950>.

llvm-svn: 114044
2010-09-16 00:03:01 +00:00
Douglas Gregor 3e972009fb Handle bracket insertion for Objective-C class messages in a very
narrow, almost useless case where we're inside a parenthesized
expression, e.g.,

  (NSArray alloc])

The solution to the general case still eludes me.

llvm-svn: 114039
2010-09-15 23:19:31 +00:00
John McCall 02dc8c73e1 Tweak comment as suggested by Sebastian.
llvm-svn: 114019
2010-09-15 20:59:13 +00:00
Devang Patel 28b5286bda While handling change of file, check if _current_ file is already seen or not. If current file is seen then it indicates that end of previous file's lexical scope.
This fixes radar 8396182.

llvm-svn: 114018
2010-09-15 20:50:40 +00:00
Sebastian Redl 50e2658f63 Macro definitions in AST files have their own IDs.
llvm-svn: 114014
2010-09-15 19:54:06 +00:00
Nick Lewycky 970aed92c0 Initialize TypeOrExpr to NULL to silence a false-positive uninitialized warning
from certain GCC's. Patch by Neil Vachharajani!

llvm-svn: 113995
2010-09-15 18:35:19 +00:00
Marcin Swiderski 0f592ace6b Test commit
llvm-svn: 113994
2010-09-15 18:34:15 +00:00
Jakob Stoklund Olesen f7c67d9f46 Revert "Clean up in buildbot directories."
This reverts commit 113814.

This patch was never intended to stay in the repository. If you are reading this
from the future, we apologize for the noise.

llvm-svn: 113990
2010-09-15 18:08:14 +00:00
Douglas Gregor ed0b69dc81 Improve code completion for Objective-C message sends when the opening
'[' is missing. Prior commits improving recovery also improved code
completion beyond the first selector, e.g., at or after the "to" in

  calculator add:x to:y

but not after "calculator". We now provide the same completions for

  calculator <CC>

that we would for

  [calculator <CC>

if "calculator" is an expression whose type is something that can
receive Objective-C messages.

This code completion works for instance and super message sends, but not
class message sends.

llvm-svn: 113976
2010-09-15 16:23:04 +00:00
Fariborz Jahanian f51a38777b Make the new -fobjc-nonfragile-abi2 the default
abi for clang's objective-c compilations.
(radar 8353555).

llvm-svn: 113974
2010-09-15 16:00:51 +00:00
Douglas Gregor 7617c7d295 Extend bracket insertion to message sends to "super", e.g.,
super method:arg]

will now recover nicely and insert the '[' before 'super'.

llvm-svn: 113971
2010-09-15 15:09:43 +00:00
Douglas Gregor d6d980044e Extend bracket insertion to handle nullary selectors, e.g.
a getFoo]

llvm-svn: 113969
2010-09-15 14:54:45 +00:00
Douglas Gregor e9bba4f1a4 Implement bracket insertion for Objective-C instance message sends as
part of parser recovery. For example, given:

  a method1:arg];

we detect after parsing the expression "a" that we have the start of a
message send expression. We pretend we've seen a '[' prior to the a,
then parse the remainder as a message send. We'll then give a
diagnostic+fix-it such as:

fixit-objc-message.m:17:3: error: missing '[' at start of message
      send expression
  a method1:arg];
  ^
  [

The algorithm here is very simple, and always assumes that the open
bracket goes at the beginning of the message send. It also only works
for non-super instance message sends at this time.

llvm-svn: 113968
2010-09-15 14:51:05 +00:00
Benjamin Kramer 6cbfca121b Tweak regex not to accidentally match a trailing \r.
llvm-svn: 113966
2010-09-15 12:31:46 +00:00
Cameron Esfahani 70004ec456 Fix pointer-signext.c test case: it was relying on value names, which don't appear in the non-assert build. Switch to using check-next as well.
llvm-svn: 113964
2010-09-15 10:52:02 +00:00
John McCall 5a948500c5 Test hardening.
llvm-svn: 113963
2010-09-15 10:38:11 +00:00
John McCall 7a626f63f7 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

llvm-svn: 113962
2010-09-15 10:14:12 +00:00
Ted Kremenek 7b31a61d10 Relax assertion in CFG builder when processing ForStmts. This fixes an assertion failure
on code containing GNU statement expressions reported in PR 8141.

llvm-svn: 113953
2010-09-15 07:01:20 +00:00
Daniel Dunbar cfe3a2f6e8 build: Start sketching code to allow grafting libc++ build into LLVM/Clang build if
libc++ is checked out into llvm/projects.
 - WIP, not on by default yet.

llvm-svn: 113924
2010-09-15 03:53:45 +00:00
Ted Kremenek c4deb92316 Disallow the use of UnknownVal as the index for ElementRegions. UnknownVals can be used as
the index when the value evaluation isn't powerful enough.  By creating ElementRegions with
UnknownVals as the index, this gives the false impression that they are the same element, when
they really aren't.  This becomes really problematic when deriving symbols from these regions
(e.g., those representing the initial value of the index), since two different indices will
get the same symbol for their binding.

This fixes an issue with the idempotent operations checker that would cause two indices that
are clearly not the same to make it appear as if they always had the same value.

Fixes <rdar://problem/8431728>.

llvm-svn: 113920
2010-09-15 03:13:30 +00:00
Douglas Gregor e572b068ab Fix classification of statement expressions.
llvm-svn: 113917
2010-09-15 01:37:48 +00:00
Cameron Esfahani eb85650e67 Fix Windows64 target info so pointer arithmetic is done correctly, and no sign extension code is emitted: PtrDiffType needs to be a signed long long. Add a corresponding test case.
llvm-svn: 113910
2010-09-15 00:28:12 +00:00
Francois Pichet f657b639fd Microsoft's flexible array rules relaxation:
- in union
   - as the only element of a struct/class.

llvm-svn: 113909
2010-09-15 00:14:08 +00:00
Douglas Gregor 5e35d59188 Introduce a new code-completion context for a parenthesized
expression, e.g., after the '(' that could also be a type cast. Here,
we provide types as code-completion results in C/Objective-C (C++
already had them), although we wouldn't in a normal expression context.

llvm-svn: 113904
2010-09-14 23:59:36 +00:00
Ted Kremenek e97b1ebef1 Add CFG::BuildOptions class to pass in CFG builder options under on parameter. Patch by Marcin Świderski!
llvm-svn: 113898
2010-09-14 23:41:16 +00:00
Sebastian Redl 058fc820d7 Fix destructor and assignment operator lookup in the has_nothrow traits.
llvm-svn: 113897
2010-09-14 23:40:14 +00:00
Ted Kremenek 72c9b0d582 Adjust assertion in RegionStoreManager::RetrieveArray() to also take into account typedefs.
llvm-svn: 113893
2010-09-14 23:29:38 +00:00
Daniel Dunbar 092b6fb187 Driver: Add a -stdlib= argument which can be used to select the C++ standard
library to use.
 - This is currently useful for testing libc++; you can now use 'clang++
   -stdlib=libc++ t.cpp' to compile using it if installed.

 - In the future could also be used to select other standard library choices if
   alternatives become available (for example, to use an alternate C library).

llvm-svn: 113891
2010-09-14 23:12:40 +00:00
Daniel Dunbar bf11f79053 Driver: Factor out some code for handling the C++ standard library.
llvm-svn: 113890
2010-09-14 23:12:35 +00:00
Daniel Dunbar 30a12b8d88 Simplify.
llvm-svn: 113889
2010-09-14 23:12:31 +00:00
Ted Kremenek c95589d2e6 Don't divide-by-zero in RegionStoreManager::getSizeInElements() when getting the size of a VLA. We don't track VLA extents yet,
but we should at least not crash.  Fixes <rdar://problem/8424269>.

llvm-svn: 113888
2010-09-14 23:08:34 +00:00
Fariborz Jahanian 805b74ea30 RHS of property expression assignment requires
copy initialization before passing it to 
a setter. Fixes radar 8427922.

llvm-svn: 113885
2010-09-14 23:02:38 +00:00
Douglas Gregor 6ed2feebfc When marking the declarations in a default argument expression as
"used", at the time that the default argument itself is used, also
mark destructors that will be called by this expression. This fixes a
regression that I introduced in r113700, which broke WebKit, and fixes
<rdar://problem/8427926>.

llvm-svn: 113883
2010-09-14 22:55:20 +00:00
Douglas Gregor 4e4425030a Eliminate the default case in the expression-classification code, so
that we're sure to keep it updated when new expression kinds
emerge. Also fixes a few little bugs in the classification of
expressions.

llvm-svn: 113864
2010-09-14 21:51:42 +00:00
John McCall d441b1e637 Tweak this assert.
llvm-svn: 113863
2010-09-14 21:45:42 +00:00
Tom Care c88ed9561e Rename 'MaxLoop' to 'MaxVisit' in AnalysisManager to more correctly reflect that we aborted analysis may not necessarily be due to a loop.
llvm-svn: 113862
2010-09-14 21:35:27 +00:00
John McCall d3be2c83d5 The paired 'operator delete' for a placement 'operator new' is always a
placement 'operator delete', even if there are no placement args (i.e.
overload resolution selected an operator new with default arguments).

llvm-svn: 113861
2010-09-14 21:34:24 +00:00
John McCall 824c2f537c Implement the EH cleanup to call 'operator delete' if a new-expression throws
(but not if destructors associated with the full-expression throw).

llvm-svn: 113836
2010-09-14 07:57:04 +00:00
Michael J. Spencer 433e9c7f2a PrintFunctionNames: Fix Windows (MSV{S,C} and mingw) build.
llvm-svn: 113835
2010-09-14 06:39:35 +00:00
Ted Kremenek 8abff774aa Fix CFGBuilder crash reported in PR 8141.
llvm-svn: 113826
2010-09-14 01:13:32 +00:00
Argyrios Kyrtzidis 9efa1ce145 Fix VLA miscompilation.
llvm.stacksave/llvm.stackrestore wasn't emitted for VLAs in inner scopes.
Fixes r8403108.

llvm-svn: 113822
2010-09-14 00:42:34 +00:00
Douglas Gregor 2967e28ee7 I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.
I will not mix declaration and statements in C90.

llvm-svn: 113821
2010-09-14 00:20:32 +00:00
Michael J. Spencer 09476212de Revert "CMake: Update to use standard CMake dependency tracking facilities instead"
This reverts commit r113631

Conflicts:

	CMakeLists.txt
	lib/CodeGen/CMakeLists.txt

llvm-svn: 113817
2010-09-13 23:54:41 +00:00
Jakob Stoklund Olesen 54481e5948 Clean up in buildbot directories.
This test created a statements.ll file until about a month ago. Some buildbots
still have this file in their source dir. This is the easiest way to remove the
file on all bots. Then I'll revert.

llvm-svn: 113814
2010-09-13 23:26:28 +00:00
Douglas Gregor 83d61f914a Add __char16_t and __char32_t as aliases for the C++0x char16_t and
char32_t, respectively, but which can also be used in C++98/03
mode. Fixes <rdar://problem/8418510>.

llvm-svn: 113813
2010-09-13 23:21:44 +00:00
Douglas Gregor 16a2bdd6b0 Introduce a new kind of cursor into libclang, which covers a reference
to an "overloaded" set of declarations. This cursor kind works for
unresolved references to functions/templates (e.g., a call within a
template), using declarations, and Objective-C class and protocol
forward declarations.

llvm-svn: 113805
2010-09-13 22:52:57 +00:00
Ted Kremenek 19d4d2f0ef Add reverse iterator for initializers in constructor. Patch by Marcin Świderski!
llvm-svn: 113800
2010-09-13 22:26:02 +00:00
Ted Kremenek 8c1e37bfbe Add 'insert()' to BumpVector. Patch by Marcin Świderski!
llvm-svn: 113799
2010-09-13 22:25:59 +00:00
Ted Kremenek 35965b972e Remove from the CFG the half-implemented support for scoping information. We decided that scope information doesn't belong in the CFG at all, since it is a lexical construct.
Patch by Marcin Świderski!

llvm-svn: 113798
2010-09-13 22:25:54 +00:00
Sebastian Redl 5c649bc7bb Don't crash when using type traits on a class with a constructor template.
llvm-svn: 113796
2010-09-13 22:18:28 +00:00
Sebastian Redl c15c326b51 Remove CXXRecordDecl::getDefaultConstructor(), an inherently unsafe function due to lazy declaration of default constructors. Now that __has_nothrow_constructor doesn't use it anymore, part of PR8101 is fixed.
llvm-svn: 113794
2010-09-13 22:02:47 +00:00
Eric Christopher 26c045d9ff Try to get this to stop leaving a temporary file on linux.
llvm-svn: 113793
2010-09-13 21:51:42 +00:00
Sebastian Redl 951006f510 Have __has_nothrow_copy use Sema's lookup routines. This fixes the problem with not finding implicitly declared copy constructors, part of PR8107.
llvm-svn: 113784
2010-09-13 21:10:20 +00:00
Sebastian Redl 8eb06f17c4 Eagerly evaluate type traits in Sema instead of lazily in AST. They actually need Sema access to be correct, fixes coming up.
llvm-svn: 113782
2010-09-13 20:56:31 +00:00
Devang Patel 068b5b3d61 Recognize .ll as input files.
Handle %test_debuginfo on a RUN command line.

This set up now allows one to write small test cases to check debug info.
e.g.

; RUN: %clang -O0 -g %s -c -o %t.o
; RUN: %clang %t.o -o %t.out  
; RUN: %test_debuginfo %s %t.out

define i32 @f1(i32 %i) nounwind ssp {
; DEBUGGER: break f1                                                               
; DEBUGGER: r                                                                      
; DEBUGGER: p i                                                                    
; CHECK: $1 = 42                                                                   
entry:
  %i.addr = alloca i32, align 4
...
...
}

It is also possible now to write test cases in c/c++.
The plan is to store these debug info testcases in a separate place.

llvm-svn: 113780
2010-09-13 20:46:23 +00:00
Argyrios Kyrtzidis 14ec9f674a When applying 'delete' on a pointer-to-array type match GCC and EDG behavior and treat it as 'delete[]'.
Also offer a fix-it hint adding '[]'.

llvm-svn: 113778
2010-09-13 20:15:54 +00:00
Argyrios Kyrtzidis 9b0d1cf47c Remove the trivial setters from CXXDeleteExpr.
llvm-svn: 113777
2010-09-13 20:15:40 +00:00
Argyrios Kyrtzidis cebc0f006f Add a compatibility note about clang not implicitly converting between objc_object* and id (and SEL, Class).
llvm-svn: 113761
2010-09-13 17:48:07 +00:00
Argyrios Kyrtzidis 2716b9ae54 Update 'docs/PCHInternals.html' about how subexpressions are stored.
llvm-svn: 113760
2010-09-13 17:48:02 +00:00
Douglas Gregor e47191cfe1 Fix a typo noted by Gabor
llvm-svn: 113754
2010-09-13 16:44:26 +00:00
Fariborz Jahanian 0aa35b9cf5 Block description for trivial block literals have
their 'isa' field scanned regardless.

llvm-svn: 113749
2010-09-13 16:09:44 +00:00
Argyrios Kyrtzidis f24d569f9e Fix C++ PCH issue.
The canonical FunctionTemplateDecl contains the specializations but we cannot use getCanonicalDecl on Template because it may still be initializing.
Write and read it from PCH.
Fixes http://llvm.org/PR8134

llvm-svn: 113744
2010-09-13 11:45:48 +00:00
Argyrios Kyrtzidis 0e8b3ce247 Avoid setters in ASTDeclReader::VisitClassTemplatePartialSpecializationDecl.
llvm-svn: 113743
2010-09-13 11:45:41 +00:00
Argyrios Kyrtzidis b4c659b662 Avoid setters in ASTDeclReader::VisitClassTemplateSpecializationDecl.
llvm-svn: 113742
2010-09-13 11:45:32 +00:00
Argyrios Kyrtzidis caf8248fc5 Avoid setters in ASTDeclReader::VisitCXXRecordDecl.
llvm-svn: 113741
2010-09-13 11:45:25 +00:00
Abramo Bagnara 3aabb4b452 Congruent diagnostic for void* arithmetic.
llvm-svn: 113740
2010-09-13 06:50:07 +00:00
Abramo Bagnara 6a0c4097f1 Parentheses around address non-type template argument is demoted to an extension warning.
llvm-svn: 113739
2010-09-13 06:06:58 +00:00
Douglas Gregor bdd7b2358b Don't assert when attempting to take the address of an overloaded
function fails due to ambiguities in partial ordering of function
templates. Fixes PR8033.

llvm-svn: 113725
2010-09-12 08:16:09 +00:00
Douglas Gregor d5b730c9d5 When performing overload resolution, only compare the final conversion
sequences for two conversion functions when in fact we are in the text
of initialization by a user-defined conversion sequences. Fixes PR8034.

llvm-svn: 113724
2010-09-12 08:07:23 +00:00
Douglas Gregor 6162334ce0 Diagnose the instantiation of variables (including static data
members) with function type. Fixes PR8047.

llvm-svn: 113723
2010-09-12 07:37:24 +00:00
Douglas Gregor 6309e3d18e Don't complain about useless user-defined conversion functions when
they were instantiated from a template. In template metaprogramming,
stuff happens. Fixes PR8065.

llvm-svn: 113722
2010-09-12 07:22:28 +00:00
Douglas Gregor 8ce63154d0 When diagnosing C++ [temp.expl.spec]p3 in C++98/03 mode, downgrade the
error to a warning if we're in a case that would be allowed in
C++0x. This "fixes" PR8084 by making Clang accept more code than GCC
and (non-strict) EDG do. 

Also, add the missing test case for the C++0x semantics, which should
have been in r113717.

llvm-svn: 113718
2010-09-12 05:24:55 +00:00
Douglas Gregor b1aab43887 Implement C++0x semantics for [temp.expl.spec]p2, which loosens the
restrictions on out-of-line specializations to allow them anywhere in
an enclosing context. Motivated by PR8084.

llvm-svn: 113717
2010-09-12 05:08:28 +00:00
Francois Pichet 488b4a7d94 Add basic support for Microsoft enum forward declaration.
Assigning an underlying integral type to an enum forward declaration will come in a next patch.

llvm-svn: 113716
2010-09-12 05:06:55 +00:00
Douglas Gregor 2bbc0266e0 Implement the "note" in C++ [over.built]p1, which is actually meant to
be a semantic requirement that a built-in overloaded operator is not
added to the overload set of there is already a user-defined
overloaded operator with the same parameter types. Fixes PR8087.

llvm-svn: 113713
2010-09-12 04:28:07 +00:00
Douglas Gregor c87f4d4aba Don't perform integral promotions from an incompletion enumeration
type. Fixes PR8089 in a slightly different way than had been suggested.

llvm-svn: 113711
2010-09-12 03:38:25 +00:00
Douglas Gregor 32b3de519d Teach the EvaluatedExprVisitor and its client, which marks
declarations in potentially-evaluated subexpressions, about
recursion. Fixes the release-mode self-host failure I introduced in
r113700.

llvm-svn: 113708
2010-09-11 23:32:50 +00:00
Chris Lattner 8ee6a4142a Augment -ftrapv to check for divide by zero, mod by zero, and INT_MIN % -1.
Patch by John Regehr!

llvm-svn: 113705
2010-09-11 21:47:09 +00:00
Francois Pichet 9672347122 Update website to reflect that tests are no longer failing on Windows.
llvm-svn: 113704
2010-09-11 21:16:11 +00:00
Douglas Gregor 8694aea7db Add a completely unnecessary "template" keyword to appease GCC
llvm-svn: 113703
2010-09-11 20:47:38 +00:00
Francois Pichet 8f170b8239 Fix last test still failing on Win32. 100% pass rate now!
llvm-svn: 113702
2010-09-11 20:43:12 +00:00
Douglas Gregor a139692ada Update documentation to reflect the addition of support for in-class
initialization of static const floating-point data membmers (John's
patch, in r113663).

llvm-svn: 113701
2010-09-11 20:30:02 +00:00
Douglas Gregor 8a01b2a392 When parsing default function arguments, do not mark any declarations
used in the default function argument as "used". Instead, when we
actually use the default argument, make another pass over the
expression to mark any used declarations as "used" at that point. This
addresses two kinds of related problems:

  1) We were marking some declarations "used" that shouldn't be,
  because we were marking them too eagerly.
  2) We were failing to mark some declarations as "used" when we
  should, if the first time it was instantiated happened to be an
  unevaluated context, we wouldn't mark them again at a later point.

I've also added a potentially-handy visitor class template
EvaluatedExprVisitor, which only visits the potentially-evaluated
subexpressions of an expression. I bet this would have been useful for
noexcept...

Fixes PR5810 and PR8127.

llvm-svn: 113700
2010-09-11 20:24:53 +00:00
Douglas Gregor c6876fe121 Document our extension to constant-fold __builtin_strlen and strlen
llvm-svn: 113699
2010-09-11 18:08:34 +00:00
Douglas Gregor 250ab1dc0e The two libclang crash-recovery tests that involve precompiled
preambles end up leaving the precompiled preambles around. This is by
design, since we do minimal cleanup during crash recovery. However,
it's unfortunate for testing, so introduce a hook that allows these
two tests to put the precompiled preamble somewhere where we can
delete them after testing.

llvm-svn: 113698
2010-09-11 18:05:19 +00:00
Douglas Gregor e10f0e5670 If we fail to create a temporary file for the precompiled preamble,
just abort creation of the precompiled preamble rather than doing
silly things. This is the second part of the fix for the weird
preamble-related failures on Windows. Big thanks to Francois Pichet
for the great detective work!

llvm-svn: 113697
2010-09-11 17:56:52 +00:00
Nuno Lopes d4e42830cb add latest gentoo gcc path
llvm-svn: 113696
2010-09-11 17:51:45 +00:00
Douglas Gregor ce3449f5bd Tweak GetPreamblePCHPath() to more closely match the behavior of the
Windows GetTempPath() function, and be sure to create the directory in
which the precompiled preamble will reside before creating the
temporary file itself.

llvm-svn: 113695
2010-09-11 17:51:16 +00:00
Anton Korobeynikov 82b3333b72 Disable cxa_atexit by default on MingW.
Patch by Dimitry Andric!

llvm-svn: 113683
2010-09-11 11:17:06 +00:00
Michael J. Spencer 9efc54890d CMake: Fix mingw32 build.
llvm-svn: 113677
2010-09-11 02:13:48 +00:00
Fariborz Jahanian 933c6723a4 Fixes an obscure bug in importd block variable layout
information when imported variable is used
more than once. Originally though to be a bug in importing
block varibles. Fixes radar 8417746.

llvm-svn: 113675
2010-09-11 01:27:29 +00:00
Sebastian Redl a8bac37bb1 Test destructors in delete expressions and of temporaries for throwing.
llvm-svn: 113664
2010-09-10 23:27:10 +00:00
John McCall db76892e72 Support in-class initialization of static const floating-point data members.
llvm-svn: 113663
2010-09-10 23:21:22 +00:00
Douglas Gregor c7a7d92ad2 Fix my silly sorting predicate. I hate integer-to-bool conversions
llvm-svn: 113656
2010-09-10 23:05:54 +00:00
Sebastian Redl b8a76c42b5 Address Doug's comments.
llvm-svn: 113650
2010-09-10 22:34:40 +00:00
Douglas Gregor ca3682d486 Make sure we're producing a newline in the preprocessed output before
emitting a #pragma, whenever one is needed. Fixes <rdar://problem/8417307>.

llvm-svn: 113648
2010-09-10 22:27:29 +00:00
Sebastian Redl e56be2f72c Eli helped me understand how evaluation contexts work.
llvm-svn: 113642
2010-09-10 21:57:27 +00:00
Daniel Dunbar b5b7d1a415 Driver: Set TOOL_NO_EXPORTS when building a "production" compiler, we don't
currently expect that to be useful for plugins, and this is important for
startup performance:
--
ddunbar@lordcrumb:tmp$ touch empty.c
ddunbar@lordcrumb:tmp$ runN 100 ~/llvm.obj.64/Release/bin/clang -c empty.c
name	  avg  	  min  	  med  	  max  	   SD  	 total 
user	 0.0054	 0.0052	 0.0054	 0.0055	 0.0000	 0.5350
 sys	 0.0084	 0.0090	 0.0078	 0.0087	 0.0008	 0.8390
wall	 0.0149	 0.0149	 0.0149	 0.0149	 0.0003	 1.4943
ddunbar@lordcrumb:tmp$ runN 100 ~/llvm.obj.64/Release/bin/clang -c empty.c
name	  avg  	  min  	  med  	  max  	   SD  	 total 
user	 0.0036	 0.0036	 0.0036	 0.0038	 0.0000	 0.3646
 sys	 0.0072	 0.0071	 0.0068	 0.0070	 0.0006	 0.7158
wall	 0.0123	 0.0123	 0.0122	 0.0136	 0.0003	 1.2262
--

llvm-svn: 113638
2010-09-10 21:42:03 +00:00
Sebastian Redl c48e6e9f28 Follow Ted's example and hide CXXNoexceptExpr's setters from all but serialization.
llvm-svn: 113634
2010-09-10 21:15:56 +00:00
Michael J. Spencer 0881f4a367 CMake: Update to use standard CMake dependency tracking facilities instead
of whatever we were using before...

llvm-svn: 113631
2010-09-10 21:13:16 +00:00
Sebastian Redl 8c40ba392c Test CXXNoexceptExpr codegen and serialization.
llvm-svn: 113630
2010-09-10 21:04:03 +00:00
Sebastian Redl b67655fc6d Implement CXXNoexceptExpr codegen.
llvm-svn: 113629
2010-09-10 21:04:00 +00:00
Sebastian Redl 4fa4a6b85e Add another small test case.
llvm-svn: 113628
2010-09-10 21:03:58 +00:00