summaryrefslogtreecommitdiffstats
path: root/clang/test/Parser
Commit message (Collapse)AuthorAgeFilesLines
...
* AST: Handle multidimensional arrays inside of __uuidof()David Majnemer2013-09-271-0/+4
| | | | | | | | We previously handled one-dimensional arrays but didn't consider the general case. The fix is simple: keep going through subsequent dimensions until we get to the base element. llvm-svn: 191493
* Sema: Respect -fdelayed-template-parsing when parsing constexpr functionsDavid Majnemer2013-09-271-0/+12
| | | | | | | | | | | | | | Functions declared as constexpr must have their parsing delayed in -fdelayed-template-parsing mode so as not to upset later template instantiation. N.B. My reading of the standard makes it seem like delayed template parsing is at odds with constexpr. We may want to make refinements in other places in clang to make constexpr play nicer with this feature. This fixes PR17334. llvm-svn: 191484
* Revert my patch in r191155 to allow forwardFariborz Jahanian2013-09-241-4/+4
| | | | | | | | class/protocol decls in @implementation and fixup modern rewriter to handle that. // rdar://15066233 llvm-svn: 191311
* Parse: Don't crash during parsing if we lack a simple-type-specifierDavid Majnemer2013-09-221-0/+8
| | | | | | | | | | | | | | | | | Summary: Parsing cast expressions during error recovery can put us in a bad state. Check to see if the token for a simple-type-specifier makes sense before further parsing. Fixes PR17255. Reviewers: rsmith, doug.gregor, CornedBee, eli.friedman CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1696 llvm-svn: 191159
* ObjectiveC: ObjC declarations, including forward classFariborz Jahanian2013-09-221-4/+4
| | | | | | and protocols can be at global scope only. llvm-svn: 191155
* Modify the uninitialized field visitor to detect uninitialized use across theRichard Trieu2013-09-201-1/+1
| | | | | | | | | | | | | | | | | | fields in the class. This allows a better checking of member intiailizers and in class initializers in regards to initialization ordering. For instance, this code will now produce warnings: class A { int x; int y; A() : x(y) {} // y is initialized after x, warn here A(int): y(x) {} // default initialization of leaves x uninitialized, warn here }; Several test cases were updated with -Wno-uninitialized to silence this warning. llvm-svn: 191068
* As Aaron pointed out it's simpler to reject wide string availability attr ↵Benjamin Kramer2013-09-131-0/+2
| | | | | | messages in the parser. llvm-svn: 190706
* PR13657 (and duplicates):Richard Smith2013-09-123-0/+198
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a comma occurs in a default argument or default initializer within a class, disambiguate whether it is part of the initializer or whether it ends the initializer. The way this works (which I will be proposing for standardization) is to treat the comma as ending the default argument or default initializer if the following token sequence matches the syntactic constraints of a parameter-declaration-clause or init-declarator-list (respectively). This is both consistent with the disambiguation rules elsewhere (where entities are treated as declarations if they can be), and should have no regressions over our old behavior. I think it might also disambiguate all cases correctly, but I don't have a proof of that. There is an annoyance here: because we're performing a tentative parse in a situation where we may not have seen declarations of all relevant entities (if the comma is part of the initializer, lookup may find entites declared later in the class), we need to turn off typo-correction and diagnostics during the tentative parse, and in the rare case that we decide the comma is part of the initializer, we need to revert all token annotations we performed while disambiguating. Any diagnostics that occur outside of the immediate context of the tentative parse (for instance, if we trigger the implicit instantiation of a class template) are *not* suppressed, mirroring the usual rules for a SFINAE context. llvm-svn: 190639
* AST: __uuidof should leak through templated typesDavid Majnemer2013-09-071-0/+19
| | | | | | | | | | | | | | | Summary: __uuidof on templated types should exmaine if any of its template parameters have a uuid declspec. If exactly one does, then take it. Otherwise, issue an appropriate error. Reviewers: rsmith, thakis, rnk CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1419 llvm-svn: 190240
* C++11 attributes after 'constructor-name (' unambiguously signal that we have aRichard Smith2013-09-061-0/+5
| | | | | | constructor. llvm-svn: 190111
* For "expected unqualified-id" errors after a double colon, and the double colonRichard Trieu2013-09-051-0/+15
| | | | | | | | is at the end of the line, point to the location after the double colon instead of at the next token. There is more context to be given this way. In addition, the next token can be several lines later. llvm-svn: 190029
* Parser: support Microsoft syntax for 'typename typedef'David Majnemer2013-09-031-1/+9
| | | | | | | | | | | | | | | | | | | | | | Summary: Transform the token sequence for: typename typedef T U; to: typename T typedef U; Raise a diagnostic when this happens but only if we succeeded handling the typename. Reviewers: rsmith, rnk Reviewed By: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1433 llvm-svn: 189867
* Sema: Properly support Microsoft-mode template argumentsDavid Majnemer2013-08-231-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | Summary: There were two things known to be wrong with our implementation of MSVC mode template arguments: - We didn't properly handle __uuidof/CXXUuidofExpr and skipped all type checking completely. - We didn't allow for MSVC's extension of allowing certain constant "foldable" expressions from showing up in template arguments. They allow various casts dereference and address-of operations. We can make it more general as we find further peculiarities but this is the known extent. Reviewers: rsmith, doug.gregor, rjmccall Reviewed By: doug.gregor CC: cfe-commits, rnk Differential Revision: http://llvm-reviews.chandlerc.com/D1444 llvm-svn: 189087
* Refactor all diagnosing of TypoCorrections through a common function, inRichard Smith2013-08-171-2/+2
| | | | | | | preparation for teaching this function how to diagnose a correction that includes importing a module. llvm-svn: 188602
* Fix Altivec vector literal parser hack for C++11.Eli Friedman2013-08-131-1/+5
| | | | | | | It doesn't make any sense to accept "..." in the argument to a C-style cast, so use a separate expression list parsing routine which rejects it. PR16874. llvm-svn: 188330
* Avoid spurious error messages if parent template class cannot be instantiatedSerge Pavlov2013-08-101-0/+63
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D924 llvm-svn: 188133
* Parse: Don't consider attributes of broken member declaratorsDavid Majnemer2013-08-011-1/+4
| | | | | | | | | | | | | | ParseCXXClassMemberDeclaration was trying to use the result of ActOnCXXMemberDeclarator to attach it to some late parsed attributes. However when failures arise, we have no decl to attach to which eventually leads us to a NULL pointer dereference. While we are here, clean up the code a bit. Fixes PR16765 llvm-svn: 187557
* err_attribute_not_string has been subsumed by err_attribute_argument_type.Aaron Ballman2013-07-301-17/+17
| | | | llvm-svn: 187400
* PR5066: If a declarator cannot have an identifier, and cannot possibly beRichard Smith2013-07-113-1/+15
| | | | | | | | | followed by an identifier, then diagnose an identifier as being a bogus part of the declarator instead of tripping over it. Improves diagnostics for cases like std::vector<const int *p> my_vec; llvm-svn: 186061
* Sema: Do not merge new decls with invalid, old declsDavid Majnemer2013-07-071-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Sema::MergeFunctionDecl attempts merging two decls even if the old decl is invalid. This can lead to interesting circumstances where we successfully merge the decls but the result makes no sense. Take the following for example: template <typename T> int main(void); int main(void); Sema will not consider these to be overloads of the same name because main can't be overloaded, which means that this must be a redeclaration. In this case the templated decl is compatible with the non-templated decl allowing the Sema::CheckFunctionDeclaration machinery to move on and do bizarre things like setting the previous decl of a non-templated decl to a templated decl! The way I see it, we should just bail from MergeFunctionDecl if the old decl is invalid. This fixes PR16531. llvm-svn: 185779
* Use the new --crash option in commands that are expected to crash.Rafael Espindola2013-07-051-1/+1
| | | | llvm-svn: 185679
* Add 'not' to commands that are expected to fail.Rafael Espindola2013-07-045-8/+8
| | | | | | | This is at least good documentation, but also opens the possibility of using pipefail. llvm-svn: 185652
* PR16480: Reimplement token-caching for constructor initializer lists. ThisRichard Smith2013-07-041-3/+69
| | | | | | | | | | | | | | | previously didn't work if a mem-initializer-id had a template argument which contained parentheses or braces. We now implement a simple rule: just look for a ') {' or '} {' that is not nested. The '{' is assumed to start the function-body. There are still two cases which we misparse, where the ') {' comes from a compound literal or from a lambda. The former case is not valid C++, and the latter will probably not be valid C++ once DR1607 is resolved, so these seem to be of low value, and we do not regress on them with this change. EDG and g++ also misparse both of these cases. llvm-svn: 185598
* "bool" should be a context-sensitive keyword in Altivec mode.Bill Schmidt2013-07-031-0/+14
| | | | | | | | | | | | | | | | | PR16456 reported that Clang implements a hybrid between AltiVec's "Keyword and Predefine Method" and its "Context Sensitive Keyword Method," where "bool" is always a keyword, but "vector" and "pixel" are context-sensitive keywords. This isn't permitted by the AltiVec spec. For consistency with gcc, this patch implements the Context Sensitive Keyword Method for bool, and stops treating true and false as keywords in Altivec mode. The patch removes KEYALTIVEC as a trigger for defining these keywords in include/clang/Basic/TokenKinds.def, and adds logic for "vector bool" that mirrors the existing logic for "vector pixel." The test case is taken from the bug report. llvm-svn: 185580
* Allow typo correction to try removing nested name specifiers.Kaelyn Uhrain2013-07-021-2/+2
| | | | | | | | | | | | | | | | | The removal is tried by retrying the failed lookup of a correction candidate with either the MemberContext or SS (CXXScopeSpecifier) or both set to NULL if they weren't already. If the candidate identifier is then looked up successfully, make a note in the candidate that the SourceRange should include any existing nested name specifier even if the candidate isn't adding a different one (i.e. the candidate has a NULL NestedNameSpecifier). Also tweak the diagnostic messages to differentiate between a suggestion that just replaces the identifer but leaves the existing nested name specifier intact and one that replaces the entire qualified identifier, in cases where the suggested replacement is unqualified. llvm-svn: 185487
* PR8302: Check for shadowing a template parameter when declaring a templateRichard Smith2013-06-251-0/+13
| | | | | | template parameter. llvm-svn: 184884
* Add the global namespace (the "::" namespace specifier) to the list ofKaelyn Uhrain2013-06-241-2/+3
| | | | | | namespaces to try for potential typo corrections. llvm-svn: 184762
* Fix for PR 16367, display the name of a function in a diagnostic instead ofRichard Trieu2013-06-191-0/+8
| | | | | | showing "(null)". llvm-svn: 184377
* Recognition of empty structures and unions is moved to semantic stageSerge Pavlov2013-06-081-1/+2
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D586 llvm-svn: 183609
* Fix a typo (chek => check)Sylvestre Ledru2013-06-041-1/+1
| | | | llvm-svn: 183223
* Adding in parsing and the start of semantic support for __sptr and __uptr ↵Aaron Ballman2013-05-221-0/+11
| | | | | | | | | | pointer type qualifiers. This patch also fixes the correlated __ptr32 and __ptr64 pointer qualifiers so that they are truly type attributes instead of declaration attributes. For more information about __sptr and __uptr, see MSDN: http://msdn.microsoft.com/en-us/library/aa983399.aspx Patch reviewed by Richard Smith. llvm-svn: 182535
* PR16094: I should have known Obj-C init-capture disambiguation couldn't beRichard Smith2013-05-211-3/+13
| | | | | | | | | | | | | | | | | | | | | *that* easy... Try a bit harder to disambiguate. This is mostly straightforward, but for =-style initializers, we actually need to know where an expression ends: [foo = bar baz] is a message send, whereas [foo = bar + baz] is a lambda-introducer. Handle this by parsing the expression eagerly, and replacing it with an annotation token. By chance, we use the *exact same* parsing rules in both cases (except that we need to assume we're inside a message send for the parse, to turn off various forms of inapplicable error recovery). llvm-svn: 182432
* Objective-C parsing. Error recovery when category implementationFariborz Jahanian2013-05-171-0/+8
| | | | | | declaration is illegally protocol qualified. // rdar://13920026 llvm-svn: 182136
* First pass of semantic analysis for init-captures: check the initializer, buildRichard Smith2013-05-162-13/+13
| | | | | | | | | | | | | a FieldDecl from it, and propagate both into the closure type and the LambdaExpr. You can't do much useful with them yet -- you can't use them within the body of the lambda, because we don't have a representation for "the this of the lambda, not the this of the enclosing context". We also don't have support or a representation for a nested capture of an init-capture yet, which was intended to work despite not being allowed by the current standard wording. llvm-svn: 181985
* C++1y n3648: parse and reject init-captures for now.Richard Smith2013-05-092-0/+28
| | | | llvm-svn: 181553
* Properly parsing __declspec(safebuffers), though there is no semantic ↵Aaron Ballman2013-05-041-1/+1
| | | | | | hookup. For more information about safebuffers, see MSDN: http://msdn.microsoft.com/en-us/library/dd778695(v=vs.110).aspx llvm-svn: 181123
* Objective-C parsing [qoi]: Recover gracefully with good diagnosticFariborz Jahanian2013-04-241-0/+21
| | | | | | | when class implementation declaration adds protocol qualifier list. // rdar://12233858 llvm-svn: 180228
* The 'constexpr implies const' rule for non-static member functions is gone inRichard Smith2013-04-212-4/+4
| | | | | | | | | C++1y, so stop adding the 'const' there. Provide a compatibility warning for code relying on this in C++11, with a fix-it hint. Update our lazily-written tests to add the const, except for those ones which were testing our implementation of this rule. llvm-svn: 179969
* Objective-C++: Enable passing of modern C++11 style Fariborz Jahanian2013-04-181-0/+38
| | | | | | | initialized temporaries to objc++ methods. // rdar://12788429 llvm-svn: 179818
* Objective-C parsing [qoi]: Provide good recovery whenFariborz Jahanian2013-04-181-0/+8
| | | | | | | Objective-C dictionary literals has bad syntax for the separator. // rdar://10679157 llvm-svn: 179784
* [Parser] Handle #pragma pack/align inside C structs.Argyrios Kyrtzidis2013-04-182-0/+26
| | | | | | Fixes PR13580. Patch by Serge Pavlov! llvm-svn: 179743
* Parser support for #pragma clang __debug capturedTareq A. Siraj2013-04-161-0/+14
| | | | | | | | | | | | | | | This patch implements parsing ‘#pragma clang __debug’ as a first step for implementing captured statements. Captured statements are a mechanism for doing outlining in the AST. see http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-January/027540.html. Currently returns StmtEmpty Author: Andy Zhang <andy.zhang@intel.com> Differential Revision: http://llvm-reviews.chandlerc.com/D369 llvm-svn: 179614
* Basic support for Microsoft property declarations andJohn McCall2013-04-161-0/+29
| | | | | | | | references thereto. Patch by Tong Shen! llvm-svn: 179585
* Give this test a triple so that its use of thread_local doesn't make it fail ↵Richard Smith2013-04-131-1/+1
| | | | | | on the MSVC bot. llvm-svn: 179432
* Parsing support for thread_local and _Thread_local. We give them the sameRichard Smith2013-04-121-2/+1
| | | | | | semantics as __thread for now. llvm-svn: 179424
* Make the ObjC attributes diagnostics a bit more informative.Nico Weber2013-04-041-5/+5
| | | | llvm-svn: 178720
* Emit a nicer diagnostic for misplaced attributes on ObjC directives.Nico Weber2013-04-032-8/+25
| | | | llvm-svn: 178670
* Support C11 _Atomic type qualifier. This is more-or-less just syntactic ↵Richard Smith2013-03-282-0/+41
| | | | | | sugar for the _Atomic type specifier. llvm-svn: 178210
* Try harder to be signal-safe inside our signal handler. The most prominent ↵Nick Lewycky2013-03-251-0/+9
| | | | | | | | | | behavioural difference is that we no longer clean the token before emitting it. This fixes a bug where clang hangs in the middle of crashing because the crash handler calls malloc from inside a crash that happened inside of free. llvm-svn: 177919
* Do the error recovery for @end only.Fariborz Jahanian2013-03-201-9/+0
| | | | | | | | I am not sure how much we can improve for when a randon ObjC keyword is thrown into the ivar decl. block. // rdar://6854840 llvm-svn: 177553
OpenPOWER on IntegriCloud