summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse
Commit message (Collapse)AuthorAgeFilesLines
* Parse: Template specializations which aren't dependent needn't have their ↵David Majnemer2013-09-141-4/+5
| | | | | | | | | | | | | | | | parsing be delayed Summary: We should treat a non-dependent template specialization like it wasn't templated at all. Reviewers: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1554 llvm-svn: 190743
* As Aaron pointed out it's simpler to reject wide string availability attr ↵Benjamin Kramer2013-09-131-1/+1
| | | | | | messages in the parser. llvm-svn: 190706
* PR13657 (and duplicates):Richard Smith2013-09-123-89/+597
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix the MCTargetAsmParser API change.Joey Gouly2013-09-121-3/+3
| | | | llvm-svn: 190601
* OpenMP: Data-sharing attributes analysis and clause 'shared' (fixed test ↵Alexey Bataev2013-09-061-3/+13
| | | | | | threadprivate_messages.cpp) llvm-svn: 190183
* C++11 attributes after 'constructor-name (' unambiguously signal that we have aRichard Smith2013-09-061-0/+9
| | | | | | constructor. llvm-svn: 190111
* For "expected unqualified-id" errors after a double colon, and the double colonRichard Trieu2013-09-051-2/+9
| | | | | | | | 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/+18
| | | | | | | | | | | | | | | | | | | | | | 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
* Update GCC attribute argument parsing comment to better reflect what's going onRichard Smith2013-09-031-12/+15
| | | | | | here. llvm-svn: 189838
* Factor out parsing and allocation of IdentifierLoc objects.Richard Smith2013-09-031-12/+12
| | | | llvm-svn: 189833
* Revert "OpenMP: Data-sharing attributes analysis and clause 'shared'"Rafael Espindola2013-09-031-13/+3
| | | | | | | | This reverts commit r189795. threadprivate_messages.cpp is faling on windows. llvm-svn: 189811
* OpenMP: Data-sharing attributes analysis and clause 'shared'Alexey Bataev2013-09-031-3/+13
| | | | llvm-svn: 189795
* Possibly appeasing the build bots from r189711Aaron Ballman2013-08-311-0/+1
| | | | llvm-svn: 189712
* Consolidating the notion of a GNU attribute parameter with the attribute ↵Aaron Ballman2013-08-312-52/+50
| | | | | | argument list. llvm-svn: 189711
* Remove Inheritable/NonInheritable flags from ProcessDeclAttributes. They don'tRichard Smith2013-08-292-4/+2
| | | | | | do anything useful. llvm-svn: 189548
* Revert "Implement a rudimentary form of generic lambdas."Manuel Klimek2013-08-223-35/+18
| | | | | | This reverts commit 606f5d7a99b11957e057e4cd1f55f931f66a42c7. llvm-svn: 189004
* Revert "Remove some unused variables identified by Juergen Ributzka *I need ↵Manuel Klimek2013-08-221-0/+1
| | | | | | | | to turn on this warning in Visual C++ - sorry!*" This reverts commit d01d0b63d87ac465f15ce1d6b56bf3faf4525769. llvm-svn: 189003
* const'ify Sema::ActOnCXXTryBlock byRobert Wilhelm2013-08-221-1/+1
| | | | | | | | changing Parameter from MutableArrayRef to ArrayRef. No functionality change intended. llvm-svn: 188994
* Remove some unused variables identified by Juergen Ributzka *I need to turn ↵Faisal Vali2013-08-221-1/+0
| | | | | | on this warning in Visual C++ - sorry!* llvm-svn: 188979
* Implement a rudimentary form of generic lambdas.Faisal Vali2013-08-223-18/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically, the following features are not included in this commit: - any sort of capturing within generic lambdas - nested lambdas - conversion operator for captureless lambdas - ensuring all visitors are generic lambda aware As an example of what compiles: template <class F1, class F2> struct overload : F1, F2 { using F1::operator(); using F2::operator(); overload(F1 f1, F2 f2) : F1(f1), F2(f2) { } }; auto Recursive = [](auto Self, auto h, auto ... rest) { return 1 + Self(Self, rest...); }; auto Base = [](auto Self, auto h) { return 1; }; overload<decltype(Base), decltype(Recursive)> O(Base, Recursive); int num_params = O(O, 5, 3, "abc", 3.14, 'a'); Please see attached tests for more examples. Some implementation notes: - Add a new Declarator context => LambdaExprParameterContext to clang::Declarator to allow the use of 'auto' in declaring generic lambda parameters - Augment AutoType's constructor (similar to how variadic template-type-parameters ala TemplateTypeParmDecl are implemented) to accept an IsParameterPack to encode a generic lambda parameter pack. - Add various helpers to CXXRecordDecl to facilitate identifying and querying a closure class - LambdaScopeInfo (which maintains the current lambda's Sema state) was augmented to house the current depth of the template being parsed (id est the Parser calls Sema::RecordParsingTemplateParameterDepth) so that Sema::ActOnLambdaAutoParameter may use it to create the appropriate list of corresponding TemplateTypeParmDecl for each auto parameter identified within the generic lambda (also stored within the current LambdaScopeInfo). Additionally, a TemplateParameterList data-member was added to hold the invented TemplateParameterList AST node which will be much more useful once we teach TreeTransform how to transform generic lambdas. - SemaLambda.h was added to hold some common lambda utility functions (this file is likely to grow ...) - Teach Sema::ActOnStartOfFunctionDef to check whether it is being called to instantiate a generic lambda's call operator, and if so, push an appropriately prepared LambdaScopeInfo object on the stack. - Teach Sema::ActOnStartOfLambdaDefinition to set the return type of a lambda without a trailing return type to 'auto' in C++1y mode, and teach the return type deduction machinery in SemaStmt.cpp to process either C++11 and C++14 lambda's correctly depending on the flag. - various tests were added - but much more will be needed. A greatful thanks to all reviewers including Eli Friedman, James Dennett and the ever illuminating Richard Smith. And yet I am certain that I have allowed unidentified bugs to creep in; bugs, that I will do my best to slay, once identified! Thanks! llvm-svn: 188977
* Remove Extension warning for GNU local labels.Eli Friedman2013-08-201-1/+0
| | | | | | | | | We generally don't warn about extensions involving keywords reserved for the implementation, so we shouldn't warn here either: the standard doesn't require it, and it doesn't provide useful information to the user. llvm-svn: 188840
* const'ify Sema::ActOnCompoundStmt byRobert Wilhelm2013-08-191-4/+2
| | | | | | | | changing Parameter of Sema::ActOnCompoundStmt from MutableArrayRef to ArrayRef. No functionality change intended. llvm-svn: 188705
* Parse: Do not 'HandleTopLevelDecl' on templated functions.David Majnemer2013-08-161-5/+1
| | | | | | | | | | | | | | | | Summary: HandleTopLevelDecl on a templated function leads us to try and mangle it. Reviewers: rsmith Reviewed By: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1412 llvm-svn: 188536
* Fix for dependent contexts in alias templates.Eli Friedman2013-08-151-2/+2
| | | | | | | | | | When we are parsing a type for an alias template, we are not entering the context, so we can't look into dependent classes. Make sure the parser handles this correctly. PR16904. llvm-svn: 188510
* Fix Altivec vector literal parser hack for C++11.Eli Friedman2013-08-131-2/+28
| | | | | | | 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
* Fix misindentation.Richard Smith2013-08-121-11/+11
| | | | llvm-svn: 188151
* Avoid spurious error messages if parent template class cannot be instantiatedSerge Pavlov2013-08-102-1/+8
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D924 llvm-svn: 188133
* PR9992: Serialize and deserialize the token sequence for a function template inRichard Smith2013-08-073-51/+26
| | | | | | -fdelayed-template-parsing mode. Patch by Will Wilson! llvm-svn: 187916
* A bit of clean up based on peer's feedback...Larisse Voufo2013-08-061-2/+1
| | | | llvm-svn: 187784
* Removed hack that was used to properly restore the nested name specifier of ↵Larisse Voufo2013-08-061-6/+7
| | | | | | qualified variable template ids. It turns out that the current implementation was just not logical setup for it. This commit has made it so. llvm-svn: 187776
* Moved diagnosis of forward declarations of variable templates from Parser to ↵Larisse Voufo2013-08-061-12/+2
| | | | | | Sema. llvm-svn: 187768
* Started implementing variable templates. Top level declarations should be ↵Larisse Voufo2013-08-066-34/+95
| | | | | | fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention... llvm-svn: 187762
* Parse: Don't consider attributes of broken member declaratorsDavid Majnemer2013-08-011-31/+32
| | | | | | | | | | | | | | 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
* Avoid recursions when the parser finds out that it has too many brackets.Rafael Espindola2013-07-251-1/+11
| | | | | | | | | BalancedDelimiterTracker::diagnoseOverflow calls P.SkipUntil, and before this patch P.SkipUnti is recursive, causing problems on systems with small stacks. This patch fixes it by making P.SkipUnti non recursive when just looking for eof. llvm-svn: 187097
* Improve clarity/consistency of a few UsingDecl methods and related helpers.Enea Zaffanella2013-07-221-11/+13
| | | | | | | | | | | | No functionality change. In Sema helper functions: * renamed isTypeName as HasTypenameKeyword In UsingDecl: * renamed get/setUsingLocation to get/setUsingLoc * renamed is/setTypeName as has/setTypename llvm-svn: 186816
* Silence GCC warning for using both enum and unsigned in a ternary expr.Benjamin Kramer2013-07-201-1/+1
| | | | llvm-svn: 186762
* OpenMP: basic support for #pragma omp parallelAlexey Bataev2013-07-192-9/+239
| | | | llvm-svn: 186647
* This patch removes unused parameter allProperties and converts remainingFariborz Jahanian2013-07-161-4/+1
| | | | | | | parameters in ArrayRef'ize Sema::ActOnAtEnd to ArrayRef. Patch by Robert Wilhelm. llvm-svn: 186421
* Change cxx0x to cxx11 in diagnostic name.Craig Topper2013-07-141-1/+1
| | | | llvm-svn: 186286
* Provide a better diagnostic and a fixit for a '.' or '->' before the left parenKaelyn Uhrain2013-07-121-1/+13
| | | | | | | | of a function call. This fixes PR5898 and means we now have a better diagnostic here than GCC. llvm-svn: 186208
* PR5066: If a declarator cannot have an identifier, and cannot possibly beRichard Smith2013-07-111-0/+6
| | | | | | | | | 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
* ArrayRef'ize Sema::FinalizeDeclaratorGroup, Sema::BuildDeclaratorGroup andRafael Espindola2013-07-093-8/+5
| | | | | | | | Sema::ActOnDocumentableDecls. Patch by Robert Wilhelm. llvm-svn: 185931
* Use SmallVectorImpl::reverse_iterator instead of SmallVector to avoid ↵Craig Topper2013-07-081-2/+2
| | | | | | specifying the vector size. llvm-svn: 185784
* Fixed source location info for UnaryTransformTypeLoc nodes.Enea Zaffanella2013-07-061-0/+1
| | | | llvm-svn: 185765
* Use SmallVectorImpl& for function arguments instead of SmallVector.Craig Topper2013-07-051-2/+2
| | | | llvm-svn: 185715
* Use SmallVectorImpl instead of SmallVector for iterators and references to ↵Craig Topper2013-07-042-2/+2
| | | | | | avoid specifying the vector size unnecessarily. llvm-svn: 185610
* PR16480: Reimplement token-caching for constructor initializer lists. ThisRichard Smith2013-07-041-59/+147
| | | | | | | | | | | | | | | 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-032-0/+13
| | | | | | | | | | | | | | | | | 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
* ArrayRef'ize Sema::CodeCompleteConstructorInitializerDmitri Gribenko2013-06-231-3/+2
| | | | | | Patch by Robert Wilhelm. llvm-svn: 184675
* Add null check (resolves PR16423)Stephen Lin2013-06-231-15/+14
| | | | llvm-svn: 184661
OpenPOWER on IntegriCloud