Commit Graph

14118 Commits

Author SHA1 Message Date
Daniel Dunbar 9296f63ff0 Driver: Update -O -> -O2 replacement for addition of -O0 option.
llvm-svn: 104823
2010-05-27 06:51:08 +00:00
John McCall bf8c519a0d Require a complete type when performing the qualified lookup during
instantiation of a dependent elaborated type specifier.  Fixes PR 7199.

llvm-svn: 104822
2010-05-27 06:40:31 +00:00
John McCall 943fae95f5 Implement __builtin_init_dwarf_reg_size_table and __builtin_dwarf_sp_column
for 32-bit MIPS processors.  Hat-tip to rdivacky for providing gcc dumps
on this.

llvm-svn: 104816
2010-05-27 06:19:26 +00:00
Daniel Dunbar 06e2cc3f86 Driver: Add support for -m[no-]relax-all, and make it the default at -O0.
llvm-svn: 104815
2010-05-27 06:18:05 +00:00
Daniel Dunbar 6da1098b4b Sema: Add initial support for '#pragma options align=mac68k'.
- Docs are fairly sketchy, if someone wants to pore through gcc to look for
   holes I'd appreciate any failing test cases!

llvm-svn: 104809
2010-05-27 05:45:51 +00:00
Anders Carlsson 439edd1aea More work on the new empty subobject map.
llvm-svn: 104808
2010-05-27 05:41:06 +00:00
Daniel Dunbar c43b6b20d5 Driver: Add clang -cc1 -mrelax-all option, which sets relaxes all instructions when using -integrated-as.
llvm-svn: 104807
2010-05-27 05:39:39 +00:00
Daniel Dunbar 592a85c137 Strip trailing whitespace.
llvm-svn: 104801
2010-05-27 02:25:46 +00:00
Daniel Dunbar fc6507ef58 AST: Add AlignMac68kAttr, not yet used.
llvm-svn: 104800
2010-05-27 02:25:39 +00:00
Daniel Dunbar 4dbe15d437 Sema: Factor out struct for alignment stack entries.
llvm-svn: 104799
2010-05-27 02:25:27 +00:00
Daniel Dunbar 8804f2e253 Sema: Replace getPragmaPackAlignment with AddAlignmentAttributesForRecord, which
exposes less details.

llvm-svn: 104797
2010-05-27 01:53:40 +00:00
John McCall c2af939ab4 When deciding whether a deferred declaration has already been emitted,
aliases count as definitions regardless of whether their target has been
emitted yet.  Fixes PR 7142.

llvm-svn: 104796
2010-05-27 01:45:30 +00:00
Daniel Dunbar 401304462a AST: Rename PragmaPackAttr to MaxFieldAlignmentAttr, which is more accurate.
llvm-svn: 104795
2010-05-27 01:12:46 +00:00
Daniel Dunbar bd60652ace Sema: Reject '#pragma options align=mac68k' everywhere except i386-apple-darwin.
llvm-svn: 104789
2010-05-27 00:35:16 +00:00
Ted Kremenek 15a0abd399 Discard qualifiers for ElementRegions so that a 'const' doesn't change the lookup semantics
in the symbol store.  We may wish to push this down into the StoreManager itself.

llvm-svn: 104788
2010-05-27 00:29:00 +00:00
Anders Carlsson c121b4e59f More work on the empty subobjects map.
llvm-svn: 104787
2010-05-27 00:07:01 +00:00
Daniel Dunbar 69dac58e7d Sema: Support for #pragma options align={reset,natural}. '#pragma options align'
shares the stack with '#pragma pack', who knew!?

llvm-svn: 104786
2010-05-27 00:04:40 +00:00
Daniel Dunbar 75c9be7e80 Parse: Add support for '#pragma options align'.
Also, fix a source location bug with the rparen in #pragma pack.

llvm-svn: 104784
2010-05-26 23:29:06 +00:00
John McCall 23f6626262 Correctly pass aggregates by reference when emitting thunks.
llvm-svn: 104778
2010-05-26 22:34:26 +00:00
Douglas Gregor a2db793ff0 Introduce priorities into the code-completion results.
llvm-svn: 104751
2010-05-26 22:00:08 +00:00
Fariborz Jahanian 5f81b9f3f6 Patch to fix a irgen crash accessing an initialized local static
variable in a local function. Fixes pr7101.

llvm-svn: 104743
2010-05-26 21:45:50 +00:00
Ted Kremenek 34ddec630c Predefine the '__clang_analyzer__' macro when using '-analyze'.
llvm-svn: 104742
2010-05-26 21:36:54 +00:00
Fariborz Jahanian b0e28471a6 Improve on flexible array diagnostics (PR7029).
llvm-svn: 104739
2010-05-26 20:46:24 +00:00
Fariborz Jahanian 1138ba6693 Fixes misc. flexible array bugs in c++ (PR7029).
llvm-svn: 104733
2010-05-26 20:19:07 +00:00
Charles Davis c9e78145b0 Extract the ObjC and blocks manglers into their own class. No functionality
change.

llvm-svn: 104715
2010-05-26 18:25:27 +00:00
Abramo Bagnara 341d783488 Added source order to CXXBaseOrMemberInitializer.
llvm-svn: 104712
2010-05-26 18:09:23 +00:00
Anders Carlsson c5ca1f7799 Move ComputeEmptySubobjectSizes to EmptySubobjectMap.
llvm-svn: 104702
2010-05-26 15:54:25 +00:00
Anders Carlsson f58de11b61 Stub out the EmptySubobjectsMap class.
llvm-svn: 104701
2010-05-26 15:32:58 +00:00
Anders Carlsson ce7f77729a Inline the RecordLayoutBuilder constructor.
llvm-svn: 104700
2010-05-26 15:20:08 +00:00
Anders Carlsson c28a6c9251 Add a Layout overload that takes a CXXRecordDecl.
llvm-svn: 104695
2010-05-26 15:10:00 +00:00
Benjamin Kramer c7656cdf83 Move RecordLayoutBuilder into an anonymous namespace.
llvm-svn: 104693
2010-05-26 09:58:31 +00:00
Douglas Gregor 1b30b3c9fa When transforming a C++ "new" expression's constructor arguments, drop
any arguments that are default-argument expressions. The can show up
when we have a new expression whose constructor arguments are not
type-dependent and whose allocated type is not dependent and has a
constructor with default arguments. Fixes PR7202.

llvm-svn: 104690
2010-05-26 07:10:06 +00:00
Anders Carlsson c222620adf Rename ASTRecordLayoutBuilder to RecordLayoutBuilder.
llvm-svn: 104688
2010-05-26 05:58:59 +00:00
Anders Carlsson b47c482cf0 Remove RecordLayoutBuilder.h
llvm-svn: 104687
2010-05-26 05:49:19 +00:00
Anders Carlsson 35a36eb78d Move the ASTRecordLayoutBuilder class declaration into the .cpp file.
llvm-svn: 104686
2010-05-26 05:41:04 +00:00
Douglas Gregor 9af03022ff Tell the string literal parser when it's not permitted to emit
diagnostics. That would be while we're parsing string literals for the
sole purpose of producing a diagnostic about them. Fixes
<rdar://problem/8026030>.

llvm-svn: 104684
2010-05-26 05:35:51 +00:00
Anders Carlsson b48414f4cb Fix thinko and remove another unused function.
llvm-svn: 104683
2010-05-26 05:31:23 +00:00
Anders Carlsson 1d1e4cf04d Fix build.
llvm-svn: 104682
2010-05-26 05:25:15 +00:00
Anders Carlsson d20e7cd3c6 No need to use the PrimaryBaseInfo struct in the builder.
llvm-svn: 104681
2010-05-26 05:20:58 +00:00
Douglas Gregor 0094eb26fc Be sure to use the standard substitutions when mangling the names of
vtables, VTTs, and construction vtables. Fixes PR7201.

llvm-svn: 104675
2010-05-26 05:11:13 +00:00
Anders Carlsson 87209bb54b Remove FIXME.
llvm-svn: 104674
2010-05-26 05:11:02 +00:00
Anders Carlsson d295486012 Fold the other Layout overload into its sole call site.
llvm-svn: 104673
2010-05-26 05:10:47 +00:00
Anders Carlsson 6ed3a9a494 Fold the ASTRecordLayoutBuilder::ComputeLayout overload that takes an ObjCInterfaceDecl pointer into its only callsite.
llvm-svn: 104672
2010-05-26 05:04:25 +00:00
Anders Carlsson df291d8d8b Move the relevant ASTContext member functions that deal with ASTRecordLayoutBuilder into RecordLayoutBuilder.cpp. This matches the way we interact with other builder classes (CGRecordLayoutBuilder, VTableBuilder and VTTBuilder) and it also allows for making ASTRecordLayoutBuilder a private class without a header file.
llvm-svn: 104671
2010-05-26 04:56:53 +00:00
Zhongxing Xu eb4fc4a64c Small fix.
llvm-svn: 104669
2010-05-26 03:36:08 +00:00
Zhongxing Xu d4f1294f1e Remove extents of dead symbolic regions when RemoveDeadBindings.
This requires creating new persistent states due to the nature of GDM.

llvm-svn: 104668
2010-05-26 03:27:35 +00:00
Douglas Gregor f64acca2f5 Only enable code patterns (e.g., try { statements } catch (...) {
statements }) in the code-completion results if explicitly requested.

llvm-svn: 104637
2010-05-25 21:41:55 +00:00
Ted Kremenek f5bcc6a285 Allocate the contents of TemplateArgumentList using ASTContext's allocator. This fixes
a massive memory leak when using a BumpPtrAllocator in ASTContext.

Added a FIXME, as the Destroy method for TemplateArgumentList isn't getting called.
This means we will instead leak when using the MallocAllocator.

llvm-svn: 104633
2010-05-25 20:43:29 +00:00
Charles Davis 4e786ddccb IRgen: Add a stub class for generating ABI-specific C++ code.
This class only supports name mangling (which is apparently used during C/ObjC
codegen). For now only the Itanium C++ ABI is supported. Patches to add a
second C++ ABI are forthcoming.

llvm-svn: 104630
2010-05-25 19:52:27 +00:00
Daniel Dunbar 4c77a64391 Driver/Frontend: Add -emit-codegen-only, for running irgen + codegen but not the
.s printer or .o writer.

llvm-svn: 104623
2010-05-25 18:41:01 +00:00
Chris Lattner edde8a99df make -ast-dump print something like this for declstmts:
(DeclStmt 0x3405550 <line:3:4, col:11>
    0x34053a0 "int x")
instead of:
  (DeclStmt 0x3405550 <line:3:4, col:11>
    0x34053a0 "int x"

which has unbalanced parens (PR7228)

llvm-svn: 104620
2010-05-25 17:56:43 +00:00
Fariborz Jahanian 31b8a9d83f Refactoring of block-pointer type rewrite.
llvm-svn: 104614
2010-05-25 17:12:52 +00:00
Douglas Gregor 02df9da2ac Fix compilation failure
llvm-svn: 104613
2010-05-25 17:12:30 +00:00
Douglas Gregor 7e10f3699a Improve name mangling for blocks and support mangling of static local
variables within blocks. We loosely follow GCC's mangling, but since
these are always internal symbols the names don't really matter. I
intend to revisit block mangling later, because GCC's mangling is
rather verbose. <rdar://problem/8015719>.

llvm-svn: 104610
2010-05-25 17:04:15 +00:00
Fariborz Jahanian 19c6240713 Patch to rewrite block pointers as arguments to
methods. (Radar 7987817).

llvm-svn: 104608
2010-05-25 15:56:08 +00:00
Douglas Gregor b9f907bafc Make sure to strip off top-level cv-qualifiers as part of a
derived-to-base conversion on a pointer. Fixes PR7224.

llvm-svn: 104607
2010-05-25 15:31:05 +00:00
Douglas Gregor 6da3db4af3 Improve code completion in failure cases in two ways:
1) Suppress diagnostics as soon as we form the code-completion
  token, so we don't get any error/warning spew from the early
  end-of-file.
  2) If we consume a code-completion token when we weren't expecting
  one, go into a code-completion recovery path that produces the best
  results it can based on the context that the parser is in.

llvm-svn: 104585
2010-05-25 05:58:43 +00:00
Zhongxing Xu 658dd8b176 CastSizeChecker checks when casting a malloc'ed symbolic region to type T,
whether the size of the symbolic region is a multiple of the size of T.
Fixes PR6123 and PR7217.

llvm-svn: 104584
2010-05-25 04:59:19 +00:00
John McCall 7cb0220e53 If a function definition has any sort of weak linkage, its static local
variables should have that linkage.  Otherwise, its static local
variables should have internal linkage.  To avoid computing this excessively,
set a function's linkage before we emit code for it.

Previously we were assigning weak linkage to the static variables of
static inline functions in C++, with predictably terrible results.  This
fixes that and also gives better linkage than 'weak' when merging is required.

llvm-svn: 104581
2010-05-25 04:30:21 +00:00
Daniel Dunbar 532177685a IRgen/C++: When mark vtables used, make sure to still append to the VTableUse array if we promote a vtable from being just used to having its definition required. This ensures that we properly inform the consumer about whether the vtable is required or not, previously we could fail to do so when the vtable was in the VTableUses array before the decl which marked it as required.
- I think this can be cleaned up, since this means we may notify the consumer about the vtable twice, but I didn't see an easy fix for this without more substantial refactoring.
 - Doug, please review!

llvm-svn: 104577
2010-05-25 00:33:13 +00:00
Daniel Dunbar 105ce6db87 Simplify.
llvm-svn: 104576
2010-05-25 00:32:58 +00:00
Chris Lattner fb58515bc3 improve the fixit for the missing : error when parsing ?:. When
there are already two spaces before the token where the : was expected,
put the : in between the spaces.  This means we get it right in both
of these cases:

t.c:2:17: error: expected ':'
  return a ? b  c;
                ^
               :
t.c:3:16: error: expected ':'
  return a ? b c;
               ^
               : 

In the later case, the diagnostic says to insert ": ", in the former
case it says to insert ":" between the spaces.  This fixes rdar://8007231

llvm-svn: 104569
2010-05-24 22:31:37 +00:00
Douglas Gregor 9a414458ff Don't complain about VLAs of non-POD types when the array type is
dependent. Fixes <rdar://problem/8021385>.

llvm-svn: 104550
2010-05-24 20:42:30 +00:00
Douglas Gregor e05d3cb770 A type- or value-dependent expression cannot use bitfield
promotion. Fixes <rdar://problem/8020920>.

llvm-svn: 104545
2010-05-24 20:13:53 +00:00
Chris Lattner 787aef9aed when too many errors are emitted, and we produce:
fatal error: too many errors emitted, stopping now [-ferror-limit=]

Tell the user that this is controlled with -ferror-limit=, like above.

llvm-svn: 104528
2010-05-24 18:37:03 +00:00
Fariborz Jahanian 36680dd751 Fix a rewriting bug where a local static objective-c
pointer is copied into a block. Fixes radar 7924024.

llvm-svn: 104526
2010-05-24 18:32:56 +00:00
Fariborz Jahanian 427ee8b5f3 Fix an objective-c rewriter bug when pre-processed file's
class declaration's @end is not followed by a new-line.
(radar 7946975).

llvm-svn: 104512
2010-05-24 17:22:38 +00:00
Douglas Gregor 5a5073e4d6 Make sure that we instantiate variably modified types, even if they
aren't dependent. Fixes <rdar://problem/8020206>.

llvm-svn: 104511
2010-05-24 17:22:01 +00:00
Douglas Gregor bb3348ed33 Downgrade deletion of a void* from an error (which is should be) to an
extension warning (which other compilers seem to use). Works around a
known bug in Xalan.

llvm-svn: 104509
2010-05-24 17:01:56 +00:00
Douglas Gregor e87561aa2e An identity conversion is better than any non-identity
conversion. Fixes PR7095.

llvm-svn: 104476
2010-05-23 22:10:15 +00:00
Douglas Gregor bea453a0fc In C++, one cannot assign from an arithmetic type to an enumeration
type. Fixes PR7051.

llvm-svn: 104475
2010-05-23 21:53:47 +00:00
Benjamin Kramer dc99965343 Add a comment for r104472.
llvm-svn: 104473
2010-05-23 20:57:46 +00:00
Benjamin Kramer 11d4d9ec4e PR5863: Don't erase unreachable BBs which have an associated cleanup size.
This works around a crash where malloc reused the memory of an erased BB for a
new BB leaving old cleanup information pointing at the new block.

llvm-svn: 104472
2010-05-23 20:00:44 +00:00
Douglas Gregor a09387df9f It turns out that people love using VLAs in templates, too. Weaken our
VLA restrictions so that one can use VLAs in templates (even
accidentally), but not as part of a non-type template parameter (which
would be very bad).

llvm-svn: 104471
2010-05-23 19:57:01 +00:00
Douglas Gregor 2788782164 Complain about sizeof(overloaded function) rather than crashing.
llvm-svn: 104470
2010-05-23 19:43:23 +00:00
Douglas Gregor c69978f766 Move OverloadExpr over to a ASTContext-allocated pointer for its
storage, rather than an UnresolvedSet. 

llvm-svn: 104469
2010-05-23 19:36:40 +00:00
Douglas Gregor 30a4f4c757 Provide the overloaded functions for UnresolvedLookupExpr and
UnresolvedMemberExpr in their constructors, rather than adding them
after the fact. No functionality change.

llvm-svn: 104468
2010-05-23 18:57:34 +00:00
Douglas Gregor 1a80933d24 Keep track of all of the class and function template's "common"
pointers in the ASTContext, so that the folding sets stored inside
them will be deallocated when the ASTContext is destroyed (under
-disable-free). <rdar://problem/7998824>.

llvm-svn: 104465
2010-05-23 18:26:36 +00:00
Anders Carlsson 5773205a8d When recording empty subobjects we should always look at the primary virtual base.
llvm-svn: 104464
2010-05-23 18:14:24 +00:00
Douglas Gregor 5e8c8c0e12 Even though we don't unique VLA types, we still need to build a
canonical type where the element type is canonical. Fixes PR7206.

llvm-svn: 104461
2010-05-23 16:10:32 +00:00
John McCall cc04e9f6b9 Re-teach IR gen to perform GC moves on rvalues resulting from various ObjC
expressions.  Essentially, GC breaks a certain form of the return-value
optimization.

llvm-svn: 104454
2010-05-22 22:13:32 +00:00
Anders Carlsson 5b94443b16 Really fix PR7139. There was one boost test that we still failed, and my first fix broke self-host.
llvm-svn: 104447
2010-05-22 17:45:10 +00:00
Anders Carlsson c0964b60e5 Re-land the fix for PR7139.
llvm-svn: 104446
2010-05-22 17:35:42 +00:00
Douglas Gregor 024d80e571 Don't look for a destructor in a dependent type. Fixes PR7198.
llvm-svn: 104445
2010-05-22 17:12:29 +00:00
Douglas Gregor 0c6f539564 When determining whether we can use "this", make sure to look through
enum contexts (along with block contexts, which we already did). Fixes
PR7196.

llvm-svn: 104444
2010-05-22 16:25:05 +00:00
Douglas Gregor 959d5a0cbd Implement support for variable length arrays in C++. VLAs are limited
in several important ways:

  - VLAs of non-POD types are not permitted.
  - VLAs cannot be used in conjunction with C++ templates.

These restrictions are intended to keep VLAs out of the parts of the
C++ type system where they cause the most trouble. Fixes PR5678 and
<rdar://problem/8013618>.

llvm-svn: 104443
2010-05-22 16:17:30 +00:00
Douglas Gregor aae38d6610 Improve our handling of reference binding for subobjects of
temporaries. There are actually several interrelated fixes here:

  - When converting an object to a base class, it's only an lvalue
  cast when the original object was an lvalue and we aren't casting
  pointer-to-derived to pointer-to-base. Previously, we were
  misclassifying derived-to-base casts of class rvalues as lvalues,
  causing various oddities (including problems with reference binding
  not extending the lifetimes of some temporaries).

  - Teach the code for emitting a reference binding how to look
  through no-op casts and parentheses directly, since
  Expr::IgnoreParenNoOpCasts is just plain wrong for this. Also, make
  sure that we properly look through multiple levels of indirection
  from the temporary object, but destroy the actual temporary object;
  this fixes the reference-binding issue mentioned above.

  - Teach Objective-C message sends to bind the result as a temporary
    when needed. This is actually John's change, but it triggered the
    reference-binding problem above, so it's included here. Now John
    can actually test his return-slot improvements.

llvm-svn: 104434
2010-05-22 05:17:18 +00:00
Daniel Dunbar bd3b1d40da Attempt to make MSVC happy.
llvm-svn: 104432
2010-05-22 05:05:12 +00:00
Chandler Carruth e039148801 Daniel re-educated me about what Alias does and does not do. Turn that off for
'-fasm' and explicitly map from that flag to -fgnu-keywords in the driver. Turn
off the driver in the lexer test for this madness and add a test to the driver
that the translation actually works.

llvm-svn: 104428
2010-05-22 02:21:53 +00:00
John McCall 78a151138a Push a return-value slot throughout ObjC message-send codegen. Will be
critical for ObjC++ correctness;  hard to test independently of various
required Sema changes, though.

llvm-svn: 104422
2010-05-22 01:48:05 +00:00
Daniel Dunbar 07494795e5 Driver: When printing a "command was signalled" type of diagnostic, use the
short name of the tool in use, instead of the name of the action that created
the command. The practical impact is we now get:
  clang: error: clang frontend command failed due to signal 6 (use -v to see invocation)
instead of:
  clang: error: assembler command failed due to signal 6 (use -v to see invocation)
when clang crashes on a job that uses the integrated assembler.

llvm-svn: 104417
2010-05-22 00:37:20 +00:00
Daniel Dunbar 1cb532ca28 Driver: Add Tool::ShortName, intended to be a human readable name for the tool.
llvm-svn: 104416
2010-05-22 00:37:18 +00:00
Douglas Gregor 20c38a7c58 Improve recovery when we see a dependent template name that is missing
the required "template" keyword, using the same heuristics we do for
dependent template names in member access expressions, e.g.,

test/SemaTemplate/dependent-template-recover.cpp:11:8: error: use 'template'
      keyword to treat 'getAs' as a dependent template name
    T::getAs<U>();
       ^
       template 

Fixes PR5404.

llvm-svn: 104409
2010-05-21 23:43:39 +00:00
Fariborz Jahanian 5981b04718 Clang missing warning about conflicting declaration vs. definition
for variable arguments list methods. (radar 8006060).

llvm-svn: 104407
2010-05-21 23:28:58 +00:00
Douglas Gregor 786123dc48 Improve parser recovery when we encounter a dependent template name
that is missing the 'template' keyword, e.g., 

  t->getAs<T>()

where getAs is a member of an unknown specialization. C++ requires
that we treat "getAs" as a value, but that would fail to parse since T
is the name of a type. We would then fail at the '>', since a type
cannot be followed by a '>'.

This is a very common error for C++ programmers to make, especially
since GCC occasionally allows it when it shouldn't (as does Visual
C++). So, when we are in this case, we use tentative parsing to see if
the tokens starting at "<" can only be parsed as a template argument
list. If so, we produce a diagnostic with a fix-it that states that
the 'template' keyword is needed:

test/SemaTemplate/dependent-template-recover.cpp:5:8: error: 'template' keyword
      is required to treat 'getAs' as a dependent template name
    t->getAs<T>();
       ^
       template 

This is just a start of this patch; I'd like to apply the same
approach to everywhere that a template-id with dependent template name
can be parsed.

llvm-svn: 104406
2010-05-21 23:18:07 +00:00
Anders Carlsson c866eb5ba9 Unbreak self-host.
llvm-svn: 104390
2010-05-21 22:17:48 +00:00
Ted Kremenek a2448b85be Update retain-release checker to understand changes to how 'super' is represented
in the ASTs.  Fixes <rdar://problem/8015556>.

llvm-svn: 104389
2010-05-21 21:57:00 +00:00
Ted Kremenek 5f03be9704 Pass around an error SourceRange instead of an Expr* when reporting errors
in the Objective-C memory checker.

llvm-svn: 104388
2010-05-21 21:56:53 +00:00
Anders Carlsson da1641cd12 Rename CodeGenFunction::EmitMemSetToZero to EmitNullInitialization. Handle setting null data member pointers correctly. Fixes PR7139.
llvm-svn: 104387
2010-05-21 21:45:41 +00:00
Douglas Gregor 9f44d1453b When instantiating a function declaration within a function template,
be sure to merge its parameter scope with its parent's scope. Fixes
PR7184.

llvm-svn: 104386
2010-05-21 21:25:08 +00:00
Abramo Bagnara f7eba5091c Improved TypeLoc::getSourceRange().
llvm-svn: 104382
2010-05-21 21:12:12 +00:00
John McCall b54367d2f8 Propagate access specifiers to anonymous union members nested within classes.
Fixes <rdar://problem/7987650>.

llvm-svn: 104376
2010-05-21 20:45:30 +00:00
Ted Kremenek 304a9537e1 Fix crash in CFG construction for 'break' statements appearing in statement expressions
within the increment code of a for loop.

llvm-svn: 104375
2010-05-21 20:30:15 +00:00
Douglas Gregor 27ac429624 Use CanQualType to enforce the use of a canonical type argument to
CXXBasePaths::isAmbiguous(), rather than just asserting that we have a
canonical type. Fixes PR7176.

llvm-svn: 104374
2010-05-21 20:29:55 +00:00
Chris Lattner c425fe4c80 don't make _Bool be a keyword in -fms-extensions mode, patch by
Steven Watanabe!

llvm-svn: 104373
2010-05-21 20:22:37 +00:00
Benjamin Kramer 71b0bb9922 Try to fix MSVC build.
llvm-svn: 104371
2010-05-21 19:58:44 +00:00
Douglas Gregor 3fe900e410 Don't remove the break/continue scope of a for loop until after we've
emitted the increment expression. Fixes PR7189.

If someone knows how to write a useful test for this, I'd be grateful. 

llvm-svn: 104335
2010-05-21 18:36:48 +00:00
Douglas Gregor c5871f07f0 When generating the call arguments in a thunk to call the thunkee, do
not make copies non-POD arguments or arguments passed by reference:
just copy the pointers directly. This eliminates another source of the
dreaded memcpy-of-non-PODs. Fixes PR7188.

llvm-svn: 104327
2010-05-21 17:55:12 +00:00
Chandler Carruth 7ea01c3f8a Add braces to avoid an ambiguous else, fixing a GCC warning.
llvm-svn: 104314
2010-05-21 10:29:28 +00:00
John McCall 9d42f0f174 Allocate space in a block record for implicit references to the Objective C
'self' variable arising from uses of the 'super' keyword.  Also reorganize
some code so that BlockInfo (now CGBlockInfo) can be opaque outside of
CGBlocks.cpp.

Fixes rdar://problem/8010633.

llvm-svn: 104312
2010-05-21 04:11:14 +00:00
John McCall c4094935c0 When emitting an lvalue for an anonymous struct or union member during
class initialization, drill down through an arbitrary number of anonymous
records.

llvm-svn: 104310
2010-05-21 01:18:57 +00:00
John McCall 61925b03cc Introduce a method to get from an anonymous struct or union record declaration
to the associated object declaration.

llvm-svn: 104309
2010-05-21 01:17:40 +00:00
Douglas Gregor 04163186a7 When instantiating anonymous structs/unions within a function, make
sure that the anonymous struct/union record declaration gets
instantiated before the variable declaration, and that it and its
fields (recursively) get entries in the local instantiation map. Fixes
PR7088.

llvm-svn: 104305
2010-05-21 00:31:19 +00:00
Douglas Gregor aabdfcb29e Fix a crasher in constructor-initializer reordering warnings (PR7179).
llvm-svn: 104299
2010-05-20 23:49:34 +00:00
Fariborz Jahanian 2792f30f13 Generate objc_memmove_collectable write-barrier for
classes whose base class have GC'able object pointers.

llvm-svn: 104296
2010-05-20 23:34:56 +00:00
John McCall bc83b3f011 Be sure to apply initializers to members of anonymous structs and unions
recursively, e.g. so that members of anonymous unions inside anonymous structs
still get initialized.  Also generate default constructor calls for anonymous
struct members when necessary.

llvm-svn: 104292
2010-05-20 23:23:51 +00:00
Douglas Gregor 4abc32d033 Improve parser recovery when a switch condition is invalid; fixes
<rdar://problem/7971948>.

llvm-svn: 104291
2010-05-20 23:20:59 +00:00
Douglas Gregor 3f4f03a235 Add a new failure kind, FK_Incomplete, to InitializationSequence, to
capture failures when we try to initialize an incomplete
type. Previously, we would (ab)use FK_ConversionFailed, then
occasionally dereference a null pointer when trying to diagnose the
failure. Fixes <rdar://problem/7959007>.

llvm-svn: 104286
2010-05-20 22:12:02 +00:00
Daniel Dunbar 6232d347bc Driver: Switch to using the integrated assembler for standalone assembly jobs
(or -save-temps), when the integrated assembler is enabled.

llvm-svn: 104282
2010-05-20 21:48:38 +00:00
Fariborz Jahanian 60d215b6fd Adds support for generation of objc_memmove_collectable API
in Objective-C++ mode.

llvm-svn: 104281
2010-05-20 21:38:57 +00:00
Daniel Dunbar 4f5e79c67d Driver: Add a tool definition for the Clang integrated assembler.
llvm-svn: 104280
2010-05-20 21:30:13 +00:00
Douglas Gregor 3e51e173b6 Reinstate r104117, Chandler Carruth's change that "[provides] a naming
class for UnresolvedLookupExprs, even when occuring on template
names" along with a fix for an Objective-C++ crasher it introduced.

llvm-svn: 104277
2010-05-20 20:58:56 +00:00
Daniel Dunbar 2fcaa549a8 Driver/MC: Add 'clang -cc1as' integrated assembler tool, currently accepts approximately the same interface as 'llvm-mc'.
llvm-svn: 104239
2010-05-20 17:49:16 +00:00
Daniel Dunbar 3730048129 Driver: Move some argument lookup utilities into driver::ArgList.
llvm-svn: 104237
2010-05-20 16:54:55 +00:00
Fariborz Jahanian 6855ba2c95 Copy construction of non-trivial properties must not
be turned into a setter call (fixes radar 8008649).

llvm-svn: 104235
2010-05-20 16:46:55 +00:00
Douglas Gregor 265b8b8de0 Picky, picky
llvm-svn: 104230
2010-05-20 15:48:29 +00:00
Douglas Gregor c19108118d Fix a thinko
llvm-svn: 104229
2010-05-20 15:47:46 +00:00
Douglas Gregor f22101a059 Assert that we do not try to memcpy a non-POD class type in C++. This
particular issue was the cause of the Boost.Interprocess failures, and
in general will lead to horrendous, hard-to-diagnose miscompiles. The
assertion itself has survives self-host and a full Boost build, so we
are close to eradicating this problem in C++.

Note that the assertion is *not* turned on for Objective-C++, where we
still have problems with introducing memcpy's of non-POD class
types. That part of the assertion will go away as soon as we fix the
known issues in Objective-C++.

llvm-svn: 104227
2010-05-20 15:39:01 +00:00
Abramo Bagnara 02ccd28a92 Added TemplateArgumentListInfo to FunctionTemplateSpecializationInfo.
llvm-svn: 104226
2010-05-20 15:32:11 +00:00
David Chisnall 29cefd1cc3 Fix my inability to spell 'continue' and a case where message sends returning non-pointer-sized things were generating invalid IR inside @try blocks.
llvm-svn: 104222
2010-05-20 13:45:48 +00:00
Abramo Bagnara 1108e7b873 Renamed misleading getSourceRange -> getLocalSourceRange and getFullSourceRange -> getSourceRange for TypeLoc.
llvm-svn: 104220
2010-05-20 10:00:11 +00:00
Douglas Gregor 7c38f153ac Rework our handling of binding a reference to a temporary
subobject. Previously, we could only properly bind to a base class
subobject while extending the lifetime of the complete object (of a
derived type); for non-static data member subobjects, we could memcpy
(!) the result and bind to that, which is rather broken.

Now, we pull apart the expression that we're binding to, to figure out
which subobject we're accessing, then construct the temporary object
(adding a destruction if needed) and, finally, dig out the subobject
we actually meant to access.

This fixes yet another instance where we were memcpy'ing rather than
doing the right thing. However, note the FIXME in references.cpp:
there's more work to be done for binding to subobjects, since the AST
is incorrectly modeling some member accesses in base classes as
lvalues when they are really rvalues.

llvm-svn: 104219
2010-05-20 08:36:28 +00:00
John McCall 58efb8e2bb Whoops.
llvm-svn: 104218
2010-05-20 07:13:26 +00:00
John McCall deb5e728ae Don't try to check jump scopes in invalid functions. Fixes
<rdar://problem/7995494>.

llvm-svn: 104217
2010-05-20 07:05:55 +00:00
Douglas Gregor aa2ac80eaa When creating a this-adjustment thunk where the return value is of C++
class type (that uses a return slot), pass the return slot to the
callee directly rather than allocating new storage and trying to copy
the object. This appears to have been the cause of the remaining two
Boost.Interprocess failures.

llvm-svn: 104215
2010-05-20 05:54:35 +00:00
Douglas Gregor fe60c14263 Remove accidental commit
llvm-svn: 104207
2010-05-20 02:26:51 +00:00
Douglas Gregor 527786ea3a Various small fixes for construction/destruction of Objective-C++
instance variables:
  - Use isRecordType() rather than isa<RecordType>(), so that we see
  through typedefs in ivar types.
  - Mark the destructor as referenced
  - Perform C++ access control on the destructor

llvm-svn: 104206
2010-05-20 02:24:22 +00:00
Ted Kremenek bd7b3ccbf8 Expose -fobjc-nonfragile-abi2 as a top-level clang driver option. Fixes <rdar://problem/8007063>.
llvm-svn: 104205
2010-05-20 02:12:37 +00:00
John McCall 87fe5d5618 Support implicitly closing on 'this' in a block. Fixed PR7165.
(the codegen works here, too, but that's annoying to test without execution)

llvm-svn: 104202
2010-05-20 01:18:31 +00:00
Chris Lattner 8ca2fd2e93 just add a fixme for the StructuredArgs leak, it shouldn't affect
c++'03 code and variadic support "needs work".

llvm-svn: 104195
2010-05-20 00:26:28 +00:00
Chris Lattner 047f5aa007 switch TemplateArgumentListBuilder to hold its flat argument list in a smallvector
instead of new[]'d.  This greatly reduces the number of new[]'s, and guess what, 
they were all leaked.

This adds a fixme in this hunk:

   unsigned NumPackArgs = NumFlatArgs - PackBeginIndex;
+  // FIXME: NumPackArgs shouldn't be negative here???
   if (NumPackArgs)
-    PackArgs = &FlatArgs[PackBeginIndex];
+    PackArgs = FlatArgs.data()+PackBeginIndex;

where test/SemaTemplate/variadic-class-template-2.cpp is accessing the vector
out of range and NumPackArgs is negative.  I assume variadic template args are
completely hosed.

llvm-svn: 104194
2010-05-20 00:25:36 +00:00
Chris Lattner ce7a22d97c fix the TemplateArgumentList copy constructor to not
be a copy constructor (since it isn't one semantically)
and fix the ownership bits it sets to be correct!

llvm-svn: 104192
2010-05-20 00:19:09 +00:00
Chris Lattner c9b03bcc5d Clarify TemplateArgumentList ownership over its "flat" and
"structure" arg lists, the first step to fixing some massive
memory leaks.

llvm-svn: 104191
2010-05-20 00:11:47 +00:00
Jim Grosbach db061516be tweak to (hopefully) fix darwin[89] buildbots. Thanks to Doug for the suggested modification.
llvm-svn: 104188
2010-05-19 23:53:08 +00:00
Douglas Gregor fa6010b6e4 When a conditional operator is an rvalue of class type, we need to
create a temporary copy of both the "true" and "false" results. Fixes
the Boost.Interprocess failures.

Daniel did all the hard work of tracking down the issue, I get to type
up the trivial fix for this horrible miscompile.

llvm-svn: 104184
2010-05-19 23:40:50 +00:00
Abramo Bagnara d754848f10 Added basic source locations to Elaborated and DependentName types.
llvm-svn: 104169
2010-05-19 21:37:53 +00:00
Fariborz Jahanian f633ebd961 Adds support for ObjC++'s GC attribute on declaration of
object variables and functions returning such objects.

llvm-svn: 104168
2010-05-19 21:37:30 +00:00
Daniel Dunbar fd5ed84873 Revert r104117, "Provide a naming class for UnresolvedLookupExprs, even when
occuring on..." which breaks some Objective-C code. Working on getting a test
case...

llvm-svn: 104150
2010-05-19 21:07:14 +00:00
Douglas Gregor 0e0f67ec95 Fill in some silly defaults to silence a GCC warning
llvm-svn: 104140
2010-05-19 18:41:43 +00:00
Douglas Gregor a72a4e3229 Cache the linkage of a type within its canonical type, eliminating
some seriously non-linear performance with deeply nested template
instantiations, as shown in PR6998.

llvm-svn: 104139
2010-05-19 18:39:18 +00:00
Ted Kremenek 26bde774df Add clang support for IBOutletCollection.
llvm-svn: 104135
2010-05-19 17:38:06 +00:00
Douglas Gregor 6044d691bb Revert r104106; it's breaking linking of Boost.Serialization.
llvm-svn: 104121
2010-05-19 17:02:24 +00:00
Benjamin Kramer fdb61d78e9 Implement codegen for __builtin_isnormal.
llvm-svn: 104118
2010-05-19 11:24:26 +00:00
Chandler Carruth 8fd2b8935e Provide a naming class for UnresolvedLookupExprs, even when occuring on
template names. We were completely missing naming classes for many unqualified
lookups, but this didn't trigger code paths that need it. This removes part of
an optimization that re-uses the template name lookup done by the parser to
determine if explicit template arguments actually form a template-id.
Unfortunately the technique for avoiding the duplicate lookup lost needed data
such as the class context in which the lookup succeeded.

llvm-svn: 104117
2010-05-19 09:39:06 +00:00
Douglas Gregor e9ceb31405 Profile type-dependent uses of overloaded operators in C++ the same
way regardless of whether some overloaded operator functions were
found by name lookup within the template. Fixes PR6851.

llvm-svn: 104107
2010-05-19 04:13:23 +00:00
Douglas Gregor 21553f5970 Teach clang to instantiate attributes on more declarations. Fixes PR7102.
llvm-svn: 104106
2010-05-19 03:39:53 +00:00
Douglas Gregor cbfbca14d0 Implement C++ builtin operator candidates for vector types.
llvm-svn: 104105
2010-05-19 03:21:00 +00:00
Chandler Carruth 425cec3e33 Fix a GCC warning about inline functions not being defined. Until r104081, only
the same .cpp file as provided the definitions referenced these functions,
hiding the issue. However, they are clearly no longer inline. Let me know if
there is a reason to move their definitions to the header and make them truly
inline.

llvm-svn: 104104
2010-05-19 02:12:56 +00:00
Chandler Carruth eba788efa6 Fix an obvious goof that rjmccall found by inspection. No testcase, suggestions
welcome for one.

llvm-svn: 104101
2010-05-19 01:37:01 +00:00
Fariborz Jahanian 9f963c2488 Misc. fixes to bring Objetive-C++'s handling of
gc attributes to be inline with Objective-C
(for radar 7925141).

llvm-svn: 104084
2010-05-18 23:04:17 +00:00
Douglas Gregor bdb604a806 Protect isIntegerConstantExpr from seeing type- or value-dependent
expressions in attributes, pragmas.

llvm-svn: 104083
2010-05-18 23:01:22 +00:00
Douglas Gregor 4618868a7d Implement C++ support for vector and extended vector types. This
involves extending implicit conversion sequences to model vector
conversions and vector splats, along with teaching the C++ conditional
operator-checking code about vector types.

Fixes <rdar://problem/7983501>.

llvm-svn: 104081
2010-05-18 22:42:18 +00:00
Ted Kremenek 49be9e0819 Teach CursorVisitor about duplicate ObjCPropertyDecls that can arise because of a current
design limitation in how we handle Objective-C class extensions.  This was causing the CursorVisitor
to essentially visit an @property twice (once in the @interface, the other in the class extension).
Fixes <rdar://problem/7410145>.

llvm-svn: 104055
2010-05-18 21:09:07 +00:00
Douglas Gregor a941dcae16 Add support for Microsoft's __thiscall, from Steven Watanabe!
llvm-svn: 104026
2010-05-18 16:57:00 +00:00
Anders Carlsson be48c548c5 Correctly initialize bases with member pointers. This should fix PR6441 but that test case is a bit weird and I'd like to investigate further before closing that bug.
llvm-svn: 104025
2010-05-18 16:51:41 +00:00
Douglas Gregor 86ad085b40 Give a slight edge to the context-sensitive keyword 'super' over
non-function-local declarations with names similar to what the user
typed. For example, this allows us to correct 'supper' to 'super' in
an Objective-C message send, even though the C function 'isupper' has
the same edit distance.

llvm-svn: 104023
2010-05-18 16:30:22 +00:00
Douglas Gregor 5fd04d4832 Tweak typo-correction logic a bit regarding "super", so that we
consider "super" as a candidate whenever we're parsing an expression
within an Objective-C method in an interface that has a superclass. At
some point, we'd like to give "super" a little edge over non-local
names; that will come later.

llvm-svn: 104022
2010-05-18 16:14:23 +00:00
John McCall 0e704f7fcd Permit Objective C object pointers to be const_casted.
llvm-svn: 104019
2010-05-18 09:35:29 +00:00
Alexis Hunt abb2ac8889 Switch over the tablegen to use much prettier range technology
Also rename ABSTRACT to ABSTRACT_STMT, in keeping with the other .def
files

llvm-svn: 104017
2010-05-18 06:22:21 +00:00
Douglas Gregor 923d2252dc "The attached patch allows clang to find the headers
for Visual Studio 2010.  It also adds a registry search
for the Express edition,", from Steven Watanabe!

llvm-svn: 104015
2010-05-18 05:47:04 +00:00
Douglas Gregor b92ea59481 I hate this commit.
Revert much of the implementation of C++98/03 [temp.friend]p5 in
r103943 and its follow-ons r103948 and r103952. While our
implementation was technically correct, other compilers don't seem to
implement this paragraph (which forces the instantiation of friend
functions defined in a class template when a class template
specialization is instantiated), and doing so broke a bunch of Boost
libraries. 

Since this behavior has changed in C++0x (which instantiates the
friend function definitions when they are used), we're going to skip
the nowhere-implemented C++98/03 semantics and go straight to the
C++0x semantics.

This commit is a band-aid to get Boost up and running again. It
doesn't really fix PR6952 (which this commit un-fixes), but it does
deal with the way Boost.Units abuses this particular paragraph.

llvm-svn: 104014
2010-05-18 05:45:02 +00:00
Anders Carlsson 061ca524b7 Keep track of the LLVM field numbers for non-virtual bases.
llvm-svn: 104013
2010-05-18 05:22:06 +00:00
Anders Carlsson af9e5afe54 Start laying out bases as individual fields. We still use ugly i8 arrays but this is a step in the right direction.
llvm-svn: 104012
2010-05-18 05:12:20 +00:00
Anders Carlsson 864d1b555e Add CodeGenTypes::ContainsPointerToDataMember overload that takes a CXXRecordDecl.
llvm-svn: 104011
2010-05-18 03:47:15 +00:00
John McCall d3dfbd6f4f If a switch condition is constant, don't warn about missing enum cases.
If a switch condition is constant, warn if there's no case for it.

Constant switch conditions do come up in reasonable template code.

llvm-svn: 104010
2010-05-18 03:19:21 +00:00
Zhongxing Xu b013b0bc04 Add option '-analyzer-max-loop', which specifies the maximum
number of times the analyzer will go through a loop.

llvm-svn: 104007
2010-05-18 00:28:37 +00:00
John McCall a9e6e8d654 Teach the ObjC mangler to ignore member pointers just like gcc does.
llvm-svn: 104001
2010-05-17 23:56:34 +00:00
Chandler Carruth 3b43338870 Add a hack to silence warnings about failing to return from functions after
a temporary with a noreturn destructor has been created. Fixes PR6884 for now.

llvm-svn: 104000
2010-05-17 23:51:52 +00:00
Douglas Gregor 96cdb1590e Instantiate attributes on typedefs. This is a quick fix for PR7148,
when we really need a proper audit of our handling of attributes in
templates.

llvm-svn: 103999
2010-05-17 23:46:49 +00:00
John McCall 1b84d1106e Comments and assorted cleanups for the Objective C type AST.
llvm-svn: 103986
2010-05-17 23:00:45 +00:00
John McCall 96fa4845f7 Clean up some more uses of getAs<ObjCInterfaceType>() that Fariborz pointed
out.  The remaining ones are okay.

llvm-svn: 103973
2010-05-17 21:00:27 +00:00
Chandler Carruth 0450cc684c Fix an ambiguous else warning from GCC by adding some much needed curlies.
llvm-svn: 103972
2010-05-17 20:58:49 +00:00
Chris Lattner 467f6bcfe5 robustify the conflict marker stuff. Don't add 7 twice, which would
make it miss (invalid) things like:
<<<<<<<
>>>>>>>

and crash if 

<<<<<<< 

was at the end of the line.  When we find a >>>>>>> that is not at the
end of the line, make sure to reset Pos so we don't crash on something
like:
<<<<<<< >>>>>>>

This isn't worth making testcases for, since each would require a new file.

rdar://7987078 - signal 11 compiling "<<<<<<<<<<"

llvm-svn: 103968
2010-05-17 20:27:25 +00:00
John McCall 3e294929b8 Correctly generate IR for ObjC messages sends to protocol-qualified types.
Fixes rdar://problem/7992749

llvm-svn: 103965
2010-05-17 20:12:43 +00:00
Douglas Gregor 3b05bdba5a Teach ASTContext::getUnqualifiedArrayType() how to look through
typedefs. As a drive-by, teach hit how to build VLA types, since those
will eventually be supported in C++.

llvm-svn: 103958
2010-05-17 18:45:21 +00:00
Douglas Gregor c9a99c5e5c mutable is a storage class that can follow a class/struct/union definition. Fixes PR7153
llvm-svn: 103954
2010-05-17 18:19:56 +00:00
Fariborz Jahanian 16f94c6e8f Don't attempt to poke into an invalid field's class type
to mark its destructors as referenced which may cause 
a crash. Fixes radar 7896920

llvm-svn: 103953
2010-05-17 18:15:18 +00:00
Douglas Gregor fd7224fee0 Diagnose a redefinition error when there are two instantiations of friend
functions defined inside a class template. Fixes PR6952, the last
Boost.Units failure.

llvm-svn: 103952
2010-05-17 17:57:54 +00:00
Douglas Gregor 69f6a365d3 Determine when the instantiation of a friend function defined inside a
class template conflicts with an existing (non-template)
definition. This is another part of PR6952.

llvm-svn: 103948
2010-05-17 17:34:56 +00:00
Daniel Dunbar f7a8825484 IRgen: Remove dead function.
llvm-svn: 103945
2010-05-17 16:46:02 +00:00
Daniel Dunbar cd20ce1513 C++/Darwin/i386 ABI: Fix some problems with empty record handling.
- Check bases as part of isEmptyRecord().

 - C++ record fields are never empty in the Itanium ABI.

llvm-svn: 103944
2010-05-17 16:46:00 +00:00
Douglas Gregor 1cd6ea0b24 C++98/03 [temp.friend]p4 requires that inline function definitions
within class templates be instantiated along with each class template
specialization, even if the functions are not used. Do so, as a baby
step toward PR6952.

llvm-svn: 103943
2010-05-17 16:38:00 +00:00
Douglas Gregor 9154b5dffe Ensure that destructors are called for NRVO'd objects when the
function does not return. Thanks to Eli for pointing out this corner
case.

llvm-svn: 103941
2010-05-17 15:52:46 +00:00
David Chisnall f9c4225af6 Pick the correct personality function based on the language. This prevents link failures when C/ObjC code uses __attribute__((cleanup())) (previously this was inserting references to two libstc++ symbols; the personality function and the __terminate() function).
This is still probably wrong for Objective-C++ and adds a couple of lines in CGException that should probably be in the CGObjCRuntime subclass.  The personality function is now only looked up in one place in CGException though, so this should be easier to fix in the future.

llvm-svn: 103938
2010-05-17 13:49:20 +00:00
Eli Friedman b41ad0fbea PR7117: Make sure we don't lose the calling convention for K&R-style
definitions.
 

llvm-svn: 103932
2010-05-17 02:50:18 +00:00
Chris Lattner 561aabd943 when code completing inside a C-style block comment, don't emit errors about
a missing */ since we truncated the file.

This fixes rdar://7948776

llvm-svn: 103913
2010-05-16 19:54:05 +00:00
mike-m c6da261fb4 Moved clang-builtin include dir position to immediately precede C includes.
This aligns with how gcc compiler does things.

llvm-svn: 103912
2010-05-16 19:03:52 +00:00
Anders Carlsson e6ae81b0a2 Correctly diagnose array 'new' with initialization arguments when the new type is a typedef to an array type.
llvm-svn: 103909
2010-05-16 16:24:20 +00:00
Douglas Gregor cda95f47e5 When the type-id or new-type-id of a C++ "new" expression is a typedef
of an array type, use the outermost array bound as the number of
elements to allocate. Fixes PR7147.

llvm-svn: 103908
2010-05-16 16:01:03 +00:00
John McCall 5c6ec8c797 Don't emit any fallthrough / missing-noreturn warnings if we can't
compute a CFG for a function.

llvm-svn: 103905
2010-05-16 09:34:11 +00:00
Chandler Carruth e299ba66f5 When constant folding reference variables with an initializer to the
initializer, don't fold paramters. Their initializers are just default
arguments which can be overridden. This fixes some spectacular regressions due
to more things making it into the constant folding.

llvm-svn: 103904
2010-05-16 09:32:51 +00:00
Chris Lattner bb53efb016 fix rdar://7985267 - Don't emit an error about a non-pod argument
passed to va_start, it doesn't actually pass it.

llvm-svn: 103899
2010-05-16 04:01:30 +00:00
John McCall 94f619ac2b Emit a type record for TYPE_OBJC_OBJECT in the PCH file. I'm not
entirely sure what this does, to be honest.

llvm-svn: 103895
2010-05-16 02:12:35 +00:00
John McCall 3f435e6693 Avoid doing two switches in TypeLoc's initialize() loop. The optimizer
can probably do this for us, but it's actually somewhat nicer to write it
out here.

llvm-svn: 103893
2010-05-16 02:09:32 +00:00
Douglas Gregor 51150ab1f1 When initializing thread-safe statics, put the call to
__cxa_guard_abort along the exceptional edge into (in effect) a nested
"try" that rethrows after aborting. Fixes PR7144 and the remaining
Boost.ProgramOptions failures, along with the regressions that r103880
caused.

The crucial difference between this and r103880 is that we now follow
LLVM's little dance with the llvm.eh.exception and llvm.eh.selector
calls, then use _Unwind_Resume_or_Rethrow to rethrow.

llvm-svn: 103892
2010-05-16 01:24:12 +00:00
Douglas Gregor c278d1b3b9 Revert r103880 (thread-safe static initialization w/ exceptions),
because it's causing strange linker errors. Unfixes PR7144.

llvm-svn: 103890
2010-05-16 00:44:00 +00:00
Fariborz Jahanian 1b8b8bf25f Minor twik to my last patch. (for radar 7986354).
llvm-svn: 103889
2010-05-16 00:10:46 +00:00
Fariborz Jahanian e1b45a5e6b Fix API gen for objc_msgSend property of aggregate types
in Objective-c++ mode. Fixes radar 7986354.

llvm-svn: 103887
2010-05-15 23:05:52 +00:00
Douglas Gregor 58142dd8a1 When initializing thread-safe statics, put the call to
__cxa_guard_abort along the exceptional edge into (in effect) a nested
"try" that rethrows after aborting. Fixes PR7144 and the remaining
Boost.ProgramOptions failures.

llvm-svn: 103880
2010-05-15 17:55:51 +00:00
John McCall b0efad148c Modify this comment per Doug's suggestion: we don't need to mangle protocols.
llvm-svn: 103875
2010-05-15 17:06:29 +00:00
Chris Lattner 8b3b145342 fix _mm_shuffle_pd too, thanks to Joel Falcou for pointing this out.
llvm-svn: 103873
2010-05-15 16:54:46 +00:00
Douglas Gregor 170125648c When applying the named return value optimization, we still need to
destroy the variable along the exceptional edge; it's only during
normal execution that we avoid destroying this variable.

llvm-svn: 103872
2010-05-15 16:39:56 +00:00
John McCall 8b07ec253d Substantially alter the design of the Objective C type AST by introducing
ObjCObjectType, which is basically just a pair of
  one of {primitive-id, primitive-Class, user-defined @class}
with
  a list of protocols.
An ObjCObjectPointerType is therefore just a pointer which always points to
one of these types (possibly sugared).  ObjCInterfaceType is now just a kind
of ObjCObjectType which happens to not carry any protocols.

Alter a rather large number of use sites to use ObjCObjectType instead of
ObjCInterfaceType.  Store an ObjCInterfaceType as a pointer on the decl rather
than hashing them in a FoldingSet.  Remove some number of methods that are no
longer used, at least after this patch.

By simplifying ObjCObjectPointerType, we are now able to easily remove and apply
pointers to Objective-C types, which is crucial for a certain kind of ObjC++
metaprogramming common in WebKit.

llvm-svn: 103870
2010-05-15 11:32:37 +00:00
Douglas Gregor 290c93ec0d Implement a simple form of the C++ named return value optimization for
return statements. We perform NRVO only when all of the return
statements in the function return the same variable. Fixes some link
failures in Boost.Interprocess (which is relying on NRVO), and
probably improves performance for some C++ applications.

llvm-svn: 103867
2010-05-15 06:46:45 +00:00
Douglas Gregor 6fd1b1802f Implement semantic analysis and an AST representation for the named
return value optimization. Sema marks return statements with their
NRVO candidates (which may or may not end up using the NRVO), then, at
the end of a function body, computes and marks those variables that
can be allocated into the return slot.

I've checked this locally with some debugging statements (not
committed), but there won't be any tests until CodeGen comes along.

llvm-svn: 103865
2010-05-15 06:01:05 +00:00
Chris Lattner 6625c7028e add type casts to _mm_shuffle_ps so the front-end applies
implicit conversions where needed.  This fixes an error reported
on cfe-dev, not really worth a testcase though.

llvm-svn: 103864
2010-05-15 05:53:53 +00:00
Douglas Gregor 222cf0efbc Recognize when the named return value optimization applies in a
"return" statement and mark the corresponding CXXConstructExpr as
elidable. Teach CodeGen that eliding a temporary is different from
eliding an object construction.

This is just a baby step toward NRVO.

llvm-svn: 103849
2010-05-15 00:13:29 +00:00
Daniel Dunbar 36d4d1541c C++/ABI/x86_64: Member pointers should be classified as INTEGER.
llvm-svn: 103843
2010-05-15 00:00:37 +00:00
Daniel Dunbar 4bd95c65e7 C++/ABI/i386: Member function pointers should be passed by value.
llvm-svn: 103842
2010-05-15 00:00:30 +00:00
Daniel Dunbar 0d8ca9e91a Driver: Make -fverbose-asm the default for platforms where the integrated
assembler defaults to on.

llvm-svn: 103825
2010-05-14 22:00:22 +00:00
Fariborz Jahanian 862fac958b Patch to fix a crash on incomplete class declaration.
Radar 7923673.

llvm-svn: 103812
2010-05-14 21:35:02 +00:00
Douglas Gregor 1c073f47da Emit an lvalue dynamic_cast even if the result is not used. Another
part (or possibly all) of PR7132.

llvm-svn: 103810
2010-05-14 21:31:02 +00:00
Douglas Gregor fa8b4955bb When a failed dynamic_cast<T&> (which is an lvalue) results in a
throw, it should use invoke when needed. The fixes the
Boost.Statechrt failures that motivated PR7132, but there are a few
side issues to tackle as well.

llvm-svn: 103803
2010-05-14 21:14:41 +00:00
Anders Carlsson a1bc38d53e Remove an unused function.
llvm-svn: 103793
2010-05-14 19:48:27 +00:00
Anders Carlsson 1cf9274a5a Move ContainsPointerToDataMember to CodeGenTypes. No functionality change.
llvm-svn: 103792
2010-05-14 19:41:56 +00:00
Fariborz Jahanian bdb1b0d6cb Implement new default property synthesis rules. Essentially, no longer
user directive is needed to force a property implementation.
It is decided based on those propeties which are declared in
the class (or in its protocols) but not those which must be
default implemented by one of its super classes. Implements radar 7923851.

llvm-svn: 103787
2010-05-14 18:35:57 +00:00
Chris Lattner ff895c140c Improve error recovery in C/ObjC when the first argument of a function
declarator is incorrect.  Not being a typename causes the parser to 
dive down into the K&R identifier list handling stuff, which is almost
never the right thing to do.

Before:

r.c:3:17: error: expected ')'
void bar(intptr y);
                ^
r.c:3:9: note: to match this '('
void bar(intptr y);
        ^
r.c:3:10: error: a parameter list without types is only allowed in a function definition
void bar(intptr y);
         ^

After:

r.c:3:10: error: unknown type name 'intptr'; did you mean 'intptr_t'?
void bar(intptr y);
         ^~~~~~
         intptr_t
r.c:1:13: note: 'intptr_t' declared here
typedef int intptr_t;
            ^

This fixes rdar://7980651 - poor recovery for bad type in the first arg of a C function

llvm-svn: 103783
2010-05-14 17:44:56 +00:00
Chris Lattner 9453ab8c9c Refactor ParseFunctionDeclaratorIdentifierList to have the first
identifier in the identifier list consumed before it is called.
No functionality change.

llvm-svn: 103781
2010-05-14 17:23:36 +00:00
Abramo Bagnara f819945365 Added Expr::EvaluateAsAnyLValue.
llvm-svn: 103780
2010-05-14 17:07:14 +00:00
Devang Patel ec2a9abd4a Fix thinko in yesterday's fix.
Providing linkage name for function static variable confuses gdb, so don't do that.

llvm-svn: 103779
2010-05-14 16:55:25 +00:00
Daniel Dunbar 4707cef758 Revert r103770, "Added basic source locations to Elaborated and DependentName
types.", it is breaking Clang bootstrap.

llvm-svn: 103775
2010-05-14 16:34:09 +00:00
Anders Carlsson 65c6d541dd Make sure that value-initialized pointers to data members are initialized correctly.
llvm-svn: 103771
2010-05-14 15:05:19 +00:00
Abramo Bagnara e9f4d6ed7d Added basic source locations to Elaborated and DependentName types.
llvm-svn: 103770
2010-05-14 14:14:23 +00:00
Douglas Gregor 05cfc295f4 Namespaces can only be defined at global or namespace scope. Fixes PR6596.
llvm-svn: 103767
2010-05-14 05:08:22 +00:00
Douglas Gregor f3d3ae665c Make sure to search semantic scopes and appropriate template-parameter
scopes during unqualified name lookup that has fallen out to namespace
scope. Fixes PR7133.

llvm-svn: 103766
2010-05-14 04:53:42 +00:00
Douglas Gregor 83de20f5e3 A vtable is used if the key function is defined... even if that key
function's definition is an out-of-class definition marked
"inline". Fixes an assertion in WebKit.

llvm-svn: 103763
2010-05-14 04:08:48 +00:00
Daniel Dunbar 6b45b67b26 C++/Darwin/x86: Teach IRgen it can pass reference types in registers.
llvm-svn: 103761
2010-05-14 03:40:53 +00:00
Daniel Dunbar f9ff35010c Driver: Enable -integrated-as by default, at least for Darwin/x86 without -static.
- How else will we figure out what is broken, eh?

llvm-svn: 103759
2010-05-14 02:03:00 +00:00
Devang Patel 98f217118f Fix context in class static variable's debugging information entry.
This fixes bunch of failures in gdb testsuite.

llvm-svn: 103745
2010-05-13 23:52:37 +00:00
Douglas Gregor 500d9f8221 Disable the available_externally optimization for inline virtual
methods for which the key function is guaranteed to be in another
translation unit. Unfortunately, this guarantee isn't the case when
dealing with shared libraries that fail to export these virtual method
definitions. 

I'm reopening PR6747 so we can consider this again at a later point in
time.

llvm-svn: 103741
2010-05-13 21:36:56 +00:00
Fariborz Jahanian 1bd96d13b2 Objective-C++ Sema. Fix a bug in instantiation of receivers.
Completes radar 7963410.

llvm-svn: 103719
2010-05-13 17:19:25 +00:00
Douglas Gregor 88d292ccb8 Rework when and how vtables are emitted, by tracking where vtables are
"used" (e.g., we will refer to the vtable in the generated code) and
when they are defined (i.e., because we've seen the key function
definition). Previously, we were effectively tracking "potential
definitions" rather than uses, so we were a bit too eager about emitting
vtables for classes without key functions. 

The new scheme:
  - For every use of a vtable, Sema calls MarkVTableUsed() to indicate
  the use. For example, this occurs when calling a virtual member
  function of the class, defining a constructor of that class type,
  dynamic_cast'ing from that type to a derived class, casting
  to/through a virtual base class, etc.
  - For every definition of a vtable, Sema calls MarkVTableUsed() to
  indicate the definition. This happens at the end of the translation
  unit for classes whose key function has been defined (so we can
  delay computation of the key function; see PR6564), and will also
  occur with explicit template instantiation definitions.
 - For every vtable defined/used, we mark all of the virtual member
 functions of that vtable as defined/used, unless we know that the key
 function is in another translation unit. This instantiates virtual
 member functions when needed.
  - At the end of the translation unit, Sema tells CodeGen (via the
  ASTConsumer) which vtables must be defined (CodeGen will define
  them) and which may be used (for which CodeGen will define the
  vtables lazily). 

From a language perspective, both the old and the new schemes are
permissible: we're allowed to instantiate virtual member functions
whenever we want per the standard. However, all other C++ compilers
were more lazy than we were, and our eagerness was both a performance
issue (we instantiated too much) and a portability problem (we broke
Boost test cases, which now pass).

Notes:
  (1) There's a ton of churn in the tests, because the order in which
  vtables get emitted to IR has changed. I've tried to isolate some of
  the larger tests from these issues.
  (2) Some diagnostics related to
  implicitly-instantiated/implicitly-defined virtual member functions
  have moved to the point of first use/definition. It's better this
  way.
  (3) I could use a review of the places where we MarkVTableUsed, to
  see if I missed any place where the language effectively requires a
  vtable.

Fixes PR7114 and PR6564.

llvm-svn: 103718
2010-05-13 16:44:06 +00:00
Ted Kremenek ecc31c93c2 Don't add a null successor to a CFGBlock when the contents of an @synchronized statement is empty.
Fixes <rdar://problem/7979430>.

llvm-svn: 103717
2010-05-13 16:38:08 +00:00
Chandler Carruth d102f2d5c5 Teach the AKA calculation to look at sugar on the pointee type for pointers and
references. This is a WIP as we should handle function pointers, etc. Reshuffle
the code to do this to facilitate recursing in this manner, and to check for
the type already being printed first rather than last.

llvm-svn: 103712
2010-05-13 11:37:24 +00:00
John McCall 01f21ad97c Rebuild builtin_id * as an ObjCObjectPointerType, where builtin_id is the
magic type that 'id' is a pointer to.

llvm-svn: 103708
2010-05-13 08:39:13 +00:00
Zhongxing Xu 6e8417c0e5 Relax an assertion. Various cases could lead to non-symbol values.
llvm-svn: 103707
2010-05-13 08:26:32 +00:00
John McCall bb4ea81ab9 When performing template argument deduction, match Objective C pointers
against pointer patterns.

llvm-svn: 103706
2010-05-13 07:48:05 +00:00
Chandler Carruth 7100860ef5 Delete a dead function at sabre's request.
llvm-svn: 103705
2010-05-13 07:47:58 +00:00
Chandler Carruth dd8f20dfb6 Update the types for warning option subgroup arrays to 'short', we have more
than 127 groups so this was already failing given -fsigned-char. A subsequent
to commit to TableGen will generate shorts for the arrays themselves.

llvm-svn: 103703
2010-05-13 07:43:05 +00:00
Chris Lattner c96f1fbd8d add a couple of key functions for classes without them.
llvm-svn: 103688
2010-05-13 01:02:19 +00:00
Devang Patel c5ffabc94f If given location is invalid then use current location.
This fixes recent regressions reported by gdb testsuite. 
Tighter verification of debug info generated by FE found these regressions.

Refactor code to extract line number and column number from SourceLocation.

llvm-svn: 103678
2010-05-12 23:46:38 +00:00
Fariborz Jahanian cac49a8f8a Objective-C++ Sema. Support for conversion of a C++
class object used as a receiver to an objective-c
pointer via a converwsion function. wip.

llvm-svn: 103672
2010-05-12 23:29:11 +00:00
Chris Lattner bf5c83745a "this patch properly addresses escaping < and > which might appear
(e.g. for C++ operators) in the xml dump.

I also re-enabled the unit test for ast-print-xml (or so I think)
at least, make test didn't fail..."

patch by Sebastien Binet!

llvm-svn: 103671
2010-05-12 23:27:11 +00:00
Chris Lattner 5c02c2af3f improve comments.
llvm-svn: 103670
2010-05-12 23:26:21 +00:00
Daniel Dunbar fcc49a8f1f Driver/Darwin/i386: Don't allow compiling C++ with -fapple-kext, we don't support the necessary ABI yet.
llvm-svn: 103632
2010-05-12 18:19:58 +00:00
Daniel Dunbar 4083d044e1 Simplify.
llvm-svn: 103631
2010-05-12 18:19:55 +00:00
Fariborz Jahanian b0901b7951 Objective-C++ Sema - Allow static_cast of one objc pointer to
another.

llvm-svn: 103630
2010-05-12 18:16:59 +00:00
Douglas Gregor 17158425f2 Whenever we instantiate a function definition or class, enter a new
potentially-evaluated expression context, to ensure that used
declarations get properly marked. Fixes PR7123.

llvm-svn: 103624
2010-05-12 17:27:19 +00:00
Douglas Gregor 54818f0c37 When we emit an error during the implicit definition of a special
member function (default constructor, copy constructor, copy
assignment operator, destructor), emit a note showing where that
implicit definition was required.

llvm-svn: 103619
2010-05-12 16:39:35 +00:00
John McCall 42f9f1f17f Improve commentary on the indirect-goto jump scope checker and extract
a convenience routine to find the innermost common ancestor of two scopes.

llvm-svn: 103565
2010-05-12 02:37:54 +00:00
John McCall cf819ab383 When checking scopes for indirect goto, be more permissive (but still safe)
about the permitted scopes.  Specifically:
  1) Permit labels and gotos to appear after a prologue of variable initializations.
  2) Permit indirect gotos to jump out of scopes that don't require cleanup.
  3) Diagnose possible attempts to indirect-jump out of scopes that do require
     cleanup.
This requires a substantial reinvention of the algorithm for checking indirect
goto.  The current algorithm is Omega(M*N), with M = the number of unique
scopes being jumped from and N = the number of unique scopes being jumped to,
with an additional factor that is probably (worst-case) linear in the depth
of scopes.  Thus the entire thing is likely cubic given some truly bizarre
ill-formed code;  on well-formed code the additional factor collapses to
an amortized constant (when amortized over the entire function) and so
the algorithm is quadratic.  Even this requires every label to appear in
its own scope, which would be very unusual for indirect-goto code (and
extremely unlikely for well-formed code);  it is far more likely that
all labels will be in the same scope and so the algorithm becomes linear.
For such a marginal feature, I am fairly happy with this result.

(this is using JumpDiagnostic's definition of scope, where successive
variables in a block appear in their own scope)

llvm-svn: 103536
2010-05-12 00:58:13 +00:00
Devang Patel 3c2d51a1b9 Use end location of DeclStmt to mark stop point.
This is meaningful for blocks. This patch fixes bunch of test failures in gdb testsuite.

llvm-svn: 103533
2010-05-12 00:39:34 +00:00
Abramo Bagnara 6150c884df Merged Elaborated and QualifiedName types.
llvm-svn: 103517
2010-05-11 21:36:43 +00:00
Daniel Dunbar 0547ad38e3 Speculatively revert r103497, "Do not mark the virtual members of an
implicitly-instantiated class as ...", which seems to have broken bootstrap.

llvm-svn: 103515
2010-05-11 21:32:35 +00:00
Daniel Dunbar 12ebb47a07 IRgen/i386/C++: Fix isSingleElementStruct computation for C++ record decls.
- Fixes PR7098.

llvm-svn: 103514
2010-05-11 21:15:36 +00:00
Douglas Gregor 0c4aad15c2 Do not mark the virtual members of an implicitly-instantiated class as
referenced unless we see one of them defined (or the key function
defined, if it as one) or if we need the vtable for something. Fixes
PR7114.

llvm-svn: 103497
2010-05-11 20:24:17 +00:00
Duncan Sands af260b9945 VISIBILITY_HIDDEN was renamed LLVM_LIBRARY_VISIBILITY.
llvm-svn: 103494
2010-05-11 20:16:05 +00:00
Douglas Gregor 6a047c979f It's bad form to create VarDecl's without DeclContexts
llvm-svn: 103484
2010-05-11 18:17:16 +00:00
Douglas Gregor c97d7a2c6a The C++98/03 standard is disturbingly silent about out-of-scope
explicit instantiations of template. C++0x clarifies the intent
(they're ill-formed in some cases; see [temp.explicit] for
details). However, one could squint at the C++98/03 standard and
conclude they are permitted, so reduce the error to a warning
(controlled by -Wc++0x-compat) in C++98/03 mode.

llvm-svn: 103482
2010-05-11 17:39:34 +00:00
Douglas Gregor 112de35e5b Static data members intialized in-class that have constant values are
value-dependent if their initializers are value-dependent; my recent
tweak to these dependent rules overstepped by taking away this
value-dependents. Fixes a Boost.GIL regression.

llvm-svn: 103476
2010-05-11 16:41:27 +00:00
Fariborz Jahanian 2d2623c710 Minor refactoring of my last patch.
llvm-svn: 103475
2010-05-11 16:31:10 +00:00
Douglas Gregor be49fc5ea2 Fix indentation
llvm-svn: 103465
2010-05-11 08:44:04 +00:00
Douglas Gregor 0e4de76610 A DeclRefExpr that refers to a member function or a static data member
of the current instantiation is value-dependent. The C++ standard
fails to enumerate this case and, therefore, we missed it. Chandler
did all of the hard work of reducing the last remaining
Boost.PtrContainer failure (which had to do with static initialization
in the Serialization library) down to this simple little test.

While I'm at it, clean up the dependence rules for template arguments
that are declarations, and implement the dependence rules for template
argument packs.

llvm-svn: 103464
2010-05-11 08:41:30 +00:00
Douglas Gregor 10dc8aa581 Fixes for compilation with Microsoft Visual Studio 2010, from Steven Watanabe!
llvm-svn: 103458
2010-05-11 06:18:17 +00:00
Devang Patel 82bbfb58e3 Initialize Column.
llvm-svn: 103448
2010-05-10 23:48:38 +00:00
Fariborz Jahanian eee1669adb Allow static_cast to objective-c pointers.
Fixes radar 7952457.

llvm-svn: 103447
2010-05-10 23:46:53 +00:00
John McCall 9500760829 Refactor the constant-evaluator so that it only supports a single form
of constant-evaluation.  Formerly you could control whether it accepted
local l-values or not;  now it always evaluates local l-values in the core
routines, but filters them out where consumed by the top-level routines.
This will make it much easier to cache evaluability.

llvm-svn: 103444
2010-05-10 23:27:23 +00:00
Fariborz Jahanian 43a40f9399 Objective-C++ Code gen. Handle code gen. for property
reference dot-syntax notation in a varierty of cases.
Fixes radar 7964490.

llvm-svn: 103440
2010-05-10 22:57:35 +00:00
Ted Kremenek 7e550caf4e Allocate most of DeclarationNamesTable using ASTContext's allcocator. The only things that
aren't allocated this way are the internal FoldingSets.

llvm-svn: 103429
2010-05-10 20:56:10 +00:00
Ted Kremenek 6aead3a051 Start converting pieces of DeclarationNameTable to be allocated using ASTContext's allocator.
While DeclarationNameTable doesn't leak, it uses 'malloc' too often.  Start with having
'CXXLiteralOperatorNames' allocated using ASTContext's allocator and add a 'DoDestroy()' method
to DeclarationNameTable that is called by ~ASTContext.

llvm-svn: 103426
2010-05-10 20:40:08 +00:00
Ted Kremenek a9084c1fb1 Convert CXXTempory[] in CXXExprWithTemporaries to be allocated using ASTContext's allocator. Fixes <rdar://problem/7961605>.
llvm-svn: 103421
2010-05-10 20:06:30 +00:00
Douglas Gregor e5279cea49 Improved -ast-print-xml for C++, from Sebastien Binet!
llvm-svn: 103412
2010-05-10 17:43:18 +00:00
Devang Patel b319adec49 If variable location is invalid then use current location.
This fixes radar 7959934.

llvm-svn: 103408
2010-05-10 17:24:58 +00:00
Daniel Dunbar c8a7bdbcc4 Fix refacto in r103387, noticed by Christopher Jefferson.
llvm-svn: 103406
2010-05-10 15:59:37 +00:00
Anders Carlsson 5f1a1704a2 Add an UpdateVBases parameter to UpdateEmptyClassOffsets. Not used just yet.
llvm-svn: 103403
2010-05-10 15:28:59 +00:00
Anders Carlsson d626cb74d1 More work on handling empty classes.
llvm-svn: 103402
2010-05-10 15:26:14 +00:00
Chris Lattner abfb58d1d2 pch'ify CXXNewExpr and CXXZeroInitValueExpr
llvm-svn: 103390
2010-05-10 01:22:27 +00:00
Chris Lattner bc7d55d1f0 fix refactor-o
llvm-svn: 103388
2010-05-10 00:45:12 +00:00
Chris Lattner cba86142a4 pchify CXXTemporary, CXXBindTemporaryExpr, and
CXXExprWithTemporaries.

llvm-svn: 103387
2010-05-10 00:25:06 +00:00
Chris Lattner e2437f4538 pch'ify default argument definitions and uses.
llvm-svn: 103376
2010-05-09 06:40:08 +00:00
Chris Lattner 9826733963 pch'ify 'this' and 'throw'
llvm-svn: 103375
2010-05-09 06:15:05 +00:00
Chris Lattner 13a5ecc6ff pch'ify typeid.
llvm-svn: 103374
2010-05-09 06:03:39 +00:00
Chris Lattner b7e7f722a2 pchify CXXMemberCallExpr correctly. Before it would serialize
and deserialize as a CallExpr which is close, but ends up
deserializing with the wrong stmt class.

llvm-svn: 103371
2010-05-09 05:36:05 +00:00
Anders Carlsson 82828a31f6 Cleanup.
llvm-svn: 103370
2010-05-09 05:03:38 +00:00
Douglas Gregor 62c281a873 Be more careful about picking a template parameter when we fail to substitute explicit template arguments into a function template
llvm-svn: 103369
2010-05-09 01:26:06 +00:00
David Chisnall e0b5b3a1c5 Tweaked selector mangling again (GNU runtime).
llvm-svn: 103368
2010-05-09 01:01:43 +00:00
Douglas Gregor 6d319c62c5 Fix a silly bootstrap-breaking thinko, where we were trying to convert
non-existent condition expressions to boolean values during template
instantiation.

llvm-svn: 103364
2010-05-08 23:34:38 +00:00
Anders Carlsson 15837f8f63 Actually compute the empty subobject sizes. No functionality change yet.
llvm-svn: 103363
2010-05-08 23:06:26 +00:00
Douglas Gregor 14f232ea20 Improve our handling of the -Wunused-variable warning in templates. In
particular, don't complain about unused variables that have dependent
type until instantiation time, so that we can look at the type of the
variable. Moreover, only complain about unused variables that have
neither a user-declared constructor nor a non-trivial destructor.

llvm-svn: 103362
2010-05-08 23:05:03 +00:00
Douglas Gregor 0bbe94d6df Don't complain about an __builtin_va_arg expression's result being
unused, since the operation has side effects.

llvm-svn: 103360
2010-05-08 22:41:50 +00:00