Commit Graph

23007 Commits

Author SHA1 Message Date
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
Douglas Gregor ecd99b1a40 Add Redeclarable boilerplate to TypedefDecl, from Peter Collingbourne!
llvm-svn: 104631
2010-05-25 19:53:14 +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
Douglas Gregor aab11ede6e Fix testsuite for blocks mangling change
llvm-svn: 104618
2010-05-25 17:46:21 +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 4fb17cc6f8 Put -Wvla into the -Wgnu warning group
llvm-svn: 104606
2010-05-25 15:04:55 +00:00
Douglas Gregor 09737ee885 Turn vertical spacing into horizontal spacing in code-completion results
llvm-svn: 104586
2010-05-25 06:14:46 +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
Nick Lewycky 129b381a58 Make this class useful as a base.
llvm-svn: 104578
2010-05-25 01:51:06 +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
Chris Lattner f95c7c8ed2 add a few more categories.
llvm-svn: 104566
2010-05-24 21:54:02 +00:00
Chris Lattner f294c560da missed an svn add
llvm-svn: 104562
2010-05-24 21:38:14 +00:00
Chris Lattner b997626120 push categories forward a bit more: document them, add some
major buckets to catch parser and sema issues, add inline asm
category, and make diag groups take precedence over the 
sweeping categories just added.

llvm-svn: 104561
2010-05-24 21:35:18 +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
Douglas Gregor 01308a0e11 Make clang_isFromMainFile() robust against NULL source locations.
llvm-svn: 104474
2010-05-23 21:31:22 +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 4b636a70d9 Put the VLA-is-an-extension warning into its own warning group (-Wvla)
so that it can be selectively enabled/disabled.

llvm-svn: 104462
2010-05-23 16:51:27 +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