Граф коммитов

21826 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor 94a615718d 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
2010-05-24 17:01:56 +00:00
Douglas Gregor ae65f4bd58 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
2010-05-23 22:10:15 +00:00
Douglas Gregor 88623ade95 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
2010-05-23 21:53:47 +00:00
Douglas Gregor 26d1f75d5b 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
2010-05-23 21:31:22 +00:00
Benjamin Kramer 89cf2e3d9d Add a comment for r104472.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104473 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-23 20:57:46 +00:00
Benjamin Kramer 92b9bd96ce 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
2010-05-23 20:00:44 +00:00
Douglas Gregor a481ec4150 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
2010-05-23 19:57:01 +00:00
Douglas Gregor 9ba6af8bed 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
2010-05-23 19:43:23 +00:00
Douglas Gregor 928e6fcf66 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
2010-05-23 19:36:40 +00:00
Douglas Gregor 5a84dec38c 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
2010-05-23 18:57:34 +00:00
Douglas Gregor 0054531488 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
2010-05-23 18:26:36 +00:00
Anders Carlsson bfcdc40cbc 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
2010-05-23 18:14:24 +00:00
Douglas Gregor db4da82e72 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
2010-05-23 16:51:27 +00:00
Douglas Gregor 715e9c8a39 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
2010-05-23 16:10:32 +00:00
John McCall fa037bd3f7 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
2010-05-22 22:13:32 +00:00
Anders Carlsson a40a9f3121 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
2010-05-22 17:45:10 +00:00
Anders Carlsson 1884eb0b5c Re-land the fix for PR7139.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104446 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-22 17:35:42 +00:00
Douglas Gregor fb2db4657d 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
2010-05-22 17:12:29 +00:00
Douglas Gregor d9008318fe 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
2010-05-22 16:25:05 +00:00
Douglas Gregor 0fddb97901 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
2010-05-22 16:17:30 +00:00
Chris Lattner e229b9dd54 minor updates
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104436 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-22 07:02:06 +00:00
Douglas Gregor 2d6b0e94db 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
2010-05-22 05:17:18 +00:00
Daniel Dunbar 5e30b8bf56 Attempt to make MSVC happy.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104432 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-22 05:05:12 +00:00
Chandler Carruth c304ba341a 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
2010-05-22 02:21:53 +00:00
John McCall ef072fd2f3 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
2010-05-22 01:48:05 +00:00
Daniel Dunbar 9fcbc050a7 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
2010-05-22 00:37:20 +00:00
Daniel Dunbar 3038204fd8 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
2010-05-22 00:37:18 +00:00
Ted Kremenek d7ffd08445 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
2010-05-22 00:06:46 +00:00
Douglas Gregor d5ab9b0a0a 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
2010-05-21 23:43:39 +00:00
Fariborz Jahanian 561da7e046 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
2010-05-21 23:28:58 +00:00
Douglas Gregor 1fd6d44d7c 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
2010-05-21 23:18:07 +00:00
Nick Lewycky db3f847cb8 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
2010-05-21 23:14:51 +00:00
Anders Carlsson 892fa6c5e1 Unbreak self-host.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104390 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 22:17:48 +00:00
Ted Kremenek d775c66b3a 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
2010-05-21 21:57:00 +00:00
Ted Kremenek 8f326751df 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
2010-05-21 21:56:53 +00:00
Anders Carlsson db9b12e32c 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
2010-05-21 21:45:41 +00:00
Douglas Gregor b212d9a8e1 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
2010-05-21 21:25:08 +00:00
Chris Lattner d3573f0932 down with export.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104383 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 21:16:21 +00:00
Abramo Bagnara e4aec0eae3 Improved TypeLoc::getSourceRange().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104382 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 21:12:12 +00:00
Chris Lattner a4b46ccb04 another unneeded line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104379 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 21:02:17 +00:00
Chris Lattner 900e32ddd7 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
2010-05-21 20:59:40 +00:00
John McCall aec0371e62 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
2010-05-21 20:45:30 +00:00
Ted Kremenek 3f64a0e3be 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
2010-05-21 20:30:15 +00:00
Douglas Gregor e0d5fe2a41 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
2010-05-21 20:29:55 +00:00
Chris Lattner 34d7c4d628 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
2010-05-21 20:22:37 +00:00
Benjamin Kramer a5ddbcac1e Try to fix MSVC build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104371 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 19:58:44 +00:00
Douglas Gregor 45d3fe1898 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
2010-05-21 18:36:48 +00:00
Nick Lewycky 74d4031b9a TypeVisitor doesn't visit Stmts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104332 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 18:04:30 +00:00
Douglas Gregor 663218b576 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
2010-05-21 17:55:12 +00:00
Fariborz Jahanian b4eae116b0 Changed test to use FileCheck.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104319 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-21 16:13:37 +00:00