summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix a clang crash caused by incorrect user code.Fariborz Jahanian2009-06-241-0/+7
| | | | llvm-svn: 74080
* Make sure that the template parameter lists get from the parser down to ↵Douglas Gregor2009-06-241-1/+1
| | | | | | ActOnFunctionDeclarator for function template definitions llvm-svn: 74040
* Parsing and AST support for using declarations, from John Thompson!Douglas Gregor2009-06-202-2/+46
| | | | llvm-svn: 73812
* Diagnose class members that shadow a template parameter. FixesDouglas Gregor2009-06-171-0/+11
| | | | | | | | | | <rdar://problem/6952203>. To do this, we actually remove a not-quite-correct optimization in the C++ name lookup routines. We'll revisit this optimization for the general case once more C++ is working. llvm-svn: 73659
* Diagnose the use of attributes on namespace aliases, from Anis AhmadDouglas Gregor2009-06-171-0/+8
| | | | llvm-svn: 73626
* change ParseStatementOrDeclaration to emit the 'missing ;' withChris Lattner2009-06-141-0/+3
| | | | | | | | | | | | | | | | | | | ExpectAndConsume instead of custom diag logic. This gets us an insertion hint and positions the ; at the end of the line instead of on the next token. Before: t.c:5:1: error: expected ';' after return statement } ^ after: t.c:4:11: error: expected ';' after return statement return 4 ^ ; llvm-svn: 73315
* Update test to work with the limited Sema for #pragma weak.Eli Friedman2009-06-051-2/+2
| | | | llvm-svn: 72914
* Test for parsing #pragma weak.Eli Friedman2009-06-051-0/+17
| | | | llvm-svn: 72908
* Use "()" instead of "(void)" when pretty-printing a parameter-less function ↵Argyrios Kyrtzidis2009-06-031-3/+3
| | | | | | type for C++. llvm-svn: 72747
* PR4122: Tweak the ambiguity handling to handle (S())() correctly. I've Eli Friedman2009-05-251-0/+7
| | | | | | left out handling for stuff like (S())++ for the moment. llvm-svn: 72394
* Add a test case to make sure that an ambiguous paren expression is only ↵Argyrios Kyrtzidis2009-05-221-1/+5
| | | | | | parsed once. llvm-svn: 72298
* Handle correctly a very ugly part of the C++ syntax. We cannot disambiguate ↵Argyrios Kyrtzidis2009-05-221-0/+15
| | | | | | | | | | | | | | between a parenthesized type-id and a paren expression without considering the context past the parentheses. Behold: (T())x; - type-id (T())*x; - type-id (T())/x; - expression (T()); - expression llvm-svn: 72260
* Parse typeof-specifier the same way as sizeof/alignof are parsed.Argyrios Kyrtzidis2009-05-222-1/+6
| | | | | | | | -Makes typeof consistent with sizeof/alignof -Fixes a bug when '>' is in a typeof expression, inside a template type param: A<typeof(x>1)> a; llvm-svn: 72255
* Make the RAII extension warning silencing for __extension__ a bit Eli Friedman2009-05-161-4/+7
| | | | | | | narrower, so it doesn't catch expresions that aren't sub-expressions of __extension__ operator. llvm-svn: 71967
* Fixup __extension__ i = 1 parsing. Thanks Eli!Mike Stump2009-05-161-2/+1
| | | | llvm-svn: 71927
* Fixup parsing for (throw,throw) and __extension__ throw 1.Mike Stump2009-05-151-0/+16
| | | | llvm-svn: 71897
* Refactor the parsing of declarations so that template declarations canDouglas Gregor2009-05-121-2/+1
| | | | | | | | | | parse just a single declaration and provide a reasonable diagnostic when the "only one declarator per template declaration" rule is violated. This eliminates some ugly, ugly hackery where we used to require thatn the layout of a DeclGroup of a single element be the same as the layout of a single declaration. llvm-svn: 71596
* For friend class decls, always use TK_Reference so we'll try to look up ↵Anders Carlsson2009-05-111-0/+12
| | | | | | existing class decls first. llvm-svn: 71481
* Add parsing of friend specifiers.Anders Carlsson2009-05-061-0/+5
| | | | llvm-svn: 71067
* Have the parser communicate the exception specification to the action.Sebastian Redl2009-04-291-0/+2
| | | | llvm-svn: 70389
* Simplify the scheme used for keywords, and change the classification Eli Friedman2009-04-283-27/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | scheme to be more useful. The new scheme introduces a set of categories that should be more readable, and also reflects what we want to consider as an extension more accurately. Specifically, it makes the "what is a keyword" determination accurately reflect whether the keyword is a GNU or Microsoft extension. I also introduced separate flags for keyword aliases; this is useful because the classification of the aliases is mostly unrelated to the classification of the original keyword. This patch treats anything that's in the implementation namespace (prefixed with "__", or "_X" where "X" is any upper-case letter) as a keyword without marking it as an extension. This is consistent with the standards in that an implementation is allowed to define arbitrary extensions in the implementation namespace without violating the standard. This gets rid of all the nasty "extension used" warnings for stuff like __attribute__ in -pedantic mode. We still warn for extensions outside of the the implementation namespace, like typeof. If someone wants to implement -Wextensions or something like that, we could add additional information to the keyword table. This also removes processing for the unused "Boolean" language option; such an extension isn't supported on any other C implementation, so I don't see any point to adding it. The changes to test/CodeGen/inline.c are required because previously, we weren't actually disabling the "inline" keyword in -std=c89 mode. I'll remove Boolean and NoExtensions from LangOptions in a follow-up commit. llvm-svn: 70281
* The mysterious bug turns out to be an incredibly bone-headed mistake.Sebastian Redl2009-04-261-4/+1
| | | | llvm-svn: 70160
* Implement function-try-blocks. However, there's a very subtle bug that I ↵Sebastian Redl2009-04-261-0/+19
| | | | | | can't track down. llvm-svn: 70155
* implement semantic analysis for @synchronized, fixing a crash on invalidChris Lattner2009-04-211-1/+4
| | | | | | rdar://6810940 - @synchronized has no sema checks llvm-svn: 69670
* Add warning when a tentative array definition is assumed to have one element.Daniel Dunbar2009-04-151-1/+1
| | | | | | - Also, fixed one to actually be one (instead of zero). :) llvm-svn: 69226
* Improve error recovery for calls, fixing:Chris Lattner2009-04-131-1/+8
| | | | | | PR3972: Poor diagnostic with missing ')' llvm-svn: 68932
* Fix some C++ error recovery problems in init declarator parsingChris Lattner2009-04-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that I noticed working on other things. Instead of emitting: t2.cc:1:8: error: use of undeclared identifier 'g' int x(*g); ^ t2.cc:1:10: error: expected ')' int x(*g); ^ t2.cc:1:6: note: to match this '(' int x(*g); ^ We now only emit: t2.cc:1:7: warning: type specifier missing, defaults to 'int' int x(*g); ^ Note that the example in SemaCXX/nested-name-spec.cpp:f4 is still not great, we now produce both of: void f4(undef::C); // expected-error {{use of undeclared identifier 'undef'}} \ expected-error {{variable has incomplete type 'void'}} The second diagnostic should be silenced by something getting marked invalid. I don't plan to fix this though. llvm-svn: 68919
* fix another case that assumed that GetTypeForDeclarator would never return null.Chris Lattner2009-04-121-1/+0
| | | | llvm-svn: 68918
* mark the declspec as invalid when we recover instead of forcing to int,Chris Lattner2009-04-121-2/+4
| | | | | | this allows downstream diags to be properly silenced. llvm-svn: 68917
* Diagnose invalid uses of tagged types with a missing tag. For example, in:Chris Lattner2009-04-121-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | struct xyz { int y; }; enum abc { ZZZ }; static xyz b; abc c; we used to produce: t2.c:4:8: error: unknown type name 'xyz' static xyz b; ^ t2.c:5:1: error: unknown type name 'abc' abc c; ^ we now produce: t2.c:4:8: error: use of tagged type 'xyz' without 'struct' tag static xyz b; ^ struct t2.c:5:1: error: use of tagged type 'abc' without 'enum' tag abc c; ^ enum GCC produces the normal: t2.c:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘b’ t2.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘c’ rdar://6783347 llvm-svn: 68914
* Implement the first set of changes for PR3963 and rdar://6759604,Chris Lattner2009-04-122-7/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | which tries to do better error recovery when it is "obvious" that an identifier is a mis-typed typename. In this case, we try to parse it as a typename instead of as the identifier in a declarator, which gives us several options for better error recovery and immediately makes diagnostics more useful. For example, we now produce: t.c:4:8: error: unknown type name 'foo_t' static foo_t a = 4; ^ instead of: t.c:4:14: error: invalid token after top level declarator static foo_t a = 4; ^ Also, since we now parse "a" correctly, we make a decl for it, preventing later uses of 'a' from emitting things like: t.c:12:20: error: use of undeclared identifier 'a' int bar() { return a + b; } ^ I'd really appreciate any scrutiny possible on this, it is a tricky area. llvm-svn: 68911
* Improve the 'cannot pass objc interface by value' diagnostic:Chris Lattner2009-04-111-1/+1
| | | | | | | | | | | | | | | | | | 1) improve localizability by not passing english strings in. 2) improve location for arguments. 3) print the objc type being passed. Before: method-bad-param.m:15:1: error: Objective-C type cannot be passed by value -(void) my_method:(foo) my_param ^ after: method-bad-param.m:15:25: error: Objective-C interface type 'foo' cannot be passed by value -(void) my_method:(foo) my_param ^ llvm-svn: 68872
* hoist some code for handling objc foreach construct out of Declaration ↵Chris Lattner2009-03-292-27/+24
| | | | | | | | processing into ParseForStatement. Merge two tests into one. llvm-svn: 68010
* hoist checks for ; and in out of ParseInitDeclaratorListAfterFirstDeclaratorChris Lattner2009-03-291-2/+2
| | | | | | into ParseSimpleDeclaration, and improve a diagnostic. llvm-svn: 68009
* Parse namespace aliases.Anders Carlsson2009-03-281-0/+8
| | | | llvm-svn: 67908
* fix "Comment#1" from PR3872Chris Lattner2009-03-241-1/+9
| | | | llvm-svn: 67625
* Rename clang to clang-cc.Daniel Dunbar2009-03-2477-80/+80
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* Recognize rvalue references in C++03, but complain about them. This leads to ↵Sebastian Redl2009-03-231-0/+2
| | | | | | far better error recovery. llvm-svn: 67495
* Some minor tweaks and additional tests for rvalue referencesDouglas Gregor2009-03-201-1/+4
| | | | llvm-svn: 67397
* Almost complete implementation of rvalue references. One bug, and a few ↵Sebastian Redl2009-03-162-6/+7
| | | | | | unclear areas. Maybe Doug can shed some light on some of the fixmes. llvm-svn: 67059
* Parser support for rvalue references.Sebastian Redl2009-03-151-1/+6
| | | | llvm-svn: 67033
* Implement property '.' notation on Factory/Class objects. Parser changes ↵Steve Naroff2009-03-091-1/+1
| | | | | | | | aren't very pretty:-( This fixes <rdar://problem/6496506> Implement class setter/getter for properties. llvm-svn: 66465
* Clean up some error messages with anonymous structs/unions and member ↵Douglas Gregor2009-03-061-1/+1
| | | | | | declaration parsing. Fixes PR3680 llvm-svn: 66305
* Fix a crash in test/Parser/control-scope.c that testrunner didn'tChris Lattner2009-02-281-3/+3
| | | | | | | | notice because it was a negative test with a fix suggested by Jean-Daniel Dupas. Convert the test from a negative to a positive test to catch stuff like this. llvm-svn: 65708
* upgrade various 'implicit int' warnings from an ext-warn to warning when notChris Lattner2009-02-274-6/+6
| | | | | | | | in C89 mode. This makes it enabled by default instead of only enabled with -pedantic. Clang defaults to c99 mode, so people will see this more often than with GCC, but they can always use -std=c89 if they really want c89. llvm-svn: 65647
* change a diagnostic message from something pedantically correct butChris Lattner2009-02-271-1/+1
| | | | | | | useless to something more vague but hopefully more clear. rdar://6624173 llvm-svn: 65639
* Introduce code modification hints into the diagnostics system. When weDouglas Gregor2009-02-262-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | know how to recover from an error, we can attach a hint to the diagnostic that states how to modify the code, which can be one of: - Insert some new code (a text string) at a particular source location - Remove the code within a given range - Replace the code within a given range with some new code (a text string) Right now, we use these hints to annotate diagnostic information. For example, if one uses the '>>' in a template argument in C++98, as in this code: template<int I> class B { }; B<1000 >> 2> *b1; we'll warn that the behavior will change in C++0x. The fix is to insert parenthese, so we use code insertion annotations to illustrate where the parentheses go: test.cpp:10:10: warning: use of right-shift operator ('>>') in template argument will require parentheses in C++0x B<1000 >> 2> *b1; ^ ( ) Use of these annotations is partially implemented for HTML diagnostics, but it's not (yet) producing valid HTML, which may be related to PR2386, so it has been #if 0'd out. In this future, we could consider hooking this mechanism up to the rewriter to actually try to fix these problems during compilation (or, after a compilation whose only errors have fixes). For now, however, I suggest that we use these code modification hints whenever we can, so that we get better diagnostics now and will have better coverage when we find better ways to use this information. This also fixes PR3410 by placing the complaint about missing tokens just after the previous token (rather than at the location of the next token). llvm-svn: 65570
* Fix <rdar://problem/6500554> missing objc error message.Steve Naroff2009-02-201-2/+2
| | | | llvm-svn: 65198
* Make "implicit int" an error in C++ (unless we're allowing MicrosoftDouglas Gregor2009-02-161-8/+10
| | | | | | extensions). This caught a couple bugs in our test suite :) llvm-svn: 64686
* implement gcc/testsuite/objc.dg/method-attribute-3.m, by improving error ↵Chris Lattner2009-02-151-0/+8
| | | | | | recovery. llvm-svn: 64609
OpenPOWER on IntegriCloud