]> granicus.if.org Git - clang/log
clang
14 years agoWhen transforming a C++ "new" expression's constructor arguments, drop
Douglas Gregor [Wed, 26 May 2010 07:10:06 +0000 (07:10 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104690 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRename ASTRecordLayoutBuilder to RecordLayoutBuilder.
Anders Carlsson [Wed, 26 May 2010 05:58:59 +0000 (05:58 +0000)]
Rename ASTRecordLayoutBuilder to RecordLayoutBuilder.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104688 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove RecordLayoutBuilder.h
Anders Carlsson [Wed, 26 May 2010 05:49:19 +0000 (05:49 +0000)]
Remove RecordLayoutBuilder.h

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104687 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMove the ASTRecordLayoutBuilder class declaration into the .cpp file.
Anders Carlsson [Wed, 26 May 2010 05:41:04 +0000 (05:41 +0000)]
Move the ASTRecordLayoutBuilder class declaration into the .cpp file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104686 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoASTRecordLayoutBuilder is no longer a friend of ASTRecordLayout.
Anders Carlsson [Wed, 26 May 2010 05:36:18 +0000 (05:36 +0000)]
ASTRecordLayoutBuilder is no longer a friend of ASTRecordLayout.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104685 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTell the string literal parser when it's not permitted to emit
Douglas Gregor [Wed, 26 May 2010 05:35:51 +0000 (05:35 +0000)]
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>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104684 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix thinko and remove another unused function.
Anders Carlsson [Wed, 26 May 2010 05:31:23 +0000 (05:31 +0000)]
Fix thinko and remove another unused function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104683 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix build.
Anders Carlsson [Wed, 26 May 2010 05:25:15 +0000 (05:25 +0000)]
Fix build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104682 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoNo need to use the PrimaryBaseInfo struct in the builder.
Anders Carlsson [Wed, 26 May 2010 05:20:58 +0000 (05:20 +0000)]
No need to use the PrimaryBaseInfo struct in the builder.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104681 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoBe sure to use the standard substitutions when mangling the names of
Douglas Gregor [Wed, 26 May 2010 05:11:13 +0000 (05:11 +0000)]
Be sure to use the standard substitutions when mangling the names of
vtables, VTTs, and construction vtables. Fixes PR7201.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104675 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove FIXME.
Anders Carlsson [Wed, 26 May 2010 05:11:02 +0000 (05:11 +0000)]
Remove FIXME.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104674 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFold the other Layout overload into its sole call site.
Anders Carlsson [Wed, 26 May 2010 05:10:47 +0000 (05:10 +0000)]
Fold the other Layout overload into its sole call site.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104673 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFold the ASTRecordLayoutBuilder::ComputeLayout overload that takes an ObjCInterfaceDe...
Anders Carlsson [Wed, 26 May 2010 05:04:25 +0000 (05:04 +0000)]
Fold the ASTRecordLayoutBuilder::ComputeLayout overload that takes an ObjCInterfaceDecl pointer into its only callsite.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104672 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMove the relevant ASTContext member functions that deal with ASTRecordLayoutBuilder...
Anders Carlsson [Wed, 26 May 2010 04:56:53 +0000 (04:56 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104671 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSmall fix.
Zhongxing Xu [Wed, 26 May 2010 03:36:08 +0000 (03:36 +0000)]
Small fix.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104669 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove extents of dead symbolic regions when RemoveDeadBindings.
Zhongxing Xu [Wed, 26 May 2010 03:27:35 +0000 (03:27 +0000)]
Remove extents of dead symbolic regions when RemoveDeadBindings.
This requires creating new persistent states due to the nature of GDM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104668 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoOnly enable code patterns (e.g., try { statements } catch (...) {
Douglas Gregor [Tue, 25 May 2010 21:41:55 +0000 (21:41 +0000)]
Only enable code patterns (e.g., try { statements } catch (...) {
statements }) in the code-completion results if explicitly requested.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104637 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAllocate the contents of TemplateArgumentList using ASTContext's allocator. This...
Ted Kremenek [Tue, 25 May 2010 20:43:29 +0000 (20:43 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104633 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd Redeclarable boilerplate to TypedefDecl, from Peter Collingbourne!
Douglas Gregor [Tue, 25 May 2010 19:53:14 +0000 (19:53 +0000)]
Add Redeclarable boilerplate to TypedefDecl, from Peter Collingbourne!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104631 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoIRgen: Add a stub class for generating ABI-specific C++ code.
Charles Davis [Tue, 25 May 2010 19:52:27 +0000 (19:52 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104630 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDriver/Frontend: Add -emit-codegen-only, for running irgen + codegen but not the
Daniel Dunbar [Tue, 25 May 2010 18:41:01 +0000 (18:41 +0000)]
Driver/Frontend: Add -emit-codegen-only, for running irgen + codegen but not the
.s printer or .o writer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104623 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agomake -ast-dump print something like this for declstmts:
Chris Lattner [Tue, 25 May 2010 17:56:43 +0000 (17:56 +0000)]
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)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104620 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix testsuite for blocks mangling change
Douglas Gregor [Tue, 25 May 2010 17:46:21 +0000 (17:46 +0000)]
Fix testsuite for blocks mangling change

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104618 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRefactoring of block-pointer type rewrite.
Fariborz Jahanian [Tue, 25 May 2010 17:12:52 +0000 (17:12 +0000)]
Refactoring of block-pointer type rewrite.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104614 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix compilation failure
Douglas Gregor [Tue, 25 May 2010 17:12:30 +0000 (17:12 +0000)]
Fix compilation failure

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104613 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImprove name mangling for blocks and support mangling of static local
Douglas Gregor [Tue, 25 May 2010 17:04:15 +0000 (17:04 +0000)]
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>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104610 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoPatch to rewrite block pointers as arguments to
Fariborz Jahanian [Tue, 25 May 2010 15:56:08 +0000 (15:56 +0000)]
Patch to rewrite block pointers as arguments to
methods. (Radar 7987817).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104608 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake sure to strip off top-level cv-qualifiers as part of a
Douglas Gregor [Tue, 25 May 2010 15:31:05 +0000 (15:31 +0000)]
Make sure to strip off top-level cv-qualifiers as part of a
derived-to-base conversion on a pointer. Fixes PR7224.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104607 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoPut -Wvla into the -Wgnu warning group
Douglas Gregor [Tue, 25 May 2010 15:04:55 +0000 (15:04 +0000)]
Put -Wvla into the -Wgnu warning group

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104606 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTurn vertical spacing into horizontal spacing in code-completion results
Douglas Gregor [Tue, 25 May 2010 06:14:46 +0000 (06:14 +0000)]
Turn vertical spacing into horizontal spacing in code-completion results

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104586 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImprove code completion in failure cases in two ways:
Douglas Gregor [Tue, 25 May 2010 05:58:43 +0000 (05:58 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104585 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoCastSizeChecker checks when casting a malloc'ed symbolic region to type T,
Zhongxing Xu [Tue, 25 May 2010 04:59:19 +0000 (04:59 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104584 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoIf a function definition has any sort of weak linkage, its static local
John McCall [Tue, 25 May 2010 04:30:21 +0000 (04:30 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104581 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake this class useful as a base.
Nick Lewycky [Tue, 25 May 2010 01:51:06 +0000 (01:51 +0000)]
Make this class useful as a base.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104578 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoIRgen/C++: When mark vtables used, make sure to still append to the VTableUse array...
Daniel Dunbar [Tue, 25 May 2010 00:33:13 +0000 (00:33 +0000)]
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!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104577 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSimplify.
Daniel Dunbar [Tue, 25 May 2010 00:32:58 +0000 (00:32 +0000)]
Simplify.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104576 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoimprove the fixit for the missing : error when parsing ?:. When
Chris Lattner [Mon, 24 May 2010 22:31:37 +0000 (22:31 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104569 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoadd a few more categories.
Chris Lattner [Mon, 24 May 2010 21:54:02 +0000 (21:54 +0000)]
add a few more categories.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104566 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agomissed an svn add
Chris Lattner [Mon, 24 May 2010 21:38:14 +0000 (21:38 +0000)]
missed an svn add

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104562 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agopush categories forward a bit more: document them, add some
Chris Lattner [Mon, 24 May 2010 21:35:18 +0000 (21:35 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104561 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDon't complain about VLAs of non-POD types when the array type is
Douglas Gregor [Mon, 24 May 2010 20:42:30 +0000 (20:42 +0000)]
Don't complain about VLAs of non-POD types when the array type is
dependent. Fixes <rdar://problem/8021385>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104550 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoA type- or value-dependent expression cannot use bitfield
Douglas Gregor [Mon, 24 May 2010 20:13:53 +0000 (20:13 +0000)]
A type- or value-dependent expression cannot use bitfield
promotion. Fixes <rdar://problem/8020920>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104545 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agowhen too many errors are emitted, and we produce:
Chris Lattner [Mon, 24 May 2010 18:37:03 +0000 (18:37 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104528 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix a rewriting bug where a local static objective-c
Fariborz Jahanian [Mon, 24 May 2010 18:32:56 +0000 (18:32 +0000)]
Fix a rewriting bug where a local static objective-c
pointer is copied into a block. Fixes radar 7924024.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104526 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix an objective-c rewriter bug when pre-processed file's
Fariborz Jahanian [Mon, 24 May 2010 17:22:38 +0000 (17:22 +0000)]
Fix an objective-c rewriter bug when pre-processed file's
class declaration's @end is not followed by a new-line.
(radar 7946975).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104512 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake sure that we instantiate variably modified types, even if they
Douglas Gregor [Mon, 24 May 2010 17:22:01 +0000 (17:22 +0000)]
Make sure that we instantiate variably modified types, even if they
aren't dependent. Fixes <rdar://problem/8020206>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104511 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDowngrade deletion of a void* from an error (which is should be) to an
Douglas Gregor [Mon, 24 May 2010 17:01:56 +0000 (17:01 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104509 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAn identity conversion is better than any non-identity
Douglas Gregor [Sun, 23 May 2010 22:10:15 +0000 (22:10 +0000)]
An identity conversion is better than any non-identity
conversion. Fixes PR7095.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104476 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoIn C++, one cannot assign from an arithmetic type to an enumeration
Douglas Gregor [Sun, 23 May 2010 21:53:47 +0000 (21:53 +0000)]
In C++, one cannot assign from an arithmetic type to an enumeration
type. Fixes PR7051.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104475 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake clang_isFromMainFile() robust against NULL source locations.
Douglas Gregor [Sun, 23 May 2010 21:31:22 +0000 (21:31 +0000)]
Make clang_isFromMainFile() robust against NULL source locations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104474 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd a comment for r104472.
Benjamin Kramer [Sun, 23 May 2010 20:57:46 +0000 (20:57 +0000)]
Add a comment for r104472.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104473 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoPR5863: Don't erase unreachable BBs which have an associated cleanup size.
Benjamin Kramer [Sun, 23 May 2010 20:00:44 +0000 (20:00 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104472 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoIt turns out that people love using VLAs in templates, too. Weaken our
Douglas Gregor [Sun, 23 May 2010 19:57:01 +0000 (19:57 +0000)]
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104471 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoComplain about sizeof(overloaded function) rather than crashing.
Douglas Gregor [Sun, 23 May 2010 19:43:23 +0000 (19:43 +0000)]
Complain about sizeof(overloaded function) rather than crashing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104470 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMove OverloadExpr over to a ASTContext-allocated pointer for its
Douglas Gregor [Sun, 23 May 2010 19:36:40 +0000 (19:36 +0000)]
Move OverloadExpr over to a ASTContext-allocated pointer for its
storage, rather than an UnresolvedSet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104469 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoProvide the overloaded functions for UnresolvedLookupExpr and
Douglas Gregor [Sun, 23 May 2010 18:57:34 +0000 (18:57 +0000)]
Provide the overloaded functions for UnresolvedLookupExpr and
UnresolvedMemberExpr in their constructors, rather than adding them
after the fact. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104468 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoKeep track of all of the class and function template's "common"
Douglas Gregor [Sun, 23 May 2010 18:26:36 +0000 (18:26 +0000)]
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>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104465 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen recording empty subobjects we should always look at the primary virtual base.
Anders Carlsson [Sun, 23 May 2010 18:14:24 +0000 (18:14 +0000)]
When recording empty subobjects we should always look at the primary virtual base.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104464 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoPut the VLA-is-an-extension warning into its own warning group (-Wvla)
Douglas Gregor [Sun, 23 May 2010 16:51:27 +0000 (16:51 +0000)]
Put the VLA-is-an-extension warning into its own warning group (-Wvla)
so that it can be selectively enabled/disabled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104462 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoEven though we don't unique VLA types, we still need to build a
Douglas Gregor [Sun, 23 May 2010 16:10:32 +0000 (16:10 +0000)]
Even though we don't unique VLA types, we still need to build a
canonical type where the element type is canonical. Fixes PR7206.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104461 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRe-teach IR gen to perform GC moves on rvalues resulting from various ObjC
John McCall [Sat, 22 May 2010 22:13:32 +0000 (22:13 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104454 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoReally fix PR7139. There was one boost test that we still failed, and my first fix...
Anders Carlsson [Sat, 22 May 2010 17:45:10 +0000 (17:45 +0000)]
Really fix PR7139. There was one boost test that we still failed, and my first fix broke self-host.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104447 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRe-land the fix for PR7139.
Anders Carlsson [Sat, 22 May 2010 17:35:42 +0000 (17:35 +0000)]
Re-land the fix for PR7139.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104446 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDon't look for a destructor in a dependent type. Fixes PR7198.
Douglas Gregor [Sat, 22 May 2010 17:12:29 +0000 (17:12 +0000)]
Don't look for a destructor in a dependent type. Fixes PR7198.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104445 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen determining whether we can use "this", make sure to look through
Douglas Gregor [Sat, 22 May 2010 16:25:05 +0000 (16:25 +0000)]
When determining whether we can use "this", make sure to look through
enum contexts (along with block contexts, which we already did). Fixes
PR7196.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104444 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImplement support for variable length arrays in C++. VLAs are limited
Douglas Gregor [Sat, 22 May 2010 16:17:30 +0000 (16:17 +0000)]
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>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104443 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agominor updates
Chris Lattner [Sat, 22 May 2010 07:02:06 +0000 (07:02 +0000)]
minor updates

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104436 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImprove our handling of reference binding for subobjects of
Douglas Gregor [Sat, 22 May 2010 05:17:18 +0000 (05:17 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104434 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAttempt to make MSVC happy.
Daniel Dunbar [Sat, 22 May 2010 05:05:12 +0000 (05:05 +0000)]
Attempt to make MSVC happy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104432 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDaniel re-educated me about what Alias does and does not do. Turn that off for
Chandler Carruth [Sat, 22 May 2010 02:21:53 +0000 (02:21 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104428 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoPush a return-value slot throughout ObjC message-send codegen. Will be
John McCall [Sat, 22 May 2010 01:48:05 +0000 (01:48 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104422 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDriver: When printing a "command was signalled" type of diagnostic, use the
Daniel Dunbar [Sat, 22 May 2010 00:37:20 +0000 (00:37 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104417 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDriver: Add Tool::ShortName, intended to be a human readable name for the tool.
Daniel Dunbar [Sat, 22 May 2010 00:37:18 +0000 (00:37 +0000)]
Driver: Add Tool::ShortName, intended to be a human readable name for the tool.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104416 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake crashreport data in libclang a compile-time option.
Ted Kremenek [Sat, 22 May 2010 00:06:46 +0000 (00:06 +0000)]
Make crashreport data in libclang a compile-time option.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104413 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImprove recovery when we see a dependent template name that is missing
Douglas Gregor [Fri, 21 May 2010 23:43:39 +0000 (23:43 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104409 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoClang missing warning about conflicting declaration vs. definition
Fariborz Jahanian [Fri, 21 May 2010 23:28:58 +0000 (23:28 +0000)]
Clang missing warning about conflicting declaration vs. definition
for variable arguments list methods. (radar 8006060).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104407 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImprove parser recovery when we encounter a dependent template name
Douglas Gregor [Fri, 21 May 2010 23:18:07 +0000 (23:18 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104406 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoOutdent this file by 2 spaces per the coding standards, and also clean up
Nick Lewycky [Fri, 21 May 2010 23:14:51 +0000 (23:14 +0000)]
Outdent this file by 2 spaces per the coding standards, and also clean up
whitespace at the end of lines since I'm already touching the whole file
anyways.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104403 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUnbreak self-host.
Anders Carlsson [Fri, 21 May 2010 22:17:48 +0000 (22:17 +0000)]
Unbreak self-host.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104390 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUpdate retain-release checker to understand changes to how 'super' is represented
Ted Kremenek [Fri, 21 May 2010 21:57:00 +0000 (21:57 +0000)]
Update retain-release checker to understand changes to how 'super' is represented
in the ASTs.  Fixes <rdar://problem/8015556>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104389 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoPass around an error SourceRange instead of an Expr* when reporting errors
Ted Kremenek [Fri, 21 May 2010 21:56:53 +0000 (21:56 +0000)]
Pass around an error SourceRange instead of an Expr* when reporting errors
in the Objective-C memory checker.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104388 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRename CodeGenFunction::EmitMemSetToZero to EmitNullInitialization. Handle setting...
Anders Carlsson [Fri, 21 May 2010 21:45:41 +0000 (21:45 +0000)]
Rename CodeGenFunction::EmitMemSetToZero to EmitNullInitialization. Handle setting null data member pointers correctly. Fixes PR7139.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104387 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen instantiating a function declaration within a function template,
Douglas Gregor [Fri, 21 May 2010 21:25:08 +0000 (21:25 +0000)]
When instantiating a function declaration within a function template,
be sure to merge its parameter scope with its parent's scope. Fixes
PR7184.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104386 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agodown with export.
Chris Lattner [Fri, 21 May 2010 21:16:21 +0000 (21:16 +0000)]
down with export.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104383 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImproved TypeLoc::getSourceRange().
Abramo Bagnara [Fri, 21 May 2010 21:12:12 +0000 (21:12 +0000)]
Improved TypeLoc::getSourceRange().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104382 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoanother unneeded line.
Chris Lattner [Fri, 21 May 2010 21:02:17 +0000 (21:02 +0000)]
another unneeded line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104379 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agomajor update to the C++ status page. C++ support is
Chris Lattner [Fri, 21 May 2010 20:59:40 +0000 (20:59 +0000)]
major update to the C++ status page.  C++ support is
now done and no more patches to it will be accepted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104378 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoPropagate access specifiers to anonymous union members nested within classes.
John McCall [Fri, 21 May 2010 20:45:30 +0000 (20:45 +0000)]
Propagate access specifiers to anonymous union members nested within classes.
Fixes <rdar://problem/7987650>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104376 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix crash in CFG construction for 'break' statements appearing in statement expressions
Ted Kremenek [Fri, 21 May 2010 20:30:15 +0000 (20:30 +0000)]
Fix crash in CFG construction for 'break' statements appearing in statement expressions
within the increment code of a for loop.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104375 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUse CanQualType to enforce the use of a canonical type argument to
Douglas Gregor [Fri, 21 May 2010 20:29:55 +0000 (20:29 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104374 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agodon't make _Bool be a keyword in -fms-extensions mode, patch by
Chris Lattner [Fri, 21 May 2010 20:22:37 +0000 (20:22 +0000)]
don't make _Bool be a keyword in -fms-extensions mode, patch by
Steven Watanabe!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104373 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTry to fix MSVC build.
Benjamin Kramer [Fri, 21 May 2010 19:58:44 +0000 (19:58 +0000)]
Try to fix MSVC build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104371 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDon't remove the break/continue scope of a for loop until after we've
Douglas Gregor [Fri, 21 May 2010 18:36:48 +0000 (18:36 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104335 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTypeVisitor doesn't visit Stmts.
Nick Lewycky [Fri, 21 May 2010 18:04:30 +0000 (18:04 +0000)]
TypeVisitor doesn't visit Stmts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104332 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen generating the call arguments in a thunk to call the thunkee, do
Douglas Gregor [Fri, 21 May 2010 17:55:12 +0000 (17:55 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104327 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoChanged test to use FileCheck.
Fariborz Jahanian [Fri, 21 May 2010 16:13:37 +0000 (16:13 +0000)]
Changed test to use FileCheck.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104319 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTeach the RecursiveASTVisitor to enter parts of the AST previously missed.
Chandler Carruth [Fri, 21 May 2010 10:29:57 +0000 (10:29 +0000)]
Teach the RecursiveASTVisitor to enter parts of the AST previously missed.
Factor its implementation to ease the addition of these custom edges to
traverse. With this patch we get initializer expressions, block bodies, type
source info, and function argument, result, and exception types. There are
probably still some more missed edges.

While we're here, clean up and flesh out a bunch of comments.

Patch by Zhanyong Wan; I've done a cursory review, but further review
appreciated. This is fast becoming one of the most important public APIs to the
AST.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104315 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd braces to avoid an ambiguous else, fixing a GCC warning.
Chandler Carruth [Fri, 21 May 2010 10:29:28 +0000 (10:29 +0000)]
Add braces to avoid an ambiguous else, fixing a GCC warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104314 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAllocate space in a block record for implicit references to the Objective C
John McCall [Fri, 21 May 2010 04:11:14 +0000 (04:11 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104312 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen emitting an lvalue for an anonymous struct or union member during
John McCall [Fri, 21 May 2010 01:18:57 +0000 (01:18 +0000)]
When emitting an lvalue for an anonymous struct or union member during
class initialization, drill down through an arbitrary number of anonymous
records.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104310 91177308-0d34-0410-b5e6-96231b3b80d8