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

39 Коммитов

Автор SHA1 Сообщение Дата
Richard Smith ac71351acd Properly compute triviality for explicitly-defaulted or deleted special members.
Remove pre-standard restriction on explicitly-defaulted copy constructors with
'incorrect' parameter types, and instead just make those special members
non-trivial as the standard requires.

This required making CXXRecordDecl correctly handle classes which have both a
trivial and a non-trivial special member of the same kind.

This also fixes PR13217 by reimplementing DiagnoseNontrivial in terms of the
new triviality computation technology.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169667 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-08 02:53:02 +00:00
Michael Han f64231e9f4 Teach Clang parser to reject C++11 attributes that appertain to declaration specifiers.
We don't support any C++11 attributes that appertain to declaration specifiers so reject 
the attributes in parser until we support them; this also conforms to what g++ 4.8 is doing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167481 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-06 19:34:54 +00:00
Douglas Gregor ccc4f283cf The presence of a user-*declared* constructor makes the default
constructor not user provided (and, therefore, non-trivial). Fixes
<rdar://problem/11736429>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162947 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-30 21:47:37 +00:00
Benjamin Kramer e5e8f4d2db Use the location of the copy assignment when diagnosing classes that are nontrivial because of it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160962 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-30 16:41:40 +00:00
Benjamin Kramer 2cd7f41f4e Fix ambiguity detection in GetBestOverloadCandidateSimple.
When performing the simplistic overload resolution for single-argument methods,
don't check the best overload for ambiguity with itself when the best overload
doesn't happen to be the first one.

Fixes PR13480.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160961 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-30 15:53:26 +00:00
Richard Smith aa5498649c Remove -Wc++98-compat warning for an outrageously-rare circumstance of 'this'
being used in an exception specification in a way which isn't otherwise
ill-formed in C++98: this warning also incorrectly triggered on uses of 'this'
inside thread-safety attributes, and the mechanism required to tell these cases
apart is more complex than can be justified by the (minimal) value of this part
of -Wc++98-compat.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155857 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-30 23:33:33 +00:00
Richard Smith a1366cbab8 PR12224 (sort of): Diagnose inheriting constructor declarations in C++11 mode.
We do not support IRGen for these, and get some parts of the semantic analysis
wrong.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155728 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-27 19:33:05 +00:00
Richard Smith 86e6fdcf1a Two missing -Wc++98-compat warnings, for null pointers as non-type template
arguments, and 'this' in exception-specifications.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155606 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-26 01:51:03 +00:00
Richard Smith 03544fccd1 Add missing -Wc++98-compat warnings for initializer list initializations which
initialize references, create std::initializer_list objects, or call constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155105 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-19 06:58:00 +00:00
Richard Smith b4051e7047 Implement C++11 [temp.arg.nontype]'s permission to use the address of an object
or function with internal linkage as a non-type template argument.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154053 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-04 21:11:30 +00:00
Richard Smith 6c4c36c4ed PR10217: Provide diagnostics explaining why an implicitly-deleted special
member function is deleted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153773 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-30 20:53:28 +00:00
Sebastian Redl ca8937111c Fix the other place where C++98 work for initializer lists was necessary.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153129 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-20 21:24:03 +00:00
Sebastian Redl 3e280b58db Add the missing compatibility warning for braced initializers as default arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153026 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-18 22:25:45 +00:00
Richard Smith 26b75c0731 Improve diagnostics for UCNs referring to control characters and members of the
basic source character set in C++98. Add -Wc++98-compat diagnostics for same in
literals in C++11. Extend such support to cover string literals as well as
character literals, and mark N2170 as done.

This seems too minor to warrant a release note to me. Let me know if you disagree.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152444 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-09 22:27:51 +00:00
Richard Smith 5cc2c6eb67 Lexing support for user-defined literals. Currently these lex as the same token
kinds as the underlying string literals, and we silently drop the ud-suffix;
those issues will be fixed by subsequent patches.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152012 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-05 04:02:15 +00:00
Richard Smith dbe01bb024 Tests for r151508.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151509 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-26 23:49:01 +00:00
Richard Smith d390de9c63 Fix r151443 to only apply C++11's exception for non-static data member access
in cases where we would otherwise disallow the access, and add a -Wc++98-compat
diagnostic for this C++11 feature.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151444 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-25 10:20:59 +00:00
Richard Smith 39304fad1c __decltype is a GNU extension, not a C++11 extension.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151377 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-24 18:10:23 +00:00
Richard Smith b9c64d84ea C++11 allows unions to have static data members. Remove the corresponding
restriction and add some tests.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150721 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-16 20:41:22 +00:00
Sebastian Redl 6dc00f6e98 Proper initializer list support for new expressions and type construct expressions. Array new still missing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150346 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-12 18:41:05 +00:00
Sebastian Redl 56a04287a1 Fix parsing new expressions using init lists. Probably still do the wrong thing in cases involving array new.
Show that many cases using initializer list constructors work, in that they parse and pass semantic analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150316 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-11 23:51:08 +00:00
Eli Friedman dc3b723d35 Stub out the Sema interface for lambda expressions, and change the parser to use it. Unconditionally error on lambda expressions because they don't work in any meaningful way yet.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147515 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-04 02:40:39 +00:00
Richard Smith 0e9e9814a7 Add -Wc++98-compat diagnostics for jumps which bypass initialization of non-POD
but trivially constructible and destructible variables in C++11 mode. Also
incidentally improve the precision of the wording for jump diagnostics in C++98
mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142619 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-20 21:42:12 +00:00
Richard Smith 95aafb2453 Add -Wc++98-compat warning for enumerations in nested name specifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142568 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-20 03:28:47 +00:00
Richard Smith e7d7c39be9 -Wc++98-compat: warn on nontrivial types used in unions and anonymous structs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142541 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-19 20:41:51 +00:00
Richard Smith 83da2e7119 -Wc++98-compat: diagnose if a reference is bound to a prvalue which does not
have an unambiguous accessible copying constructor; this is ill-formed in C++98.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142533 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-19 16:55:56 +00:00
Richard Smith 53e535161d Add a -Wc++98-compat warning for friend functions of class templates which would
be implicitly instantiated (resulting in a redefinition) in C++98.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142468 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-19 00:54:10 +00:00
Richard Smith 77faa365cb -Wc++98-compat: warn if a SFINAE substitution in C++11 suppresses an access
control diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142463 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-19 00:07:01 +00:00
Richard Smith 6b13022fae -Wc++98-compat and -Wc++98-compat-pedantic warnings for Sema, part 2.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142426 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18 21:39:00 +00:00
Richard Smith ebaf0e6ab7 -Wc++98-compat and -Wc++98-compat-pedantic warnings for Sema, part 1.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142419 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-18 20:49:44 +00:00
Richard Smith 841804baff Add -Wc++98-compat warnings for uses of the new keywords 'alignof', 'char16_t',
'char32_t', 'constexpr', 'decltype', 'noexcept', 'nullptr' and 'static_assert'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142302 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 23:06:20 +00:00
Richard Smith 0aa86c0463 Add -Wc++98-compat warning for deduced 'auto' type specifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142057 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-15 05:42:01 +00:00
Richard Smith 7fe6208c3f Implement -Wc++98-compat warnings for the parser.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142056 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-15 05:09:34 +00:00
Richard Smith 661a99690b -Wc++98-compat warnings for the lexer.
This also adds a -Wc++98-compat-pedantic for warning on constructs which would
be diagnosed by -std=c++98 -pedantic (that is, it warns even on C++11 features
which we enable by default, with no warning, in C++98 mode).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142034 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-15 01:18:56 +00:00
Richard Smith 41be673e93 -Wc++98-compat: warn on C++11 attributes and alignas.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141999 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-14 20:48:27 +00:00
Richard Smith 84ef8990b8 Test for r141985.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141998 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-14 20:41:13 +00:00
Jeffrey Yasskin f38eaa4748 Revert the -Wc++98-compat flag because dgregor doesn't like it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141921 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-14 00:04:00 +00:00
Richard Smith 946967806a Convert newly-added test from -std=c++0x to -std=c++11.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141904 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-13 22:45:21 +00:00
Jeffrey Yasskin 48a9d189bb Implement the first piece of a -Wc++98-compat flag so that people can build in
C++11 mode but keep their sources compatible with C++98.  This patch implements
the -Wc++98-compat-variadic-templates sub-flag and -Wc++98-compat to include
it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141898 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-13 22:18:05 +00:00