summaryrefslogtreecommitdiffstats
path: root/clang/test/FixIt/fixit-cxx0x.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Give 'fixit-cxx0x.cpp' a more modern name.Richard Smith2019-05-201-181/+0
| | | | llvm-svn: 361208
* Added a better diagnostic when using the delete operator with lambdasNicolas Lesser2019-05-191-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This adds a new error for missing parentheses around lambdas in delete operators. ``` int main() { delete []() { return new int(); }(); } ``` This will result in: ``` test.cpp:2:3: error: '[]' after delete interpreted as 'delete[]' delete []() { return new int(); }(); ^~~~~~~~~ test.cpp:2:9: note: add parentheses around the lambda delete []() { return new int(); }(); ^ ( ) ``` Reviewers: rsmith Reviewed By: rsmith Subscribers: riccibruno, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D36357 llvm-svn: 361119
* [c++2a] Implement P0409R2 - Allow lambda capture [=,this] (by hamzasood)Faisal Vali2017-08-191-1/+0
| | | | | | | | | | This patch, by hamzasood, implements P0409R2, and allows [=, this] pre-C++2a as an extension (with appropriate warnings) for consistency. https://reviews.llvm.org/D36572 Thanks Hamza! llvm-svn: 311224
* Diagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit ↵Ehsan Akhgari2015-03-251-1/+9
| | | | | | | | | | | | | | hints Summary: Follow-up to the fix of PR22075. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7012 llvm-svn: 233161
* Diagnose declspecs occuring after virt-specifier-seq and generate fixit hintsEhsan Akhgari2015-03-251-0/+11
| | | | | | | | | | | | Summary: This fixes PR22075. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6828 llvm-svn: 233160
* Revert "Diagnose declspecs occuring after virt-specifier-seq and generate ↵Ehsan Akhgari2015-03-241-11/+0
| | | | | | | | fixit hints" This reverts commit 2131e63e2fdff7c831ab3bfe31facf2e3ebab03d. llvm-svn: 233074
* Revert "Diagnose ref-qualifiers occuring after virt-specifier-seq and ↵Ehsan Akhgari2015-03-241-9/+1
| | | | | | | | generate fixit hints" This reverts commit 49079d45966a3f57cd82edb35bde2e8e88fccf40. llvm-svn: 233073
* Diagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit ↵Ehsan Akhgari2015-03-241-1/+9
| | | | | | | | | | | | | | hints Summary: Follow-up to the fix of PR22075. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7012 llvm-svn: 233070
* Diagnose declspecs occuring after virt-specifier-seq and generate fixit hintsEhsan Akhgari2015-03-241-0/+11
| | | | | | | | | | | | Summary: This fixes PR22075. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6828 llvm-svn: 233069
* Revert r218925 - "Patch to warn if 'override' is missing"Alexander Potapenko2014-10-031-2/+2
| | | | | | | | | | | | | | | | | | | | This CL has caused bootstrap failures on Linux and OSX buildbots running with -Werror. Example report from http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/13183/steps/bootstrap%20clang/logs/stdio: ================================================================ [ 91%] Building CXX object tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/ShowEnabledWarnings.cpp.o In file included from /home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/lib/Target/R600/AMDGPUISelDAGToDAG.cpp:20: In file included from /home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/lib/Target/R600/SIISelLowering.h:19: /home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/lib/Target/R600/SIInstrInfo.h:71:8: error: 'getLdStBaseRegImmOfs' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override] bool getLdStBaseRegImmOfs(MachineInstr *LdSt, ^ /home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/include/llvm/Target/TargetInstrInfo.h:815:16: note: overridden virtual function is here virtual bool getLdStBaseRegImmOfs(MachineInstr *LdSt, ^ ================================================================ llvm-svn: 218969
* Patch to warn if 'override' is missingFariborz Jahanian2014-10-021-2/+2
| | | | | | | | | | | | for an overriding method if class has at least one 'override' specified on one of its methods. Reviewed by Doug Gregor. rdar://18295240 (I have already checked in all llvm files with missing 'override' methods and Bob Wilson has fixed a TableGen of FastISel so no warnings are expected from build of llvm after this patch. I have already verified this). llvm-svn: 218925
* PR11306 - Variadic template fix-it suggestion. Recover from misplaced or ↵Nikola Smiljanic2014-06-061-0/+20
| | | | | | redundant ellipsis in parameter pack. llvm-svn: 210304
* PR19415: Converting 'constexpr' to 'const' in a non-static data member can failRichard Smith2014-04-141-1/+2
| | | | | | if the member is already 'const'. Don't assert in that case. llvm-svn: 206205
* Add -Wdeprecated warnings and fixits for things deprecated in C++11:Richard Smith2013-06-131-0/+5
| | | | | | | | | - 'register' storage class - dynamic exception specifications Only the former check is enabled by default for now (the latter might be quite noisy). llvm-svn: 183881
* PR15311: Finish implementation of the suggested resolution of core issue 1488,Richard Smith2013-02-201-1/+1
| | | | | | | | which allows grouping parens in an abstract-pack-declarator. This was already mostly implemented, but missed some cases. Add an ExtWarn for use of this extension until CWG ratifies it. llvm-svn: 175660
* Provide a fixit for constexpr non-static data members.David Blaikie2013-01-301-0/+12
| | | | | | | | | | | | | | | | If the member has an initializer, assume it was probably intended to be static and suggest/recover with that. If the member doesn't have an initializer, assume it was probably intended to be const instead of constexpr and suggest that. (if the attempt to apply these changes fails, don't make any suggestion & produce the same diagnostic experience as before. The only case where this can come up that I know of is with a mutable constexpr with an initializer, since mutable is incompatible with static (but it's already incompatible with const anyway)) llvm-svn: 173873
* DR1473: Do not require a space between operator"" and the ud-suffix in aRichard Smith2012-10-201-2/+0
| | | | | | literal-operator-id. llvm-svn: 166373
* Extend the "expected ';' after struct" logic to also apply to enums, and toRichard Smith2012-06-251-0/+14
| | | | | | struct and enum forward-declarations. llvm-svn: 159164
* Implement support for null non-type template arguments for non-typeDouglas Gregor2012-04-061-0/+4
| | | | | | | template parameters of pointer, pointer-to-member, or nullptr_t type in C++11. Fixes PR9700 / <rdar://problem/11193097>. llvm-svn: 154219
* Fix diagnostic text for r154163.David Blaikie2012-04-061-2/+2
| | | | llvm-svn: 154164
* Restrict fixit for missing 'class' in template template parameters.David Blaikie2012-04-061-0/+4
| | | | | | | | | | | Based on Doug's feedback to r153887 this omits the FixIt if the following token isn't syntactically valid for the context. (not a comma, '...', identifier, '>', or '>>') There's a bunch of work to handle the '>>' case, but it makes for a much more pleasant diagnostic in this case. llvm-svn: 154163
* Reject 'template<typename...Ts> void f(Ts ...(x));'. Add a special-caseRichard Smith2012-03-291-0/+23
| | | | | | | diagnostic and a fix-it to explain to the user where the ellipsis is supposed to go. llvm-svn: 153622
* Fix a couple of issues with literal-operator-id parsing, and provide recoveryRichard Smith2012-03-081-0/+12
| | | | | | | | | | | | for a few kinds of error. Specifically: Since we're after translation phase 6, the "" token might be formed by multiple source-level string literals. Checking the token width is not a correct way of detecting empty string literals, due to escaped newlines. Diagnose and recover from a missing space between "" and suffix, and from string literals other than "", which are followed by a suffix. llvm-svn: 152348
* Implement C++11 [lex.ext]p10 for string and character literals: a ud-suffix notRichard Smith2012-03-081-0/+5
| | | | | | | | | | | | | | | | | | starting with an underscore is ill-formed. Since this rule rejects programs that were using <inttypes.h>'s macros, recover from this error by treating the ud-suffix as a separate preprocessing-token, with a DefaultError ExtWarn. The approach of treating such cases as two tokens is under discussion for standardization, but is in any case a conforming extension and allows existing codebases to keep building while the committee makes up its mind. Reword the warning on the definition of literal operators not starting with underscores (which are, strangely, legal) to more explicitly state that such operators can't be called by literals. Remove the special-case diagnostic for hexfloats, since it was both triggering in the wrong cases and incorrect. llvm-svn: 152287
* Tests for the fixits which Doug added in r150727.Richard Smith2012-02-171-0/+2
| | | | llvm-svn: 150777
* Allow implicit capture of 'this' in a lambda even when the captureDouglas Gregor2012-02-101-0/+12
| | | | | | | | | | | | default is '=', and reword the warning about explicitly capturing 'this' in such lambdas to indicate that only explicit capture is banned. Introduce Fix-Its for this and other "save the programmer from themself" rules regarding what can be explicitly captured and what must be implicitly captured. llvm-svn: 150256
* Update C++11 scoped enumeration support to match the final proposal:Richard Smith2012-01-101-0/+9
| | | | | | | | - reject definitions of enums within friend declarations - require 'enum', not 'enum class', for non-declaring references to scoped enumerations llvm-svn: 147824
* Extend the diagnostic for a ',' at the end of a declaration where a ';' wasRichard Smith2012-01-091-0/+14
| | | | | | intended to cover C++ class definitions. llvm-svn: 147808
* Fix constexpr handling to allow 'extern constexpr' variable declarations. We noRichard Smith2011-12-251-35/+0
| | | | | | | longer have access to the source locations we need to produce the 'replace constexpr with const' fixits, so they're gone for now. llvm-svn: 147273
* Revert most of r145372 for now. Lookahead beyond the ';' in a functionRichard Smith2011-11-301-23/+0
| | | | | | | | | declaration tickles a bug in the way we handle visibility pragmas. The improvement to error recovery for template function definitions declared with the 'typedef' specifier in r145372 is unrelated and not reverted here. llvm-svn: 145541
* PR10101: Recover better from a common copy-paste error: if a functionRichard Smith2011-11-291-0/+23
| | | | | | | | declaration at namespace scope is followed by a semicolon and an open-brace (or in C++, a 'try', ':' or '='), then the error is probably a function definition with a spurious ';', rather than a mysterious '{'. llvm-svn: 145372
* Improve the diagnostic when a comma ends up at the end of a declarator groupRichard Smith2011-10-191-0/+6
| | | | | | | | | instead of a semicolon (as sometimes happens during refactorings). When such a comma is seen at the end of a line, and is followed by something which can't possibly be a declarator (or even something which might be a plausible typo for a declarator), suggest that a semicolon was intended. llvm-svn: 142544
* Update all tests other than Driver/std.cpp to use -std=c++11 rather thanRichard Smith2011-10-131-3/+3
| | | | | | -std=c++0x. Patch by Ahmed Charles! llvm-svn: 141900
* Remove FIXME obsoleted by change r141279 for PR11067.Richard Smith2011-10-071-5/+0
| | | | llvm-svn: 141351
* Mark the ExtWarn for in-class initialization of static const float members ↵Richard Smith2011-09-291-4/+2
| | | | | | as a GNU extension. Don't extend the scope of this extension to all literal types in C++0x mode. llvm-svn: 140820
* constexpr: semantic checking for constexpr variables.Richard Smith2011-09-291-1/+43
| | | | | | We had an extension which allowed const static class members of floating-point type to have in-class initializers, 'as a C++0x extension'. However, C++0x does not allow this. The extension has been kept, and extended to all literal types in C++0x mode (with a fixit to add the 'constexpr' specifier). llvm-svn: 140801
* PR10867: Work around a bug in lit. Multiple RUN: lines are joined with &&, so:Richard Smith2011-09-061-1/+1
| | | | | | | | | | | | | | | | | RUN: foo RUN: bar || true is equivalent to: RUN: foo && bar || true which is equivalent to: RUN: (foo && bar) || true This resulted in several of the fixit tests not really testing anything. llvm-svn: 139132
* Fixed test case asserts due to checkin of r130710.Chad Rosier2011-05-021-1/+1
| | | | llvm-svn: 130720
* Support for C++11 (non-template) alias declarations.Richard Smith2011-04-151-0/+3
| | | | llvm-svn: 129567
* Teach clang -fixit to modify files in-place, or -fixit=suffix to create newNick Lewycky2010-04-241-4/+6
| | | | | | files with the additional suffix in the middle. llvm-svn: 102230
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Implement conversion from a switch condition with class type to anDouglas Gregor2009-11-231-0/+14
integral or enumeration type (vi user-defined conversions). Fixes PR5518. llvm-svn: 89655
OpenPOWER on IntegriCloud