summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser
Commit message (Collapse)AuthorAgeFilesLines
* Change the diagnostics which said 'accepted as an extension' to instead sayRichard Smith2011-12-292-8/+8
| | | | | | | 'is an extension'. The former is inappropriate and confusing when building with -Werror/-pedantic-errors. llvm-svn: 147357
* Add -Wdangling-else.Nico Weber2011-12-221-0/+55
| | | | | | | This works like described in http://drdobbs.com/blogs/cpp/231602010 Fixes http://llvm.org/PR11609 llvm-svn: 147202
* PR11297: Provide a better diagnostic for code which contains aRichard Smith2011-12-201-0/+30
| | | | | | | | reasonable-looking but ill-formed for-range statement of the form: for (expression : expression) llvm-svn: 147006
* In Parser::SkipUntil do not stop at '@' unconditionally.Argyrios Kyrtzidis2011-12-171-11/+0
| | | | | | | | | | | | | | | Stopping at '@' was originally intended to avoid skipping an '@' at the @interface context when doing parser recovery, but we should not stop at all '@' tokens because they may be part of expressions (e.g. in @"string", @selector(), etc.), so in most cases we will want to skip them. This commit caused 'test/Parser/method-def-in-class.m' to fail for the cases where we tried to recover from unmatched angle bracket but IMO it is not a big deal to not have good recovery from such broken code and the way we did recovery would not always work anyway (e.g. if there was '@' in an expression). The case that rdar://7029784 is about still passes. llvm-svn: 146815
* Modify how the -verify flag works. Currently, the verification string andRichard Trieu2011-12-159-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostic message are compared. If either is a substring of the other, then no error is given. This gives rise to an unexpected case: // expect-error{{candidate function has different number of parameters}} will match the following error messages from Clang: candidate function has different number of parameters (expected 1 but has 2) candidate function has different number of parameters It will also match these other error messages: candidate function function has different number of parameters number of parameters This patch will change so that the verification string must be a substring of the diagnostic message before accepting. Also, all the failing tests from this change have been corrected. Some stats from this cleanup: 87 - removed extra spaces around verification strings 70 - wording updates to diagnostics 40 - extra leading or trailing characters (typos, unmatched parens or quotes) 35 - diagnostic level was included (error:, warning:, or note:) 18 - flag name put in the warning (-Wprotocol) llvm-svn: 146619
* objc: diagnose duplicate declaration of methodsFariborz Jahanian2011-12-131-1/+1
| | | | | | in classes. // rdar://10535349 llvm-svn: 146504
* Implement the Microsoft __if_exists/if_not_exists extension in initializer-list.Francois Pichet2011-12-121-0/+29
| | | | | | | | | | | | | | | Necessary to parse Microsoft ATL code. Example: int array[] = { 0, __if_exists(CLASS::Type) {2, } 3 }; will declare an array of 2 or 3 elements depending on if CLASS::Type exists or not. llvm-svn: 146447
* Add ability to supply additional message to availability macros,Fariborz Jahanian2011-12-101-0/+8
| | | | | | // rdar://10095131 llvm-svn: 146304
* Fix: allow @protocol forward declarations inside @implementation-s.Erik Verbruggen2011-12-081-0/+51
| | | | llvm-svn: 146147
* Extend warnings for missing '@end'.Erik Verbruggen2011-12-065-13/+13
| | | | | | Fixes PR2709. llvm-svn: 145928
* Diagnose use of wide string literal in 'asm' instead of crashing. Fixes ↵Ted Kremenek2011-12-021-0/+3
| | | | | | <rdar://problem/10465079>. llvm-svn: 145656
* Change the Microsoft __interface keyword to be an alias for struct (not ↵Francois Pichet2011-12-011-0/+5
| | | | | | class) since members are public by default. llvm-svn: 145580
* Enable delayed template parsing for friend functions declared at template ↵Francois Pichet2011-11-181-0/+4
| | | | | | class scope. llvm-svn: 144980
* PR11148: Fix crash-on-invalid if an invalid member declaration is marked asRichard Smith2011-11-101-0/+4
| | | | | | defaulted or deleted. llvm-svn: 144270
* Improve the diagnostic when a comma ends up at the end of a declarator groupRichard Smith2011-10-192-1/+39
| | | | | | | | | 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
* Refactor __attribute__ parsing, and add a diagnostic if the r_paren at the endRichard Smith2011-10-171-0/+5
| | | | | | of an attrib is missing. gcc does not allow the closing parenthesis to be omitted. llvm-svn: 142255
* Testcase for half of r142048.Richard Smith2011-10-151-0/+5
| | | | llvm-svn: 142053
* Use of override keywords in C++98 should produce a warning by default.Richard Smith2011-10-151-0/+8
| | | | llvm-svn: 142050
* Update all tests other than Driver/std.cpp to use -std=c++11 rather thanRichard Smith2011-10-1311-11/+11
| | | | | | -std=c++0x. Patch by Ahmed Charles! llvm-svn: 141900
* Allow for annotate attributes after access specifiers. When suchErik Verbruggen2011-10-131-0/+12
| | | | | | attributes are found, propagate them to subsequent declarations. llvm-svn: 141861
* Fix crash-on-invalid, improve error recovery, and test coverage for missing ↵David Blaikie2011-10-131-0/+17
| | | | | | colon after access specifiers in C++ llvm-svn: 141852
* Switch diagnostic text from "C++0x" over to "C++11".Douglas Gregor2011-10-123-10/+10
| | | | | | | | We'd also like for "C++11" or "c++11" to be used for the warning groups, but without removing the old warning flags. Patches welcome; I've run out of time to work on this today. llvm-svn: 141801
* Introduce BalancedDelimiterTracker, to better track open/closeDouglas Gregor2011-10-121-0/+7
| | | | | | | delimiter pairs and detect when we exceed the implementation limit for nesting depth, from Aaron Ballman! llvm-svn: 141782
* OpenCL: add a non-standard extension, cl_clang_storage_class_specifiers,Peter Collingbourne2011-10-061-0/+6
| | | | | | | | | which enables support for C99 storage-class specifiers. This extension is intended to be used by implementations to implement OpenCL C built-in functions. llvm-svn: 141271
* OpenCL: disallow '#pragma OPENCL EXTENSION all : enable', per OpenCL 1.1 9.1Peter Collingbourne2011-10-061-0/+3
| | | | llvm-svn: 141270
* Make -fobjc-nonfragile-abi the -cc1 default, since it's theJohn McCall2011-10-021-2/+2
| | | | | | | | | | | | | | | | | | | increasingly prevailing case to the point that new features like ARC don't even support the fragile ABI anymore. This required a little bit of reshuffling with exceptions because a check was assuming that ObjCNonFragileABI was only being set in ObjC mode, and that's actually a bit obnoxious to do. Most, though, it involved a perl script to translate a ton of test cases. Mostly no functionality change for driver users, although there are corner cases with disabling language-specific exceptions that we should handle more correctly now. llvm-svn: 140957
* Hey, maybe we shouldn't silently ignore decl attributesJohn McCall2011-10-011-2/+2
| | | | | | on declarators written as types. llvm-svn: 140931
* Fix a bug in the token caching for inline constructors in C++11, and improve ↵Sebastian Redl2011-09-302-0/+19
| | | | | | error recovery in both dialects. This should fix the GCC test suite failures as well. llvm-svn: 140847
* Some fixes for MS-style asm parsing: specifically, add some error checking, ↵Eli Friedman2011-09-301-0/+25
| | | | | | and handle asm comments using semicolons correctly. (The comments are actually surprisingly tricky.) llvm-svn: 140837
* PR11000: Fix crash on invalid.Richard Smith2011-09-291-0/+9
| | | | llvm-svn: 140802
* Add support for alignment-specifiers in C1X and C++11, removePeter Collingbourne2011-09-292-3/+10
| | | | | | | support for the C++0x draft [[align]] attribute and add the C1X standard header file stdalign.h llvm-svn: 140796
* Add support for parsing an attribute-specifier-seq containing multiplePeter Collingbourne2011-09-291-0/+1
| | | | | | attribute-specifiers llvm-svn: 140794
* Add support for parsing the optional attribute-specifier-seq at thePeter Collingbourne2011-09-291-0/+2
| | | | | | end of a decl-specifier-seq llvm-svn: 140793
* Fix a crash-on-invalid.Matt Beaumont-Gay2011-09-231-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The token stream was not getting properly reset when leaving ParseLexedMethodDef in some error cases. In the testcase, that caused later accesses to the token stream to touch memory which had been freed as we finished parsing the class definition. Major hat-tip to AddressSanitizer for helping pinpoint the use-after-free, including the allocation and deallocation points: ==21510== ERROR: AddressSanitizer heap-use-after-free on address 0x7feb3de87848 at pc 0x249f4e2 bp 0x7fff15a89df0 sp 0x7fff15a89ce0 READ of size 1 at 0x7feb3de87848 thread T0 #0 0x249f4e2 clang::TokenLexer::Lex() #1 0x1c834a0 clang::Parser::ConsumeToken() #2 0x1c7dc0f clang::Parser::ParseDeclarationOrFunctionDefinition() #3 0x1c7e16b clang::Parser::ParseDeclarationOrFunctionDefinition() <snip> 0x7feb3de87848 is located 1992 bytes inside of 3816-byte region [0x7feb3de87080,0x7feb3de87f68) freed by thread T0 here: #0 0x3a22c19 free #1 0x1d136a1 clang::Parser::LexedMethod::~LexedMethod() #2 0x1cef528 clang::Parser::DeallocateParsedClasses() #3 0x1cef676 clang::Parser::PopParsingClass() #4 0x1cea094 clang::Parser::ParseCXXMemberSpecification() #5 0x1ce7ae5 clang::Parser::ParseClassSpecifier() #6 0x1cfe588 clang::Parser::ParseDeclarationSpecifiers() #7 0x1c7dbe8 clang::Parser::ParseDeclarationOrFunctionDefinition() #8 0x1c7e16b clang::Parser::ParseDeclarationOrFunctionDefinition() <snip> previously allocated by thread T0 here: #0 0x3a2302d realloc #1 0x39d7c97 llvm::SmallVectorBase::grow_pod() #2 0x1ac588e llvm::SmallVectorImpl<>::push_back() #3 0x1d12d8b clang::Parser::ConsumeAndStoreUntil() #4 0x1c9c24d clang::Parser::ConsumeAndStoreUntil() #5 0x1d12c1e clang::Parser::ConsumeAndStoreUntil() #6 0x1c9c24d clang::Parser::ConsumeAndStoreUntil() #7 0x1d10042 clang::Parser::ParseCXXInlineMethodDef() #8 0x1cec51a clang::Parser::ParseCXXClassMemberDeclaration() #9 0x1ce9de5 clang::Parser::ParseCXXMemberSpecification() #10 0x1ce7ae5 clang::Parser::ParseClassSpecifier() #11 0x1cfe588 clang::Parser::ParseDeclarationSpecifiers() #12 0x1c7dbe8 clang::Parser::ParseDeclarationOrFunctionDefinition() #13 0x1c7e16b clang::Parser::ParseDeclarationOrFunctionDefinition() <snip> llvm-svn: 140427
* [microsoft] Fix a bug in -fdelayed-template-parsing mode where we were not ↵Francois Pichet2011-09-221-2/+21
| | | | | | | | | | reentering the delayed function context correctly. The problem was that all template params were reintroduced inside the same scope. So if we had a situation where we had 2 template params with the same name at different scope then clang would generate an error about ambiguous name. The solution is to create a new ParseScope(Scope::TemplateParamScope) for each template scope that we want to reenter. (from the outmost to the innermost scope) This fixes some errors when parsing MFC code with clang. llvm-svn: 140344
* Fix a problem in digraph handling where "[:" might be treated as "<::" andRichard Trieu2011-09-201-1/+8
| | | | | | | erronously trigger the digraph correction fix-it. Include a new test to catch this in the future. llvm-svn: 140175
* Changes to the name lookup have caused a regression in the digraph fix-it hint.Richard Trieu2011-09-191-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For instance: template <class T> void E() {}; class F {}; void test() { ::E<::F>(); E<::F>(); } Gives the following error messages: error: found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'? ::E<::F>(); ^~~ < :: error: expected expression E<::F>(); ^ error: expected ']' note: to match this '[' E<::F>(); This patch adds the digraph fix-it check right before the name lookup, moves the shared checking code to a new function, and adds new tests to catch future regressions. llvm-svn: 140039
* Allow C99 hexfloats in C++0x mode. This change resolves the standardsDouglas Gregor2011-08-301-2/+3
| | | | | | | | | collision between C99 hexfloats and C++0x user-defined literals by giving C99 hexfloats precedence. Also, warning about user-defined literals that conflict with hexfloats and those that have names that are reserved by the implementation. Fixes <rdar://problem/9940194>. llvm-svn: 138839
* Add support for Microsoft __ptr32 keyword. Francois Pichet2011-08-251-0/+6
| | | | | | Patch by Chris Cudmore! llvm-svn: 138533
* Remove the last FIXMEs on -Wunused-comparison since it got moved toChandler Carruth2011-08-181-1/+1
| | | | | | | entirely use the existing -Wunused-value infrastructure. This also fixes a few missed cases for -Wunused in general. llvm-svn: 137916
* Parsing of C++0x lambda expressions, from John Freeman with help fromDouglas Gregor2011-08-045-1/+60
| | | | | | David Blaikie! llvm-svn: 136876
* This patch makes the string/character literal tests run in C,Douglas Gregor2011-07-291-1/+6
| | | | | | C++98/03, and C++0x mode, from Craig Topper! llvm-svn: 136443
* Add support for C++0x unicode string and character literals, from Craig Topper!Douglas Gregor2011-07-271-3/+34
| | | | llvm-svn: 136210
* PR10392: "#pragma GCC visibility" must not expand macros in itsJoerg Sonnenberger2011-07-201-0/+19
| | | | | | arguments. llvm-svn: 135552
* Change __debugbreak signature to void __debugbreak(void); MSVC compatibility.Francois Pichet2011-07-101-1/+1
| | | | llvm-svn: 134869
* Make the Preprocessor more memory efficient and improve macro instantiation ↵Argyrios Kyrtzidis2011-07-071-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | diagnostics. When a macro instantiation occurs, reserve a SLocEntry chunk with length the full length of the macro definition source. Set the spelling location of this chunk to point to the start of the macro definition and any tokens that are lexed directly from the macro definition will get a location from this chunk with the appropriate offset. For any tokens that come from argument expansion, '##' paste operator, etc. have their instantiation location point at the appropriate place in the instantiated macro definition (the argument identifier and the '##' token respectively). This improves macro instantiation diagnostics: Before: t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int') int y = M(/); ^~~~ t.c:5:11: note: instantiated from: int y = M(/); ^ After: t.c:5:9: error: invalid operands to binary expression ('struct S' and 'int') int y = M(/); ^~~~ t.c:3:20: note: instantiated from: \#define M(op) (foo op 3); ~~~ ^ ~ t.c:5:11: note: instantiated from: int y = M(/); ^ The memory savings for a candidate boost library that abuses the preprocessor are: - 32% less SLocEntries (37M -> 25M) - 30% reduction in PCH file size (900M -> 635M) - 50% reduction in memory usage for the SLocEntry table (1.6G -> 800M) llvm-svn: 134587
* For code such as:Richard Trieu2011-07-011-0/+15
| | | | | | | | | | | | | | | | | | | | | | | int f(int x) { if (int foo = f(bar)) {} return 0; } Clang produces the following error messages: paren_imbalance.cc:2:19: error: use of undeclared identifier 'bar' if (int foo = f(bar)) {} ^ paren_imbalance.cc:2:26: error: expected ')' if (int foo = f(bar)) {} ^ paren_imbalance.cc:2:6: note: to match this '(' if (int foo = f(bar)) {} ^ The second error is incorrect. This patch will stop Clang from producing an error on parenthesis imbalance during error recovery when there isn't one. llvm-svn: 134258
* Allow Lexer::getLocForEndOfToken to return the location just passed the ↵Argyrios Kyrtzidis2011-06-241-0/+5
| | | | | | | | | | macro instantiation if the location given points at the last token of the macro instantiation. Fixes rdar://9045701. llvm-svn: 133804
* Improve the diagnostics generated for switch statements missing expressionsDavid Majnemer2011-06-131-0/+14
| | | | | | | - Move the diagnostic to the case statement instead of at the end of the switch - Add a fix-it hint as to how to fix the compilation error llvm-svn: 132903
* Implement support for C++11 in-class initialization of non-static data members.Richard Smith2011-06-111-0/+15
| | | | llvm-svn: 132878
OpenPOWER on IntegriCloud