summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Unbreak the Clang -Werror build by removing some unused variablesDavid Blaikie2013-11-071-11/+6
| | | | llvm-svn: 194190
* This patch implements capturing of variables within generic lambdas.Faisal Vali2013-11-071-11/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both Richard and I felt that the current wording in the working paper needed some tweaking - Please see http://llvm-reviews.chandlerc.com/D2035 for additional context and references to core-reflector messages that discuss wording tweaks. What is implemented is what we had intended to specify in Bristol; but, recently felt that the specification might benefit from some tweaking and fleshing. As a rough attempt to explain the semantics: If a nested lambda with a default-capture names a variable within its body, and if the enclosing full expression that contains the name of that variable is instantiation-dependent - then an enclosing lambda that is capture-ready (i.e. within a non-dependent context) must capture that variable, if all intervening nested lambdas can potentially capture that variable if they need to, and all intervening parent lambdas of the capture-ready lambda can and do capture the variable. Of note, 'this' capturing is also currently underspecified in the working paper for generic lambdas. What is implemented here is if the set of candidate functions in a nested generic lambda includes both static and non-static member functions (regardless of viability checking - i.e. num and type of parameters/arguments) - and if all intervening nested-inner lambdas between the capture-ready lambda and the function-call containing nested lambda can capture 'this' and if all enclosing lambdas of the capture-ready lambda can capture 'this', then 'this' is speculatively captured by that capture-ready lambda. Hopefully a paper for the C++ committee (that Richard and I had started some preliminary work on) is forthcoming. This essentially makes generic lambdas feature complete, except for known bugs. The more prominent ones (and the ones I am currently aware of) being: - generic lambdas and init-captures are broken - but a patch that fixes this is already in the works ... - nested variadic expansions such as: auto K = [](auto ... OuterArgs) { vp([=](auto ... Is) { decltype(OuterArgs) OA = OuterArgs; return 0; }(5)...); return 0; }; auto M = K('a', ' ', 1, " -- ", 3.14); currently cause crashes. I think I know how to fix this (since I had done so in my initial implementation) - but it will probably take some work and back & forth with Doug and Richard. A warm thanks to all who provided feedback - and especially to Doug Gregor and Richard Smith for their pivotal guidance: their insight and prestidigitation in such matters is boundless! Now let's hope this commit doesn't upset the buildbot gods ;) Thanks! llvm-svn: 194188
* Fix diagnostic goof in r194161.Richard Smith2013-11-061-2/+2
| | | | llvm-svn: 194162
* Add a limit to the length of a sequence of 'operator->' functions we willRichard Smith2013-11-061-6/+41
| | | | | | | follow when building a class member access expression. Based on a patch by Rahul Jain! llvm-svn: 194161
* Implement final resolution of DR1402: implicitly-declared move operators thatRichard Smith2013-11-041-2/+2
| | | | | | | | | | | would be deleted are still declared, but are ignored by overload resolution. Also, don't delete such members if a subobject has no corresponding move operation and a non-trivial copy. This causes us to implicitly declare move operations in more cases, but risks move-assigning virtual bases multiple times in some circumstances (a warning for that is to follow). llvm-svn: 193969
* [-fms-extensions] Permit 'override' in C++98 and 'sealed' as a synonym for ↵David Majnemer2013-10-181-0/+6
| | | | | | | | | | | | | | 'final' Summary: Some MS headers use these features. Reviewers: rnk, rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1948 llvm-svn: 192936
* Convert anachronistic use of 'void *' to 'DeclContext *' in Scope that was a ↵Ted Kremenek2013-10-081-1/+1
| | | | | | holdover from the long-dead Action interface. llvm-svn: 192203
* 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
* PR16529: Don't forget to add the CXXFunctionalCastExpr type sugar to anRichard Smith2013-09-231-8/+11
| | | | | | | InitListExpr for a C++11-style T{...} construction, if initialization registered a destructor for it. llvm-svn: 191182
* Avoid getting an argument of allocation function if it does not exist.Serge Pavlov2013-09-141-11/+12
| | | | | | | | This is a fix to PR12778: in erroneous code an allocation function can be declared with no arguments, quering the first argument in this case causes assertion violation. llvm-svn: 190751
* Fix is_trivially_constructible preconditions.Eli Friedman2013-09-111-12/+12
| | | | | | | | | Fixes a crash in cases where the first argument was an incomplete type or an uninstantiated template type. <rdar://problem/14938471> llvm-svn: 190482
* AST: __uuidof should leak through templated typesDavid Majnemer2013-09-071-7/+17
| | | | | | | | | | | | | | | 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
* Properly track l-paren of a CXXFucntionalCastExpr.Eli Friedman2013-08-151-2/+3
| | | | | | | | | | In addition to storing more useful information in the AST, this fixes a semantic check in template instantiation which checks whether the l-paren location is valid. Fixes PR16903. llvm-svn: 188495
* A few small cleanups to r187504. Thanks to dblaikie for the assist.Kaelyn Uhrain2013-07-311-8/+7
| | | | llvm-svn: 187521
* Improve the diagnostic experience, including adding recovery, forKaelyn Uhrain2013-07-311-3/+34
| | | | | | changing '->' to '.' when there is no operator-> defined for a class. llvm-svn: 187504
* ObjectiveC arc: Move check for type conversions in arcFariborz Jahanian2013-07-311-1/+2
| | | | | | | | out of ImpCastExprToType and to the caller site as appropriate. This is in prep. to do more work for // rdar://14569171 llvm-svn: 187503
* Add missing check for creating an instance of an abstract class through anRichard Smith2013-07-201-1/+5
| | | | | | implicit conversion sequence. llvm-svn: 186769
* If an unimported submodule of an imported module contains a declaration of aRichard Smith2013-07-141-1/+5
| | | | | | | global allocation or deallocation function, that should not cause that global allocation or deallocation function to become unavailable. llvm-svn: 186270
* contextual conversion fix: C++98 compatibility warning.Larisse Voufo2013-06-181-2/+3
| | | | llvm-svn: 184167
* r184100 Fix -- Updated test cases for contextual conversionLarisse Voufo2013-06-181-3/+3
| | | | llvm-svn: 184165
* Revert "Updated test cases for contextual conversion"Rafael Espindola2013-06-171-3/+3
| | | | | | | | | This reverts commit r184100. It was faling on some bots: http://bb.pgr.jp/builders/cmake-clang-i686-mingw32/builds/1973/steps/test_clang/logs/Clang%20%3A%3A%20SemaCXX__cxx1y-contextual-conversion-tweaks.cpp llvm-svn: 184108
* Updated test cases for contextual conversionLarisse Voufo2013-06-171-3/+3
| | | | llvm-svn: 184100
* Updated the support for contextual conversion tweaks (n3323) with a ↵Larisse Voufo2013-06-151-56/+85
| | | | | | previously overlooked part: implicitly converting array sizes to size_t, rather than contextually converting them to some unique type. llvm-svn: 184048
* Allow paren casted throw statements inside of ternary expressionsDavid Majnemer2013-06-021-2/+2
| | | | | | | | | | | | | | clang would incorrectly not allow the following: int x = true ? (throw 1) : 2; The problem exists because we don't see beyond the parens. This, in turn, causes us to believe that we are choosing between void and int which we diagnose as an error. Instead, allow clang to see the 'throw' inside the parens. llvm-svn: 183085
* Add support to fallback on operator new when a placement operator new[] is ↵Aaron Ballman2013-05-301-0/+15
| | | | | | called for which there is no valid declaration. This fallback only happens in Microsoft compatibility mode. This patch addresses PR13164, and improves support for the WDK. llvm-svn: 182905
* PR14772: Support constant expression evaluation for _Atomic types.Richard Smith2013-05-231-6/+16
| | | | | | | | | * Treat _Atomic(T) as a literal type if T is a literal type. * Evaluate expressions of this type properly. * Fix a lurking bug where we built completely bogus ASTs for converting to _Atomic types in C++ in some cases, caught by the tests for this change. llvm-svn: 182541
* Refactor places which perform contextual implicit conversions to go through aRichard Smith2013-05-211-75/+79
| | | | | | | | | | | | | common function. The C++1y contextual implicit conversion rules themselves are not yet implemented, however. This also fixes a subtle bug where template instantiation context notes were dropped for diagnostics coming from conversions for integral constant expressions -- we were implicitly slicing a SemaDiagnosticBuilder into a DiagnosticBuilder when producing these diagnostics, and losing their context notes in the process. llvm-svn: 182406
* ArrayRef'ize Sema::FindAllocationFunctionsDmitri Gribenko2013-05-101-28/+19
| | | | | | Patch by Robert Wilhelm. llvm-svn: 181594
* ArrayRef'ize Sema::FindAllocationOverloadDmitri Gribenko2013-05-101-23/+16
| | | | | | | Now tests should pass. The previous error was caused by a misplaced backing array for MutableArrayRef that I introduced. llvm-svn: 181570
* Revert my r181563, breaks tests on buildbotsDmitri Gribenko2013-05-101-16/+23
| | | | llvm-svn: 181568
* ArrayRef'ize Sema::FindAllocationOverloadDmitri Gribenko2013-05-091-23/+16
| | | | llvm-svn: 181563
* ArrayRef'ize some SemaOverload methodsDmitri Gribenko2013-05-091-2/+3
| | | | | | Patch by Robert Wilhelm. llvm-svn: 181544
* Replace 'MultiExprArg()' with 'None'Dmitri Gribenko2013-05-051-2/+2
| | | | llvm-svn: 181166
* ArrayRef'ization of some methods in SemaOverload. Patch by Robert Wilhelm!Richard Smith2013-05-051-1/+1
| | | | llvm-svn: 181158
* Don't build a call expression referring to a function which we're not allowedRichard Smith2013-05-041-7/+14
| | | | | | | | | to use. This makes very little difference right now (other than suppressing follow-on errors in some cases), but will matter more once we support deduced return types (we don't want expressions with undeduced return types in the AST). llvm-svn: 181107
* ArrayRef'ize InitializationSequence constructor and ↵Dmitri Gribenko2013-05-031-34/+28
| | | | | | | | InitializationSequence::Diagnose() Patch by Robert Wilhelm. llvm-svn: 181022
* Move parsing of identifiers in MS-style inline assembly intoJohn McCall2013-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | | the actual parser and support arbitrary id-expressions. We're actually basically set up to do arbitrary expressions here if we wanted to. Assembly operands permit things like A::x to be written regardless of language mode, which forces us to embellish the evaluation context logic somewhat. The logic here under template instantiation is incorrect; we need to preserve the fact that an expression was unevaluated. Of course, template instantiation in general is fishy here because we have no way of delaying semantic analysis in the MC parser. It's all just fishy. I've also fixed the serialization of MS asm statements. This commit depends on an LLVM commit. llvm-svn: 180976
* When deducing an 'auto' type, don't modify the type-as-written.Richard Smith2013-04-301-5/+3
| | | | llvm-svn: 180808
* Don't treat a non-deduced 'auto' type as being type-dependent. Instead, thereRichard Smith2013-04-301-3/+4
| | | | | | | | are now two distinct canonical 'AutoType's: one is the undeduced 'auto' placeholder type, and the other is a deduced-but-dependent type. All deduced-to-a-non-dependent-type cases are still non-canonical. llvm-svn: 180789
* Small CapturedStmt improvementsBen Langmuir2013-04-291-22/+17
| | | | | | | | | | | | | Add a CapturedStmt.h similar to Lambda.h to reduce the typing required to get to the CapturedRegionKind enum. This also allows codegen to access this enum without including Sema/ScopeInfo.h. Also removes some duplicated code for capturing 'this' between CapturedStmt and Lambda. Differential Revision: http://llvm-reviews.chandlerc.com/D712 llvm-svn: 180710
* Implement C++1y decltype(auto).Richard Smith2013-04-261-1/+1
| | | | llvm-svn: 180610
* C++1y constexpr extensions, round 1: Allow most forms of declaration andRichard Smith2013-04-221-1/+1
| | | | | | | | statement in constexpr functions. Everything which doesn't require variable mutation is also allowed as an extension in C++11. 'void' becomes a literal type to support constexpr functions which return 'void'. llvm-svn: 180022
* Sema for Captured StatementsTareq A. Siraj2013-04-161-0/+13
| | | | | | | | | | | | | Add CapturedDecl to be the DeclContext for CapturedStmt, and perform semantic analysis. Currently captures all variables by reference. TODO: templates Author: Ben Langmuir <ben.langmuir@intel.com> Differential Revision: http://llvm-reviews.chandlerc.com/D433 llvm-svn: 179618
* Basic support for Microsoft property declarations andJohn McCall2013-04-161-0/+5
| | | | | | | | references thereto. Patch by Tong Shen! llvm-svn: 179585
* Add 178663 back.Rafael Espindola2013-04-031-3/+2
| | | | | | | | | | | http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green before it processed the reverted 178663, so it could not have been the culprit. Revert "Revert 178663." This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41. llvm-svn: 178682
* Revert 178663.Rafael Espindola2013-04-031-2/+3
| | | | | | | | | | Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb Revert "Don't compute a patched/semantic storage class." This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05. llvm-svn: 178681
* Don't compute a patched/semantic storage class.Rafael Espindola2013-04-031-3/+2
| | | | | | | | | | | For variables and functions clang used to store two storage classes. The one "as written" in the code and a patched one, which, for example, propagates static to the following decls. This apparently is from the days clang lacked linkage computation. It is now redundant and this patch removes it. llvm-svn: 178663
* Implement compiler intrinsics needed for compatibility with MSVC 2012 ↵Joao Matos2013-03-271-31/+76
| | | | | | | | <type_traits>. Patch by me and Ryan Molden. llvm-svn: 178111
* Implement special-case name lookup for inheriting constructors: memberRichard Smith2013-03-261-0/+37
| | | | | | | using-declarations with names which look constructor-like are interpreted as constructor names. llvm-svn: 177957
* PR7256: Provide a fixit for incorrect destructor declarationsDavid Blaikie2013-03-201-2/+10
| | | | | | Fix by Ismail Pazarbasi (ismail.pazarbasi@gmail.com), review by Dmitri Gribenko. llvm-svn: 177546
OpenPOWER on IntegriCloud