summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
...
* Add support for WG21 N3599 (literal operator template for strings) as a GNURichard Smith2013-10-073-48/+135
| | | | | | | | | extension. The GCC folks have decided to support this even though the standard committee have not yet approved this feature. Patch by Hristo Venev! llvm-svn: 192128
* ObjectiveC: Warn when 'readonly' property has explicitFariborz Jahanian2013-10-071-118/+39
| | | | | | | ownership attribute (such as 'copy', 'assign' etc.) // rdar://15131088 llvm-svn: 192115
* Sema::tryCaptureVariable(): Prune three unused variables, HasBlocksAttr, ↵NAKAMURA Takumi2013-10-071-4/+0
| | | | | | IsBlock, and IsLambda. [-Wunused-variable] llvm-svn: 192095
* Refactor tryCaptureVar using ExtractMethod. No functionality change.Faisal Vali2013-10-071-301/+394
| | | | | | | | | | In chicago, Doug had requested that I go ahead and commit the refactor as a separate change, if all the tests passed. Lets hope the buildbots stay quiet. Thanks! llvm-svn: 192087
* Switching the CallableWhen attribute over to using the string literal helper ↵Aaron Ballman2013-10-051-17/+11
| | | | | | function instead of custom logic. llvm-svn: 192050
* Silencing an MSVC warning; SmallSet::count returns a bool instead of a size_t.Aaron Ballman2013-10-051-1/+1
| | | | llvm-svn: 192043
* Sema: Cleanup redundant variable NumArgsToCheckBenjamin Kramer2013-10-051-4/+1
| | | | | | Patch by Daniel Marjamäki! llvm-svn: 192030
* Consumed Analysis: Change callable_when so that it can take a list of statesDeLesley Hutchins2013-10-042-30/+42
| | | | | | | | that a function can be called in. This reduced the total number of annotations needed and makes writing more complicated behaviour less burdensome. Patch by chriswails@gmail.com. llvm-svn: 191983
* ObjectiveC. Allow readonly properties without an explicit ownershipFariborz Jahanian2013-10-041-24/+34
| | | | | | | | (assign/unsafe_unretained/weak/retain/strong/copy) in super class to be overridden by a property with any explicit ownership in the subclass. // rdar://15014468 llvm-svn: 191971
* Revert "Teach TreeTransform and family how to transform generic lambdas ↵Rafael Espindola2013-10-043-153/+28
| | | | | | | | within templates and nested within themselves." This reverts commit r191879. It caused llvm.org/pr17476. llvm-svn: 191955
* Gracefully (and correctly) handle init of multiple union membersMatthew Curtis2013-10-031-1/+22
| | | | | | | | | | | | | | | We now emit warnings when doing so and code generation is consistent with GCC. Note that the C99 spec is unclear as to the precise behavior. See also ... Bug: http://llvm.org/bugs/show_bug.cgi?id=16644 and cfe-dev discussion: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-September/031918.html llvm-svn: 191890
* Teach TreeTransform and family how to transform generic lambdas within ↵Faisal Vali2013-10-033-28/+153
| | | | | | | | | | | | | | | | | templates and nested within themselves. This does not yet include capturing (that is next). Please see test file for examples. This patch was LGTM'd by Doug: http://llvm-reviews.chandlerc.com/D1784 http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130930/090048.html When I first committed this patch - a bunch of buildbots were unable to compile the code that VS2010 seemed to compile. Seems like there was a dependency on Sema/Template.h which VS did not seem to need, but I have now added for the other compilers. It still compiles on Visual Studio 2010 - lets hope the buildbots remain quiet (please!) llvm-svn: 191879
* Revert changes from the nested lambdas commit till i figure out Faisal Vali2013-10-033-152/+28
| | | | | | why the buildbots are failing. llvm-svn: 191876
* Teach TreeTransform and family how to transform generic lambdas within ↵Faisal Vali2013-10-033-28/+152
| | | | | | | | | | | | | | templates and nested within themselves. This does not yet include capturing (that is next). Please see test file for examples. This patch was LGTM'd by Doug: http://llvm-reviews.chandlerc.com/D1784 llvm-svn: 191875
* Speed up CorrectTypo by avoiding lookups on unreasonable candidates.Kaelyn Uhrain2013-10-021-37/+47
| | | | llvm-svn: 191846
* Fix gcc -Wunused-but-set-variable warning in r191634.Patrik Hagglund2013-10-021-5/+2
| | | | llvm-svn: 191817
* Implement ARM GNU-style interrupt attributeTim Northover2013-10-012-1/+48
| | | | | | | | | | This attribute allows users to use a modified C or C++ function as an ARM exception-handling function and, with care, to successfully return control to user-space after the issue has been dealt with. rdar://problem/14207019 llvm-svn: 191769
* Move checkStringLiteralArgument into Sema classTim Northover2013-10-011-16/+15
| | | | | | It's a useful function to have around for target-specific attributes. llvm-svn: 191768
* [OpenMP] Added parsing and semantic analysis for firstprivate clauseAlexey Bataev2013-10-012-16/+270
| | | | llvm-svn: 191730
* Fix typo correction usage of SemaAccess.cpp.Eli Friedman2013-10-012-6/+4
| | | | | | | | | | When we check access for lookup results, make sure we propagate the result's access to the access control APIs; this can be different from the natural access of the declaration depending on the path used by the lookup. PR17394. llvm-svn: 191726
* Tweak changes in r186464 to avoid a crash.Eli Friedman2013-10-011-1/+4
| | | | | | | | | | | | | Currently, IR generation can't handle file-scope compound literals with non-constant initializers in C++. Fixes PR17415 (the first crash in the bug). (We should probably change (T){1,2,3} to use the same codepath as T{1,2,3} in C++ eventually, given that the semantics of the latter are actually defined by the standard.) llvm-svn: 191719
* Remove support for arrays of runtime bound in C++1y, now they have been votedRichard Smith2013-10-012-6/+1
| | | | | | out of the working paper. This reverts r179962 and r179992. llvm-svn: 191718
* Fix use-after-free.Manuel Klimek2013-09-301-3/+3
| | | | | | | | TemplateDeclInstantiator takes the MultiLevelArgumentList by const-ref and stores a const-ref member. Thus, we must not pass a temporary into the constructor. llvm-svn: 191665
* SemaTemplateDeduction.cpp: Suppress a warning. [-Wunused-variable]NAKAMURA Takumi2013-09-301-1/+1
| | | | llvm-svn: 191648
* Remove an unnecessary overload from ASTLambda.h Faisal Vali2013-09-291-1/+1
| | | | | | | As Richard pointed out to me, dyn_cast is very cheap - there is no real benefit from adding cluttery overloads to only avoid that cast. No functionality change. llvm-svn: 191646
* Fix windows newlines :(Faisal Vali2013-09-292-134/+134
| | | | llvm-svn: 191641
* Implement conversion to function pointer for generic lambdas without captures.Faisal Vali2013-09-293-56/+278
| | | | | | | | | | | | | | | | The general strategy is to create template versions of the conversion function and static invoker and then during template argument deduction of the conversion function, create the corresponding call-operator and static invoker specializations, and when the conversion function is marked referenced generate the body of the conversion function using the corresponding static-invoker specialization. Similarly, Codegen does something similar - when asked to emit the IR for a specialized static invoker of a generic lambda, it forwards emission to the corresponding call operator. This patch has been reviewed in person both by Doug and Richard. Richard gave me the LGTM. A few minor changes: - per Richard's request i added a simple check to gracefully inform that captures (init, explicit or default) have not been added to generic lambdas just yet (instead of the assertion violation). - I removed a few lines of code that added the call operators instantiated parameters to the currentinstantiationscope. Not only did it not handle parameter packs, but it is more relevant in the patch for nested lambdas which will follow this one, and fix that problem more comprehensively. - Doug had commented that the original implementation strategy of using the TypeSourceInfo of the call operator to create the static-invoker was flawed and allowed const as a member qualifier to creep into the type of the static-invoker. I currently kludge around it - but after my initial discussion with Doug, with a follow up session with Richard, I have added a FIXME so that a more elegant solution that involves the use of TrivialTypeSourceInfo call followed by the correct wiring of the template parameters to the functionprototypeloc is forthcoming. Thanks! llvm-svn: 191634
* Implement C++1y sized deallocation (n3778). This is not enabled by -std=c++1y;Richard Smith2013-09-291-55/+139
| | | | | | | instead, it's enabled by the -cc1 flag -fsized-deallocation, until we sort out the backward-compatibility issues. llvm-svn: 191629
* Make helper function static.Benjamin Kramer2013-09-281-1/+1
| | | | llvm-svn: 191615
* Add compat/extension warnings for init captures.Richard Smith2013-09-281-0/+4
| | | | llvm-svn: 191609
* Switch from putting init capture VarDecls in the surrounding DeclContext toRichard Smith2013-09-282-5/+12
| | | | | | | | putting them in the call operator's DeclContext. This better matches the language wording and avoids some cases where code gets confused by them for namespace-scope lambdas and the like. llvm-svn: 191606
* Per latest drafting, switch to implementing init-captures as if by declaringRichard Smith2013-09-285-138/+110
| | | | | | and capturing a variable declaration, and complete the implementation of them. llvm-svn: 191605
* Fix a bug where we failed to diagnose class template specializationChandler Carruth2013-09-271-0/+3
| | | | | | | | | uses. This fixes one of the two remaining failures to implement [[deprecated]] as specified for C++14. llvm-svn: 191572
* Variable templates: handle instantiation of static data member templatesRichard Smith2013-09-275-140/+191
| | | | | | appropriately, especially when they appear within class templates. llvm-svn: 191548
* Cache the location of failed typo corrections so that typo correctionKaelyn Uhrain2013-09-272-28/+29
| | | | | | isn't repeatedly attempted for the same identifier at the same location. llvm-svn: 191543
* Sema: Respect -fdelayed-template-parsing when parsing constexpr functionsDavid Majnemer2013-09-271-3/+5
| | | | | | | | | | | | | | 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
* Fix error recovery when a return type correction includes a new name specifier.Kaelyn Uhrain2013-09-261-1/+6
| | | | llvm-svn: 191459
* Implement a rudimentary form of generic lambdas.Faisal Vali2013-09-268-57/+239
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically, the following features are not included in this commit: - any sort of capturing within generic lambdas - generic lambdas within template functions and nested within other generic lambdas - conversion operator for captureless lambdas - ensuring all visitors are generic lambda aware (Although I have gotten some useful feedback on my patches of the above and will be incorporating that as I submit those patches for commit) As an example of what compiles through this commit: 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. This patch has been reviewed by Doug and Richard. Minor changes (non-functionality affecting) have been made since both of them formally looked at it, but the changes involve removal of supernumerary return type deduction changes (since they are now redundant, with richard having committed a recent patch to address return type deduction for C++11 lambdas using C++14 semantics). Some implementation notes: - Add a new Declarator context => LambdaExprParameterContext to clang::Declarator to allow the use of 'auto' in declaring generic lambda parameters - 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 SemaType.cpp::ConvertDeclSpecToType may use it to immediately generate a template-parameter-type when 'auto' is parsed in a generic lambda parameter context. (i.e we do NOT use AutoType deduced to a template parameter type - Richard seemed ok with this approach). We encode that this template type was generated from an auto by simply adding $auto to the name which can be used for better diagnostics if needed. - 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. - various tests were added - but much more will be needed. There is obviously more work to be done, and both Richard (weakly) and Doug (strongly) have requested that LambdaExpr be removed form the CXXRecordDecl LambdaDefinitionaData in a future patch which is forthcoming. A greatful thanks to all reviewers including Eli Friedman, James Dennett, and especially the two gracious wizards (Richard Smith and Doug Gregor) who spent hours providing feedback (in person in Chicago and on the mailing lists). 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: 191453
* Fix a bug in the typo correction replacement location.Kaelyn Uhrain2013-09-261-1/+3
| | | | | | | | I noticed the wrong text was being replaced with the correction while working on expanding the "namespace-aware" typo correction to include classes. llvm-svn: 191450
* Teach typo correction to look inside of classes like it does namespaces.Kaelyn Uhrain2013-09-262-5/+104
| | | | | | | | | | | | | | | Unlike with namespaces, searching inside of classes requires also checking the access to correction candidates (i.e. don't suggest a correction to a private class member for a correction occurring outside that class and its methods or friends). Included is a small (one line) fix for a bug, that was uncovered while cleaning up the unit tests, where the decls from a TypoCorrection candidate were preserved in new TypoCorrection candidates that are derived (copied) from the old TypoCorrection--notably when creating a new candidate by changing the NestedNameSpecifier associated with the base idenitifer. llvm-svn: 191449
* If a partial specialization of a member template is declared within a classRichard Smith2013-09-262-5/+17
| | | | | | | | | template and defined outside it, don't instantiate it twice when instantiating the surrounding class template specialization. That would cause us to reject the code because we think two partial specializations instantiated to produce the same signature. llvm-svn: 191418
* [OPENMP] Improved variable lookup procedure for threadprivate variables.Alexey Bataev2013-09-261-2/+35
| | | | llvm-svn: 191416
* ObjectiveC: Handle the case of qualifying protocolsFariborz Jahanian2013-09-251-0/+23
| | | | | | | | | declared in a typedef declaraton used as super class of an ObjC class. Curretnly, these protocols are dropped from the class hierarchy. Test shows that it is now included. // rdar://15051465 llvm-svn: 191395
* Sema: Simplify code a bit, plug a potential leak.Benjamin Kramer2013-09-251-20/+12
| | | | | | No intended functionality change. llvm-svn: 191370
* Refactor to use C++1y 'auto' semantics directly in lambdas with no specifiedRichard Smith2013-09-253-50/+94
| | | | | | | return type in C++1y mode. No functionality change intended. Extracted and tweaked from a patch by Faisal Vali! llvm-svn: 191354
* Allow dynamic_cast to void* even with -fno-rtti.Eli Friedman2013-09-241-2/+4
| | | | | | PR17346. llvm-svn: 191340
* Fix -Wmissing-variable-declarations regression.Eli Friedman2013-09-241-1/+1
| | | | | | | | This issue was introduced in r181677. PR17349. llvm-svn: 191339
* Revert my patch in r191155 to allow forwardFariborz Jahanian2013-09-241-12/+0
| | | | | | | | class/protocol decls in @implementation and fixup modern rewriter to handle that. // rdar://15066233 llvm-svn: 191311
* Module use declarations (II)Daniel Jasper2013-09-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Review: http://llvm-reviews.chandlerc.com/D1546. I have picked up this patch form Lawrence (http://llvm-reviews.chandlerc.com/D1063) and did a few changes. From the original change description (updated as appropriate): This patch adds a check that ensures that modules only use modules they have so declared. To this end, it adds a statement on intended module use to the module.map grammar: use module-id A module can then only use headers from other modules if it 'uses' them. This enforcement is off by default, but may be turned on with the new option -fmodules-decluse. When enforcing the module semantics, we also need to consider a source file part of a module. This is achieved with a compiler option -fmodule-name=<module-id>. The compiler at present only applies restrictions to the module directly being built. llvm-svn: 191283
* Implement restriction that a partial specialization must actually specializeRichard Smith2013-09-241-3/+82
| | | | | | something, for variable templates. llvm-svn: 191278
OpenPOWER on IntegriCloud