Commit Graph

9634 Commits

Author SHA1 Message Date
Rafael Espindola be468d9a2b revert r123977 and r123978 to fix PR9026.
llvm-svn: 124033
2011-01-22 15:32:35 +00:00
Anders Carlsson e973899f46 A member function template cannot be virtual.
llvm-svn: 124031
2011-01-22 14:43:56 +00:00
John McCall 0140bfeead Improve our parse recovery on 'case blah;' and 'default;'.
llvm-svn: 124025
2011-01-22 09:28:32 +00:00
Douglas Gregor c1ed20cfba Update const_cast semantics for rvalue references. Add tests for
reinterpret_cast and const_cast using rvalue references.

llvm-svn: 124007
2011-01-22 00:19:52 +00:00
Douglas Gregor 465184ae10 Teach static_cast and dynamic_cast about rvalue references.
llvm-svn: 124006
2011-01-22 00:06:57 +00:00
Douglas Gregor 3f9047e321 Add a test for "perfect" forwarding
llvm-svn: 124005
2011-01-21 22:52:47 +00:00
Ted Kremenek 33d4b5eb66 Provide -Wuninitialized-experimental fixits
for floats, and also check if 'nil' is declared
when suggesting it for initializing ObjC pointers.

llvm-svn: 124004
2011-01-21 22:49:49 +00:00
Douglas Gregor c74edc272e When throwing an elidable object, first try to treat the subexpression
as an rvalue per C++0x [class.copy]p33. If that fails, try again with
the original subexpression.

llvm-svn: 124002
2011-01-21 22:46:35 +00:00
Ted Kremenek 2959fdd087 Add basic fixits for -Wuninitialized-experimental
to suggest initializations for pointer and
ObjC pointer types.

llvm-svn: 123995
2011-01-21 19:41:46 +00:00
Ted Kremenek 39fa056342 Enhance -Wuninitialized-experimental diagnostics
to issue the warning at an uninitialized variable's
declaration, but to issue notes at possible
uninitialized uses (which could be multiple).

llvm-svn: 123994
2011-01-21 19:41:41 +00:00
Douglas Gregor f282a76fab Implement the preference for move-construction over copy-construction
when returning an NRVO candidate expression. For example, this
properly picks the move constructor when dealing with code such as

  MoveOnlyType f() { MoveOnlyType mot; return mot; }

The previously-XFAIL'd rvalue-references test case now works, and has
been moved into the appropriate paragraph-specific test case.

llvm-svn: 123992
2011-01-21 19:38:21 +00:00
Douglas Gregor 5d36900d7a Promote the static getNRVOCandidate() function, which computed the
NRVO candidate for a return statement, to
Sema::getCopyElisionCandidate(), and teach it enough to also determine
the NRVO candidate for a throw expression. We still don't use the
latter information, however.

Along the way, implement core issue 1148, which eliminates copy
elision from catch parameters and clarifies that copy elision cannot
occur from function parameters (which we already implemented).

llvm-svn: 123982
2011-01-21 18:05:27 +00:00
Douglas Gregor 6381402fe1 Implement core issue 1164, which concerns the partial ordering of
f(T&) and f(T&&).

llvm-svn: 123981
2011-01-21 17:29:42 +00:00
Douglas Gregor bf2f961a35 Add unique_ptr example to test the use of rvalue references. I'll grow
this example further as more rvalue-reference features come online.

llvm-svn: 123980
2011-01-21 17:06:29 +00:00
Douglas Gregor cc73795cd8 Add test for overload resolution's preference for binding an rvalue
reference to an rvalue rather than binding a const-qualified lvalue
reference to that rvalue.

llvm-svn: 123979
2011-01-21 16:48:38 +00:00
Douglas Gregor 95273c3a22 Update the reference-binding implementation used for overload
resolution to match the latest C++0x working paper's semantics. The
implementation now matching up with the reference-binding
implementation used for initialization.

llvm-svn: 123977
2011-01-21 16:36:05 +00:00
Douglas Gregor 4edf1c8968 More testing to C++0x [temp.deduct.call]p3
llvm-svn: 123967
2011-01-21 05:24:25 +00:00
Douglas Gregor cba72b1f62 Implement the special template argument deduction rule for T&& in a
call (C++0x [temp.deduct.call]p3).

As part of this, start improving the reference-binding implementation
used in the computation of implicit conversion sequences (for overload
resolution) to reflect C++0x semantics. It still needs more work and
testing, of course.

llvm-svn: 123966
2011-01-21 05:18:22 +00:00
Douglas Gregor 9b175e0512 Add more reference-binding examples from the C++0x working paper, all of which seem to be working fine
llvm-svn: 123955
2011-01-21 01:11:43 +00:00
Fariborz Jahanian 252a47f635 Move cheking of kext into canDevirtualizeMemberFunctionCalls().
Improve on test case. Per Doug's comment. wip.

llvm-svn: 123954
2011-01-21 01:04:41 +00:00
Douglas Gregor bed28f7629 Improve the diagnostic that complains about binding an rvalue
reference to an lvalue.

llvm-svn: 123953
2011-01-21 01:04:33 +00:00
Douglas Gregor 24f2e8ec00 More work to bring reference binding up to the latest C++0x
specification. In particular, an rvalue reference can bind to an
initializer expression that is an lvalue if the referent type and the
initializer expression type are not reference-related. This is a newer
formulation to the previous "rvalue references can never bind to
lvalues" rule.

llvm-svn: 123952
2011-01-21 00:52:42 +00:00
Douglas Gregor d412fe598b When performing reference binding via a conversion function, perform
type checking based on the actual reference type we're trying to bind
the result to, rather than stripping the reference.

llvm-svn: 123950
2011-01-21 00:27:08 +00:00
Ted Kremenek cdca8fa97d Relax CFG assertions in UninitializedValuesV2 when
handling pseudo-path sensitivity, and instead
use those assertion conditions as dynamic checks.
These assertions would be violated when analyzing
a CFG where some branches where optimized away
during CFG construction because their branch
conditions could be trivially determined.

llvm-svn: 123943
2011-01-20 21:25:31 +00:00
Ted Kremenek 18f4a755a3 Add test case for <rdar://problem/8891119>. In
earlier revisions Clang was incorrectly warning
about an incomplete @implementation when a property
was getting synthesized.  This got fixed somewhere
down the line.

llvm-svn: 123939
2011-01-20 19:45:14 +00:00
Ted Kremenek b82ddd6ada Add rudimentary path-sensitivity to UnintializedValuesV2
analysis for short-circuited operations.  For branch written like "if (x && y)",
we maintain two sets of dataflow values for the outgoing
branches.  This suppresses some common false positives
for -Wuninitialized-experimental.

This change introduces some assertion failures
when running on the LLVM codebase.  WIP.

llvm-svn: 123923
2011-01-20 17:37:17 +00:00
Fariborz Jahanian 47609b088c apple kext abi requires all vf calls, including qualified
vf calls, be made indirect. This patch is towards that goal.

llvm-svn: 123922
2011-01-20 17:19:02 +00:00
Ted Kremenek a1ec4f39f4 Enhance AnalysisConsumer to also visit functions
and methods defined within 'namespace X { ... }'.

llvm-svn: 123921
2011-01-20 17:09:48 +00:00
Douglas Gregor 56d7eae857 More tests for reference binding in the presence of rvalue
references. Note that we're currently failing reference binding to a
function lvalue.

llvm-svn: 123920
2011-01-20 17:04:36 +00:00
Douglas Gregor 92e460e909 Start refactoring reference binding to more closely match the C++0x
working paper's structure. The only functional change here is that we
now handling binding to array rvalues, which we would previously reject.

llvm-svn: 123918
2011-01-20 16:44:54 +00:00
Anders Carlsson 3f610c75de Diagnose when a virtual member function marked final is overridden.
llvm-svn: 123916
2011-01-20 16:25:36 +00:00
Rafael Espindola ec4b30a1e8 Merge test.
llvm-svn: 123914
2011-01-20 16:11:21 +00:00
Douglas Gregor 7a2a116bab Add some tests for reference-collapsing and referencing binding
involving rvalue references, to start scoping out what is and what
isn't implemented. In the process, tweak some standards citations,
type desugaring, and teach the tentative parser about && in
ptr-operator.

llvm-svn: 123913
2011-01-20 16:08:06 +00:00
John McCall 4e81961a1e Fix the computation of alignment for fields of packed+aligned structs.
Part of the fix for PR8413.

llvm-svn: 123904
2011-01-20 07:57:12 +00:00
Anders Carlsson 7c812f5a99 When instantiating member functions, propagate whether the member function is marked 'final' and 'override'.
Also, call CheckOverrideControl when instantiating member functions.

llvm-svn: 123900
2011-01-20 06:52:44 +00:00
Anders Carlsson fa8e5d3d67 When checking for functions marked override, ignore dependent contexts.
llvm-svn: 123894
2011-01-20 06:33:26 +00:00
Anders Carlsson fd83553733 Diagnose virtual member functions marked override but not overriding any virtual member functions.
llvm-svn: 123888
2011-01-20 05:57:14 +00:00
Anders Carlsson b4801436d1 Fix tests to be valid.
llvm-svn: 123887
2011-01-20 05:55:43 +00:00
Anders Carlsson 725987b034 Change the parser error to reflect that virt-specifiers are allowed on any class member.
llvm-svn: 123883
2011-01-20 04:38:09 +00:00
Anders Carlsson 13a69102d7 Only allow virtual member functions to be marked 'override' and 'final'.
llvm-svn: 123882
2011-01-20 04:34:22 +00:00
Anders Carlsson 511315cc55 Add silly test case.
llvm-svn: 123880
2011-01-20 04:07:46 +00:00
Anders Carlsson d802266c6b Add more parser tests for the override control keywords.
llvm-svn: 123875
2011-01-20 03:41:12 +00:00
Rafael Espindola 4b6053a1fe Turns out that the previous commit also fixes this :-)
llvm-svn: 123873
2011-01-20 02:57:51 +00:00
Rafael Espindola 9e976dcce8 Fix PR8884 by skipping transparent contexts. The test is for LikageSpec. I
failed to find a case where an enum context would make a difference, but
found PR9007 on the way.

llvm-svn: 123871
2011-01-20 02:26:24 +00:00
Douglas Gregor 2bbfba0f0c When building a user-defined conversion sequence, keep track of the
declaration that name lookup actually found, so that we can use it for
access checking later on. Fixes <rdar://problem/8876150>.

llvm-svn: 123867
2011-01-20 01:32:05 +00:00
Douglas Gregor 668443efb1 Sema::BuildCXXMemberCallExpr() can fail due to access or ambiguities,
so allow it to propagate the failure outward. Fixes the crashing part
of <rdar://problem/8876150>.

llvm-svn: 123863
2011-01-20 00:18:04 +00:00
Douglas Gregor 6edd977c6f Explicitly track the number of call arguments provided when performing
overload resolution, so that we only use that number of call arguments
for partial ordering. Fixes PR9006, a recent regression.

llvm-svn: 123861
2011-01-19 23:54:39 +00:00
Douglas Gregor 312ab72dbd Eradicate any mention of C++0x concepts.
llvm-svn: 123860
2011-01-19 23:15:20 +00:00
Douglas Gregor eecc6bc388 Variadic templates are fully implemented.
Turn on the __has_feature switch for variadic templates, document
their completion, and put the ExtWarn into the c++0x-extensions
warning group.

llvm-svn: 123854
2011-01-19 22:11:50 +00:00
Douglas Gregor f144f4f5c9 Refactor the dependence computation for DeclRefExpr so that we can
reuse it for BlockDeclRefExpr. Do so, fixing the dependence calculate
for BlockDeclRefExpr.

llvm-svn: 123851
2011-01-19 21:52:31 +00:00