]> granicus.if.org Git - clang/log
clang
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

14 years agoIntroduce a method to get from an anonymous struct or union record declaration
John McCall [Fri, 21 May 2010 01:17:40 +0000 (01:17 +0000)]
Introduce a method to get from an anonymous struct or union record declaration
to the associated object declaration.

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

14 years agoWhen instantiating anonymous structs/unions within a function, make
Douglas Gregor [Fri, 21 May 2010 00:31:19 +0000 (00:31 +0000)]
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.

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

14 years agodocs: Man page tweaks, to mention the integrated assembler and the
Daniel Dunbar [Fri, 21 May 2010 00:28:14 +0000 (00:28 +0000)]
docs: Man page tweaks, to mention the integrated assembler and the
-integrated-as and -no-integrated-as options.

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

14 years agoFix __crashreport_info__ declaration.
Daniel Dunbar [Thu, 20 May 2010 23:50:23 +0000 (23:50 +0000)]
Fix __crashreport_info__ declaration.

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

14 years agoFix a crasher in constructor-initializer reordering warnings (PR7179).
Douglas Gregor [Thu, 20 May 2010 23:49:34 +0000 (23:49 +0000)]
Fix a crasher in constructor-initializer reordering warnings (PR7179).

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

14 years agomake -Wc++-hex-floats be a member of -Wc++0x-compat,
Chris Lattner [Thu, 20 May 2010 23:43:05 +0000 (23:43 +0000)]
make -Wc++-hex-floats be a member of -Wc++0x-compat,
thanks to doug for pointing this out!

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

14 years agoGenerate objc_memmove_collectable write-barrier for
Fariborz Jahanian [Thu, 20 May 2010 23:34:56 +0000 (23:34 +0000)]
Generate objc_memmove_collectable write-barrier for
classes whose base class have GC'able object pointers.

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

14 years agoDon't warn about use of hex floats in c++ mode by default,
Chris Lattner [Thu, 20 May 2010 23:33:51 +0000 (23:33 +0000)]
Don't warn about use of hex floats in c++ mode by default,
matching G++'s behavior.

Warn when -pedantic or -Wc++-hex-floats is passed, and
don't warn if -pedantic -Wno-c++-hex-floats are both passed.

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

14 years agoBe sure to apply initializers to members of anonymous structs and unions
John McCall [Thu, 20 May 2010 23:23:51 +0000 (23:23 +0000)]
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.

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

14 years agoImprove parser recovery when a switch condition is invalid; fixes
Douglas Gregor [Thu, 20 May 2010 23:20:59 +0000 (23:20 +0000)]
Improve parser recovery when a switch condition is invalid; fixes
<rdar://problem/7971948>.

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

14 years agoAdd a new failure kind, FK_Incomplete, to InitializationSequence, to
Douglas Gregor [Thu, 20 May 2010 22:12:02 +0000 (22:12 +0000)]
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>.

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

14 years agoDriver: Switch to using the integrated assembler for standalone assembly jobs
Daniel Dunbar [Thu, 20 May 2010 21:48:38 +0000 (21:48 +0000)]
Driver: Switch to using the integrated assembler for standalone assembly jobs
(or -save-temps), when the integrated assembler is enabled.

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

14 years agoAdds support for generation of objc_memmove_collectable API
Fariborz Jahanian [Thu, 20 May 2010 21:38:57 +0000 (21:38 +0000)]
Adds support for generation of objc_memmove_collectable API
in Objective-C++ mode.

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

14 years agoDriver: Add a tool definition for the Clang integrated assembler.
Daniel Dunbar [Thu, 20 May 2010 21:30:13 +0000 (21:30 +0000)]
Driver: Add a tool definition for the Clang integrated assembler.

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

14 years agoReinstate r104117, Chandler Carruth's change that "[provides] a naming
Douglas Gregor [Thu, 20 May 2010 20:58:56 +0000 (20:58 +0000)]
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.

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

14 years agoMore Objective-C++ GC tests.
Fariborz Jahanian [Thu, 20 May 2010 18:22:28 +0000 (18:22 +0000)]
More Objective-C++ GC tests.

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

14 years agoclang -cc1as: Add -help, -version, and -mllvm support.
Daniel Dunbar [Thu, 20 May 2010 18:15:20 +0000 (18:15 +0000)]
clang -cc1as: Add -help, -version, and -mllvm support.

Also, fix output defaulting to match llvm-mc.

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

14 years agoDriver/MC: Add 'clang -cc1as' integrated assembler tool, currently accepts approximat...
Daniel Dunbar [Thu, 20 May 2010 17:49:16 +0000 (17:49 +0000)]
Driver/MC: Add 'clang -cc1as' integrated assembler tool, currently accepts approximately the same interface as 'llvm-mc'.

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

14 years agoDriver: Move some argument lookup utilities into driver::ArgList.
Daniel Dunbar [Thu, 20 May 2010 16:54:55 +0000 (16:54 +0000)]
Driver: Move some argument lookup utilities into driver::ArgList.

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

14 years agoCopy construction of non-trivial properties must not
Fariborz Jahanian [Thu, 20 May 2010 16:46:55 +0000 (16:46 +0000)]
Copy construction of non-trivial properties must not
be turned into a setter call (fixes radar 8008649).

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

14 years agoPicky, picky
Douglas Gregor [Thu, 20 May 2010 15:48:29 +0000 (15:48 +0000)]
Picky, picky

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

14 years agoFix a thinko
Douglas Gregor [Thu, 20 May 2010 15:47:46 +0000 (15:47 +0000)]
Fix a thinko

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

14 years agoAssert that we do not try to memcpy a non-POD class type in C++. This
Douglas Gregor [Thu, 20 May 2010 15:39:01 +0000 (15:39 +0000)]
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++.

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

14 years agoAdded TemplateArgumentListInfo to FunctionTemplateSpecializationInfo.
Abramo Bagnara [Thu, 20 May 2010 15:32:11 +0000 (15:32 +0000)]
Added TemplateArgumentListInfo to FunctionTemplateSpecializationInfo.

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

14 years agoFix my inability to spell 'continue' and a case where message sends returning non...
David Chisnall [Thu, 20 May 2010 13:45:48 +0000 (13:45 +0000)]
Fix my inability to spell 'continue' and a case where message sends returning non-pointer-sized things were generating invalid IR inside @try blocks.

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

14 years agoRenamed misleading getSourceRange -> getLocalSourceRange and getFullSourceRange ...
Abramo Bagnara [Thu, 20 May 2010 10:00:11 +0000 (10:00 +0000)]
Renamed misleading getSourceRange -> getLocalSourceRange and getFullSourceRange -> getSourceRange for TypeLoc.

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

14 years agoRework our handling of binding a reference to a temporary
Douglas Gregor [Thu, 20 May 2010 08:36:28 +0000 (08:36 +0000)]
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.

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

14 years agoWhoops.
John McCall [Thu, 20 May 2010 07:13:26 +0000 (07:13 +0000)]
Whoops.

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

14 years agoDon't try to check jump scopes in invalid functions. Fixes
John McCall [Thu, 20 May 2010 07:05:55 +0000 (07:05 +0000)]
Don't try to check jump scopes in invalid functions.  Fixes
<rdar://problem/7995494>.

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

14 years agoWhen creating a this-adjustment thunk where the return value is of C++
Douglas Gregor [Thu, 20 May 2010 05:54:35 +0000 (05:54 +0000)]
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.

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

14 years agoAdd libclang function 'clang_isFromMainFile()' (which just wraps SourceManager::isFro...
Ted Kremenek [Thu, 20 May 2010 02:59:19 +0000 (02:59 +0000)]
Add libclang function 'clang_isFromMainFile()' (which just wraps SourceManager::isFromMainFile()).

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

14 years agoRemove accidental commit
Douglas Gregor [Thu, 20 May 2010 02:26:51 +0000 (02:26 +0000)]
Remove accidental commit

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

14 years agoVarious small fixes for construction/destruction of Objective-C++
Douglas Gregor [Thu, 20 May 2010 02:24:22 +0000 (02:24 +0000)]
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

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

14 years agoExpose -fobjc-nonfragile-abi2 as a top-level clang driver option. Fixes <rdar:/...
Ted Kremenek [Thu, 20 May 2010 02:12:37 +0000 (02:12 +0000)]
Expose -fobjc-nonfragile-abi2 as a top-level clang driver option.  Fixes <rdar://problem/8007063>.

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

14 years agoSupport implicitly closing on 'this' in a block. Fixed PR7165.
John McCall [Thu, 20 May 2010 01:18:31 +0000 (01:18 +0000)]
Support implicitly closing on 'this' in a block.  Fixed PR7165.

(the codegen works here, too, but that's annoying to test without execution)

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

14 years agojust add a fixme for the StructuredArgs leak, it shouldn't affect
Chris Lattner [Thu, 20 May 2010 00:26:28 +0000 (00:26 +0000)]
just add a fixme for the StructuredArgs leak, it shouldn't affect
c++'03 code and variadic support "needs work".

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

14 years agoswitch TemplateArgumentListBuilder to hold its flat argument list in a smallvector
Chris Lattner [Thu, 20 May 2010 00:25:36 +0000 (00:25 +0000)]
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.

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

14 years agofix the TemplateArgumentList copy constructor to not
Chris Lattner [Thu, 20 May 2010 00:19:09 +0000 (00:19 +0000)]
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!

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

14 years agoClarify TemplateArgumentList ownership over its "flat" and
Chris Lattner [Thu, 20 May 2010 00:11:47 +0000 (00:11 +0000)]
Clarify TemplateArgumentList ownership over its "flat" and
"structure" arg lists, the first step to fixing some massive
memory leaks.

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

14 years agotweak to (hopefully) fix darwin[89] buildbots. Thanks to Doug for the suggested modif...
Jim Grosbach [Wed, 19 May 2010 23:53:08 +0000 (23:53 +0000)]
tweak to (hopefully) fix darwin[89] buildbots. Thanks to Doug for the suggested modification.

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

14 years agoWhen a conditional operator is an rvalue of class type, we need to
Douglas Gregor [Wed, 19 May 2010 23:40:50 +0000 (23:40 +0000)]
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.

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

14 years agoMore tests for ObjC++ GC support.
Fariborz Jahanian [Wed, 19 May 2010 23:07:54 +0000 (23:07 +0000)]
More tests for ObjC++ GC support.

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

14 years agoMove CXCursor_FirstDecl definition later to make the results more readable in the...
Ted Kremenek [Wed, 19 May 2010 21:51:10 +0000 (21:51 +0000)]
Move CXCursor_FirstDecl definition later to make the results more readable in the debugger.

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

14 years agoAdded basic source locations to Elaborated and DependentName types.
Abramo Bagnara [Wed, 19 May 2010 21:37:53 +0000 (21:37 +0000)]
Added basic source locations to Elaborated and DependentName types.

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