Commit Graph

1534 Commits

Author SHA1 Message Date
Aaron Ballman dd69ef38db C++1y is now C++14!
Changes diagnostic options, language standard options, diagnostic identifiers, diagnostic wording to use c++14 instead of c++1y. It also modifies related test cases to use the updated diagnostic wording.

llvm-svn: 215982
2014-08-19 15:55:55 +00:00
Richard Smith 36ee9fb219 Reject varargs '...' in function prototype if there are more parameters after
it. Diagnose with recovery if it appears after a function parameter that was
obviously supposed to be a parameter pack. Otherwise, warn if it immediately
follows a function parameter pack, because the user most likely didn't intend
to write a parameter pack followed by a C-style varargs ellipsis.

This warning can be syntactically disabled by using ", ..." instead of "...".

llvm-svn: 215408
2014-08-11 23:30:23 +00:00
David Majnemer 742424339a Sema: Disallow taking the address of a bitfield coming from preincrement
Clang forgot that '++s.m' was a bitfield l-value and permit it's address
to be taken; this would crash at CodeGen-time.

Instead, propagate the object-kind when we see the prefix
increment/decrement.

This fixes PR20496.

Differential Revision: http://reviews.llvm.org/D4733

llvm-svn: 214386
2014-07-31 04:52:13 +00:00
Aaron Ballman 31f42318d8 Improving the "integer constant too large" diagnostics based on post-commit feedback from Richard Smith. Amends r213657.
llvm-svn: 213865
2014-07-24 14:51:23 +00:00
Nico Weber 9386c82d56 Improve diagnostic on default-initializing const variables (PR20208).
This tweaks the diagnostic wording slighly, and adds a fixit on a note.
An alternative would be to add the fixit directly on the diagnostic, see
the review thread linked to from the bug for a few notes on that approach.

llvm-svn: 213725
2014-07-23 05:16:10 +00:00
Aaron Ballman 446867ee4e Provide extra information in the "integer constant is too large" diagnostic. This will be used to improve other diagnostics.
llvm-svn: 213657
2014-07-22 14:08:09 +00:00
Hal Finkel a2347baaec Mark C++ reference parameters as dereferenceable
Because references must be initialized using some evaluated expression, they
must point to something, and a callee can assume the reference parameter is
dereferenceable. Taking advantage of a new attribute just added to LLVM, mark
them as such.

Because dereferenceability in addrspace(0) implies nonnull in the backend, we
don't need both attributes. However, we need to know the size of the object to
use the dereferenceable attribute, so for incomplete types we still emit only
nonnull.

llvm-svn: 213386
2014-07-18 15:52:10 +00:00
Alp Toker a3c494f0db Revert "clang/test/Driver/crash-report.c: This requires rewriter for -frewrite-includes. [PR20321]"
We've decided to make the core rewriter class and PP rewriters mandatory.
They're only a few hundred lines of code in total and not worth supporting as a
distinct build configuration, especially since doing so disables key compiler
features.

This reverts commit r213150.

Revert "clang/test: Introduce the feature "rewriter" for --enable-clang-rewriter."

This reverts commit r213148.

Revert "Move clang/test/Frontend/rewrite-*.c to clang/test/Frontend/Rewriter/"

This reverts commit r213146.

llvm-svn: 213159
2014-07-16 15:12:48 +00:00
NAKAMURA Takumi 692d6bb544 clang/test: Introduce the feature "rewriter" for --enable-clang-rewriter.
llvm-svn: 213148
2014-07-16 13:36:39 +00:00
Alp Toker 70fc29ca86 Don't accept qualified 'int' main return types in C++ or standard C mode
C++ [basic.start.main]p1: "It shall have a return type of type int"

ISO C is also clear about this, so only accept 'int' with qualifiers in GNUMode
C.

llvm-svn: 212171
2014-07-02 07:07:20 +00:00
Richard Smith 3e79a57a6d Add missing "non-constant" diagnostic for a member call on a temporary of
non-literal class type.

llvm-svn: 210696
2014-06-11 19:53:12 +00:00
Richard Smith 454a7cdfb3 Implement DR990 and DR1070. Aggregate initialization initializes uninitialized
elements from {}, rather than value-initializing them. This permits calling an
initializer-list constructor or constructing a std::initializer_list object.
(It would also permit initializing a const reference or rvalue reference if
that weren't explicitly prohibited by other rules.)

llvm-svn: 210091
2014-06-03 08:26:00 +00:00
Nikola Smiljanic b226964e25 List DR532 as implemented on the defect report status page by renaming the namespace.
llvm-svn: 210080
2014-06-03 07:06:20 +00:00
Nikola Smiljanic b8f8099895 Move DR532 test where it belongs.
llvm-svn: 210064
2014-06-03 02:56:59 +00:00
Aaron Ballman 9ef622e5bf The exception-declaration for a function-try-block cannot redeclare a
function parameter. One of our existing test cases was XFAILed because
of this. This fixes the issue and un-XFAILs the test.

llvm-svn: 210026
2014-06-02 13:10:07 +00:00
Alp Toker 7f02e53f5a Revert "Fix the undefined-but-used odr-use marker (DR48)"
Wrong patch got committed (this one isn't ready for prime time).

This reverts commit r209996.

llvm-svn: 209997
2014-06-01 19:13:44 +00:00
Alp Toker 71c53d472f Fix the undefined-but-used odr-use marker (DR48)
We should treat tentative definitions as undefined for the purpose of
ODR-use linkage checking.

This broke somewhere around r149731 when tests were disabled.

Note that test coverage for these diagnostics is generally lacking due to a
separate issue (PR19910: Don't suppress unused/undefined warnings when there
are errors).

llvm-svn: 209996
2014-06-01 18:49:32 +00:00
Nikola Smiljanic 4461de208a PR12961 - Extend DR532 to cover C++98/03.
llvm-svn: 209955
2014-05-31 02:10:59 +00:00
Aaron Ballman f00500bc8e This test is no longer relevant. It is covered already by [basic.scope.pdecl]p10, and our current test for that is more thorough (though our test is named p9.cpp).
llvm-svn: 209892
2014-05-30 13:17:17 +00:00
Aaron Ballman 3e44a7fa52 This test should no longer be XFAILed; the standard has stabilized, and the test contents are acceptable. No diagnostics expected from this test.
llvm-svn: 209891
2014-05-30 13:09:38 +00:00
Alp Toker 6cfe412e6e Test requires exceptions
It's still XFAIL, but slightly closer to passing.

llvm-svn: 209729
2014-05-28 12:20:23 +00:00
Nick Lewycky 9b46eb8112 Add 'nonnull' parameter or return attribute when producing an llvm pointer type in a function type where the C++ type is a reference. Update the tests.
llvm-svn: 209723
2014-05-28 09:56:42 +00:00
Aaron Ballman 5a1ef6b411 Rejecting the mutable specifier on a freestanding type declaration, instead of supporting it as a "extension" (which serves no purpose). Un-XFAILing the test for mutable specifiers.
llvm-svn: 209635
2014-05-26 17:03:54 +00:00
David Majnemer e37a6ce9f7 Sema: Implement DR244
Summary:
Naming the destructor using a typedef-name for the class-name is
well-formed.

This fixes PR19620.

Reviewers: rsmith, doug.gregor

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D3583

llvm-svn: 209319
2014-05-21 20:19:59 +00:00
Eric Christopher c9e2a68905 Clean up language and grammar.
Based on a patch by jfcaron3@gmail.com!
PR19806

llvm-svn: 209215
2014-05-20 17:10:39 +00:00
Aaron Ballman 06c59e2598 This test doesn't need to be XFAILed anywhere; it just needed to be updated to the appropriate diagnostic wording.
llvm-svn: 209140
2014-05-19 16:35:00 +00:00
Richard Smith ec2748a8ad More fixes for isBetterOverloadCandidate not being a strict weak ordering. The
bug was obvious from inspection, figuring out a way to test it was... less so.

llvm-svn: 209060
2014-05-17 04:36:39 +00:00
Richard Smith 6fdeaabda9 Correct incoherent function versus function template partial ordering for conversion operators (the comparison could claim that two conversion operators are both better than each other). Actually implement DR495, rather than passing its test by chance because the declarations happened to be in the "lucky" order.
llvm-svn: 209054
2014-05-17 01:58:45 +00:00
Alp Toker b0869036c1 Tweak diagnostic wording for init list narrowing
The conventional form is '<action> to silence this warning'.

Also call the diagnostic an 'issue' rather than a 'message' because the latter
term is more widely used with reference to message expressions.

llvm-svn: 209052
2014-05-17 01:13:18 +00:00
Richard Smith 082b0035b9 PR19742: cv-qualifiers and ref-qualifiers aren't allowed on functions within
pointer and reference types, even if those types are produced by template
instantiation.

llvm-svn: 208825
2014-05-14 23:23:27 +00:00
NAKAMURA Takumi 0104b759d5 clang/test/CXX/drs/dr4xx.cpp: Use env(1) to satisfy lit internal runner.
llvm-svn: 208532
2014-05-12 10:16:20 +00:00
Kostya Serebryany e0156bf1cd disable asan's detect_stack_use_after_return when running CXX/drs/dr4xx.cpp (temporary workaround for PR19722); This should make the asan bootstrap bot green again
llvm-svn: 208521
2014-05-12 07:05:16 +00:00
David Majnemer a2245271af Revert "Sema: Implement DR244"
This was accidentally committed.

This reverts commit r207892.

llvm-svn: 207893
2014-05-03 02:22:11 +00:00
David Majnemer 22fcb08357 Sema: Implement DR244
Naming the destructor using a typedef-name for the class-name is
well-formed.

This fixes PR19620.

llvm-svn: 207892
2014-05-03 02:18:46 +00:00
David Majnemer deca705593 Sema: Implement DR477
Summary: Friend declarations shouldn't mention explicit or virtual.

Reviewers: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D3562

llvm-svn: 207682
2014-04-30 18:24:01 +00:00
David Majnemer 27d69dbbd0 CodeGen: Fix linkage of reference temporaries
Summary:
A reference temporary should inherit the linkage of the variable it
initializes.  Otherwise, we may hit cases where a reference temporary
wouldn't have the same value in all translation units.

Reviewers: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D3515

llvm-svn: 207451
2014-04-28 22:17:59 +00:00
Richard Smith 0d963d6c49 Don't emit an ExtWarn on declarations of variable template specializations;
we'll already have issued the relevant diagnostic when we saw the declaration
of the primary template.

llvm-svn: 206441
2014-04-17 02:56:49 +00:00
Richard Smith 100b24abc5 Implement [over.match.oper]p3 properly, by filtering the non-candidates out
when building the candidate set, rather than trying to contort name lookup into
handling this.

llvm-svn: 206436
2014-04-17 01:52:14 +00:00
Richard Smith 688866ba3e PR19452: Implement more of [over.match.oper]p3's restrictions on which non-member overloaded operators can be found when no operand is of class type. We used to fail to implement this rule if there was an operand of dependent type.
llvm-svn: 206435
2014-04-17 01:12:17 +00:00
Richard Smith c7f9bb1757 Tests for DR501-525.
llvm-svn: 206123
2014-04-13 00:40:32 +00:00
Richard Smith 6c6bbfab19 PR19346: Adding 0 to a null pointer has defined behavior in C++. Allow it in constant expressions.
llvm-svn: 205757
2014-04-08 12:19:28 +00:00
Richard Smith 7ad0b88396 If a using-declaration names a class member, but appears outside a class, try
to suggest a different syntax to get the same effect.

llvm-svn: 205467
2014-04-02 21:44:35 +00:00
David Blaikie abe1a398e3 Render anonymous entities as '(anonymous <thing>)' (and lambdas as '(lambda at ... )')
For namespaces, this is consistent with mangling and GCC's debug info
behavior. For structs, GCC uses <anonymous struct> but we prefer
consistency between all anonymous entities but don't want to confuse
them with template arguments, etc, so we'll just go with parens in all
cases.

llvm-svn: 205398
2014-04-02 05:58:29 +00:00
Richard Smith 651512995e More tests for DR1.
llvm-svn: 205339
2014-04-01 18:32:16 +00:00
Richard Smith 5557f6d678 Add failing testcase for DR305. Looks like we didn't implement the resolution
here in the simple-template-id case.

llvm-svn: 205273
2014-04-01 01:58:11 +00:00
David Majnemer ee4f4025c3 Sema: Implement DR317
Summary:
Declaring a function as inline after it has been defined is in violation
of [dcl.fct.spec]p4.  The program would get a strong definition instead
of getting a function with linkonce_odr linkage.

Reviewers: rsmith

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3220

llvm-svn: 205129
2014-03-30 06:44:54 +00:00
Richard Smith 6190ee65e1 Tests for dr475-dr500.
llvm-svn: 205127
2014-03-30 06:05:29 +00:00
Richard Smith dc4ccaaf66 PR19252: Fix crash if alignas is used with an auto-typed variable. Don't check
the type of the variable until it's known.

llvm-svn: 204887
2014-03-27 01:22:48 +00:00
Richard Smith 17710217fa Tests for DR450-475.
llvm-svn: 204217
2014-03-19 08:04:12 +00:00
Yunzhong Gao fcdc45ff2d Creating a printing policy for "half":
Since "half" is an OpenCL keyword and clang accepts __fp16 as an extension for
other languages, error messages and metadata (and hence debug info) should refer
to the half-precision floating point as "__fp16" instead of "half" when
compiling for non-OpenCL languages. This patch creates a new printing policy for
half in a similar manner to what is done for bool and wchar_t.

Differential Revision: http://llvm-reviews.chandlerc.com/D2952

llvm-svn: 204164
2014-03-18 17:55:18 +00:00