aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Parser/cxx-class.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-04-14Lit C++11 Compatibility Patch #8Charles Li1-8/+54
24 tests have been updated for C++11 compatibility. llvm-svn: 266387
2015-06-29PR23942: a pure-specifier's integer literal must be spelled '0'Richard Smith1-0/+10
llvm-svn: 241019
2015-05-12Add a new error for unexpected semi-colon before closing delimiter.Richard Trieu1-3/+3
Previously, if a semi-colon is unexpectedly added before a closing ')', ']' or '}', two errors and one note would emitted, and the parsing would get confused to which scope it was in. This change consumes the semi-colon, recovers parsing better, and emits only one error with a fix-it. llvm-svn: 237192
2015-03-29[Parse] Don't crash on ~A::{Benjamin Kramer1-0/+1
Found by clang-fuzz. llvm-svn: 233492
2015-02-02Follow-up to r217302: Don't crash on ~A::A in a postfix expr suffix followed ↵Nico Weber1-0/+5
by '<'. This used to crash, complaining "ObjectType and scope specifier cannot coexist": struct A { } b = b.~A::A <int>; The only other caller of ParseOptionalCXXScopeSpecifier() that passes in a non-empty ObjectType clears the ObjectType of the scope specifier comes back non-empty (see the tok::period case in Parser::ParsePostfixExpressionSuffix()), so do that here too. Found by SLi's bot. llvm-svn: 227781
2015-01-30Follow-up to r217302 and r227555: Don't crash on inline ~A::A() if A is an int.Nico Weber1-0/+15
Even with r227555, this still crashed: struct S { int A; ~A::A() {} }; That's because ParseOptionalCXXScopeSpecifier()'s call to ActOnCXXNestedNameSpecifier() doesn't mark the scope spec as invalid if sema thought it's a good idea to fixit-correct "::" to ":". For the diagnostic improvement done in r217302, we never want :: to be interpreted as :, so fix this by setting ColonSacred to false temporarily. Found by SLi's bot. llvm-svn: 227581
2015-01-30Follow-up to r217302: Don't crash on ~A::A() if A is undeclared.Nico Weber1-0/+2
llvm-svn: 227555
2015-01-15Fix crash-on-invalid and name lookup when recovering from ~X::X() typo.Richard Smith1-2/+8
llvm-svn: 226067
2015-01-13If we don't find a matching ) for a ( in an exception specification, keep ↵Richard Smith1-0/+8
the tokens around so we can diagnose an error rather than silently discarding them. llvm-svn: 225755
2014-09-10Don't crash on access decls with invalid scope specifier, PR20887.Nico Weber1-0/+5
llvm-svn: 217472
2014-09-06Add error, recovery and fixit for "~A::A() {...}".Richard Smith1-0/+14
llvm-svn: 217302
2014-08-27PR20760: Don't assert (and produce better diagnostics) if a default initializerRichard Smith1-0/+11
contains an unmatched closing bracket token. llvm-svn: 216518
2014-08-12Reject virt-specifiers on friend declarations. Give anonymous bitfields aRichard Smith1-0/+10
location so their diagnostics have somewhere to point. llvm-svn: 215416
2014-03-03Improve diagnostics for malformed constructor declarations (where lookup forRichard Smith1-1/+17
the type of the first parameter fails, and it is the only, unnamed, parameter). llvm-svn: 202759
2013-12-09Avoid extra error messages if method definition is inside function.Serge Pavlov1-0/+10
llvm-svn: 196757
2013-03-18Add missing diagnostic for a nested-name-specifier on a free-standing type ↵Richard Smith1-0/+11
definition. Bump some related diagnostics from warning to extension in C++, since they're errors there. Add some missing checks for function specifiers on non-function declarations. llvm-svn: 177335
2012-09-06PR13775: When checking for a tag type being shadowed by some other declaration,Richard Smith1-0/+14
don't trample over the caller's LookupResult in the case where the check fails. llvm-svn: 163281
2012-07-23Add diagnostics for comma at end of enum and for extra semicolon at namespaceRichard Smith1-1/+5
scope to -Wc++11-extensions. Move extra semicolon after member function definition diagnostic out of -pedantic, since C++ allows a single semicolon there. Keep it in -Wextra-semi, though, since it's still questionable. llvm-svn: 160618
2012-05-16Move the warnings for extra semi-colons under -Wextra-semi. Also, addedRichard Trieu1-2/+2
a warning for an extra semi-colon after function definitions. Added logic so that a block of semi-colons on a line will only get one warning instead of a warning for each semi-colon. llvm-svn: 156934
2012-03-29Don't try to parse a malformed parameter list after a constructor or operatorRichard Smith1-5/+4
name as a direct initializer. llvm-svn: 153628
2012-03-27When we see 'Class(X' or 'Class::Class(X' and we suspect that it names aRichard Smith1-0/+24
constructor, but X is not a known typename, check whether the tokens could possibly match the syntax of a declarator before concluding that it isn't a constructor. If it's definitely ill-formed, assume it is a constructor. Empirical evidence suggests that this pattern is much more often a constructor with a typoed (or not-yet-declared) type name than any of the other possibilities, so the extra cost of the check is not expected to be problematic. llvm-svn: 153488
2012-01-21Fix code so that a SkipUntil will ignore semicolons when skipping aRichard Trieu1-0/+7
function body. This keeps the brace count accurate to prevent additional errors. Also, moved the caret from the brace to the function name. Code: class F{ int Foo{ return 1; } }; Fixed error: parameters.cc:1:14: error: function definition does not declare parameters class F{ int Foo{ return 1; } }; ^ 1 error generated. Old errors: parameters.cc:1:17: error: function definition does not declare parameters class F{ int Foo{ return 1; } }; ^ parameters.cc:1:30: error: expected ';' after class class F{ int Foo{ return 1; } }; ^ ; parameters.cc:1:31: error: expected external declaration class F{ int Foo{ return 1; } }; ^ 3 errors generated. llvm-svn: 148621
2011-10-13Fix crash-on-invalid, improve error recovery, and test coverage for missing ↵David Blaikie1-0/+17
colon after access specifiers in C++ llvm-svn: 141852
2011-01-19Parse the optional semicolon after a C++ in-class member functionDouglas Gregor1-2/+6
definition, rather than complaining about it. Problem reported by Marshall Clow. llvm-svn: 123835
2010-07-13Complain when an unnamed enumeration has no enumerations (inDouglas Gregor1-1/+1
C++). Fixes PR7466. llvm-svn: 108231
2010-04-08Downgrade the "declaration does not declare anything" error to aDouglas Gregor1-1/+1
warning. It's not harmful to have such pointless declarations, and GCC does not diagnose this issue consistently. llvm-svn: 100814
2009-12-15Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar1-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
2009-03-24Rename clang to clang-cc.Daniel Dunbar1-1/+1
Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
2009-02-06Semantic checking for class template declarations andDouglas Gregor1-1/+1
redeclarations. For example, checks that a class template redeclaration has the same template parameters as previous declarations. Detangled class-template checking from ActOnTag, whose logic was getting rather convoluted because it tried to handle C, C++, and C++ template semantics in one shot. Made some inroads toward eliminating extraneous "declaration does not declare anything" errors by adding an "error" type specifier. llvm-svn: 63973
2009-01-12Implement support for anonymous structs and unions in C. Both C andDouglas Gregor1-1/+1
C++ handle anonymous structs/unions in the same way. Addresses several bugs: <rdar://problem/6259534> <rdar://problem/6481130> <rdar://problem/6483159> The test case in PR clang/1750 now passes with -fsyntax-only, but CodeGen for inline assembler still fails. llvm-svn: 62112
2008-12-18implement PR3177 - "__extension__ union" not supported in C++ modeChris Lattner1-0/+9
llvm-svn: 61180
2008-11-14Implement parsing and semantic checking of the 'mutable' keyword.Sebastian Redl1-0/+1
Thanks to Doug for the review. Actual effects of mutable to follow. llvm-svn: 59331
2008-11-08Update C++ status to reflect parser capabilities for chapter 9 (classes). ↵Sebastian Redl1-1/+9
Slightly extend the class parser test. llvm-svn: 58909
2008-06-28Handle unnamed bitfields when parsing C++ classes.Argyrios Kyrtzidis1-0/+1
llvm-svn: 52855
2008-06-24Add parsing support for C++ classes.Argyrios Kyrtzidis1-0/+19
Note that Parser::ParseCXXMemberSpecification is temporarily disabled until the Sema support is in place. Once ParseCXXMemberSpecification is enabled, the Parser/cxx-class.cpp test will pass. llvm-svn: 52694