summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/TreeTransform.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix missing source location in CXXTemporaryObjectExpr nodes.Enea Zaffanella2013-09-071-2/+2
| | | | | | | | For clarity, renamed (get/set)ParenRange as (get/set)ParenOrBraceRange in CXXConstructExpr nodes. Added testcase. llvm-svn: 190239
* OpenMP: Data-sharing attributes analysis and clause 'shared' (fixed test ↵Alexey Bataev2013-09-061-9/+47
| | | | | | threadprivate_messages.cpp) llvm-svn: 190183
* Reduce stack usage of TreeTransform.Eli Friedman2013-09-061-0/+5
| | | | | | | | | | | | | | | Without this patch, TreeTransform::TransformExpr uses a ridiculous amount of stack space (around 5000 bytes). Preventing inlining brings the stack usage down to something sane. On a testcase I have, on my computer, this allows changing -ftemplate-depth from 210 to around 750 before we crash. I'm not sure I should commit the testcase, though: I don't want to cause test failures on platforms with less stack space available. <rdar://problem/14098189>. llvm-svn: 190114
* Clear LookupResult object if invalid candidate is found.Serge Pavlov2013-09-041-3/+9
| | | | | | | If source code is invalid, error recovery can lead to name lookup in a set containing invalid declaration. The lookup is stopped once found such declaration, but LookupResult object could remain in inconsistent state. Its destructor triggered a check, which caused assert violation. This patch fixes PR16964 and PR12791. llvm-svn: 189916
* Revert "OpenMP: Data-sharing attributes analysis and clause 'shared'"Rafael Espindola2013-09-031-47/+9
| | | | | | | | 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-9/+47
| | | | llvm-svn: 189795
* Cleanup of OpaquePtr. No functionality changes.Serge Pavlov2013-08-271-1/+1
| | | | | | | | - Some documenation were added. - Usages of OpaquePtr<A>.getAsVal<A>() were replaced by OpaquePtr<A>.get(). - Methods getAs and getAsVal were renamed to getPtrTo and getPtrAs respectively. llvm-svn: 189346
* Revert "Implement a rudimentary form of generic lambdas."Manuel Klimek2013-08-221-21/+5
| | | | | | This reverts commit 606f5d7a99b11957e057e4cd1f55f931f66a42c7. llvm-svn: 189004
* const'ify Sema::ActOnCXXTryBlock byRobert Wilhelm2013-08-221-3/+2
| | | | | | | | changing Parameter from MutableArrayRef to ArrayRef. No functionality change intended. llvm-svn: 188994
* Implement a rudimentary form of generic lambdas.Faisal Vali2013-08-221-5/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Properly track l-paren of a CXXFucntionalCastExpr.Eli Friedman2013-08-151-1/+1
| | | | | | | | | | 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
* Omit llvm:: before SmallVector and SmallVectorImpl. We have using directive ↵Robert Wilhelm2013-08-101-3/+3
| | | | | | in include/clang/Basic/LLVM.h. llvm-svn: 188138
* Expose LambdaIntroducer::DefaultLoc in the AST's LambdaExpr.James Dennett2013-08-091-0/+1
| | | | | | | | | | | | | | | | | | | | | Summary: Source-centric tools need access to the location of a C++11 lambda expression's capture-default ('&' or '=') when it's present. It's possible for them to find it by re-lexing and re-implementing rules that Clang's parser has already applied, but the cost of storing the SourceLocation and making it available to them is 32 bits per LambdaExpr (a small delta, proportionally), and the simplification in client code is significant. Reviewers: rsmith Reviewed By: rsmith CC: cfe-commits, klimek, revane Differential Revision: http://llvm-reviews.chandlerc.com/D1192 llvm-svn: 188121
* Improve clarity/consistency of a few UsingDecl methods and related helpers.Enea Zaffanella2013-07-221-1/+1
| | | | | | | | | | | | 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
* FIXME fix: improving diagnostics for template arguments deduction of class ↵Larisse Voufo2013-07-191-4/+0
| | | | | | | | templates and explicit specializations This patch essentially removes all the FIXMEs following calls to DeduceTemplateArguments() that want to keep track of deduction failure info. llvm-svn: 186730
* Fix pack instantiation with function types.Eli Friedman2013-07-191-0/+4
| | | | | | | Make sure we correctly expand packs which expand to another pack in a function type. llvm-svn: 186728
* Correctly handle packs for variadic type traits.Eli Friedman2013-07-191-0/+13
| | | | | | | | | | | | | | | I'm not sure how to write a test for this; the following shows the difference in -ast-dump: template <int x> struct A {}; template <class T> struct B { }; template <class ...Args> using C = A<(__is_trivially_constructible(Args...))>; template <class ...Args> using D = C<B<Args>...>; However, I can't seem to write a test that triggers a visible difference in behavior. llvm-svn: 186726
* OpenMP: basic support for #pragma omp parallelAlexey Bataev2013-07-191-0/+130
| | | | llvm-svn: 186647
* Use llvm::array_lengthof to replace sizeof(array)/sizeof(array[0]).Craig Topper2013-07-151-1/+1
| | | | llvm-svn: 186300
* ArrayRef'ize Sema::FinalizeDeclaratorGroup, Sema::BuildDeclaratorGroup andRafael Espindola2013-07-091-6/+4
| | | | | | | | Sema::ActOnDocumentableDecls. Patch by Robert Wilhelm. llvm-svn: 185931
* [AST] Introduce a new DecayedType sugar nodeReid Kleckner2013-06-241-0/+16
| | | | | | | | | | | | | | The goal of this sugar node is to be able to look at an arbitrary FunctionType and tell if any of the parameters were decayed from an array or function type. Ultimately this is necessary to implement Microsoft's C++ name mangling scheme, which mangles decayed arrays differently from normal pointers. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D1014 llvm-svn: 184763
* Fix one place I missed that was memcpy'ing TypeLocs in a way that messesEli Friedman2013-06-201-2/+2
| | | | | | | | | up alignment. Fixes utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp from the libc++ testsuite. llvm-svn: 184397
* Unify return type checking for functions and ObjC methods. Move all theEli Friedman2013-06-141-9/+0
| | | | | | | | random checks for ObjC object return types to SemaType.cpp. Fixes issue with ObjC method type checking reported on cfe-dev. llvm-svn: 184006
* PR12086, PR15117Richard Smith2013-06-121-0/+11
| | | | | | | | | | | | | | | | | | | Introduce CXXStdInitializerListExpr node, representing the implicit construction of a std::initializer_list<T> object from its underlying array. The AST representation of such an expression goes from an InitListExpr with a flag set, to a CXXStdInitializerListExpr containing a MaterializeTemporaryExpr containing an InitListExpr (possibly wrapped in a CXXBindTemporaryExpr). This more detailed representation has several advantages, the most important of which is that the new MaterializeTemporaryExpr allows us to directly model lifetime extension of the underlying temporary array. Using that, this patch *drastically* simplifies the IR generation of this construct, provides IR generation support for nested global initializer_list objects, fixes several bugs where the destructors for the underlying array would accidentally not get invoked, and provides constant expression evaluation support for std::initializer_list objects. llvm-svn: 183872
* Re-commit r183466 with a fix to make the TypeLoc casting machinery workEli Friedman2013-06-071-1/+1
| | | | | | | | | correctly in the presence of qualified types. (I had to change the unittest because it was trying to cast a QualifiedTypeLoc to TemplateSpecializationTypeLoc.) llvm-svn: 183563
* Reverts r183466: "Perform dynamic alignment computations..."Manuel Klimek2013-06-071-1/+1
| | | | | | | | | This introduces bugs in TemplateSpecializationTypeLoc's angle bracket locations. Regression test follows in a subsequent commit. llvm-svn: 183513
* PR16243: Use CXXThisOverride during template instantiation, and fix up theRichard Smith2013-06-071-12/+1
| | | | | | | | places which weren't setting it up properly. This allows us to get the right cv-qualifiers for 'this' when it appears outside a method body in a class template. llvm-svn: 183483
* Perform dynamic alignment computations so that the data in TypeLocs isEli Friedman2013-06-071-1/+1
| | | | | | | | | | | | | | | correctly aligned. Not performing such computations led to misaligned loads, which crash on some platforms and are generally bad on other platforms. The implementation of TypeLocBuilder::pushImpl is rather messy; code using TypeLocBuilder accidentally assumes that partial TypeLocs are laid out like a complete TypeLoc. As a followup, I intend to work on fixing the TypeLocBuilder API to avoid exposing partial TypeLocs; this should substantially simplify the implemementation. Fixes PR16144. llvm-svn: 183466
* Walk over MaterializeTemporaryExpr when reverting an initializer to itsRichard Smith2013-05-301-0/+3
| | | | | | | | syntactic form in template instantiation. Previously, this blocked the reversion and we ended up losing inner CXXBindTemporaryExprs (and thus forgetting to call destructors!). llvm-svn: 182969
* Fix crash-on-invalid: only use TransformAddressOfOperand when transforming theRichard Smith2013-05-211-1/+5
| | | | | | operand of a unary address-of expression, not for *all* expressions! llvm-svn: 182436
* First pass of semantic analysis for init-captures: check the initializer, buildRichard Smith2013-05-161-3/+40
| | | | | | | | | | | | | 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
* ArrayRef'ize GenericSelectionExprDmitri Gribenko2013-05-101-8/+5
| | | | llvm-svn: 181592
* Replace 'MultiExprArg()' with 'None'Dmitri Gribenko2013-05-051-3/+3
| | | | llvm-svn: 181166
* Implement template support for CapturedStmtWei Pan2013-05-041-1/+12
| | | | | | | | - Sema tests added and CodeGen tests are pending Differential Revision: http://llvm-reviews.chandlerc.com/D728 llvm-svn: 181101
* Move parsing of identifiers in MS-style inline assembly intoJohn McCall2013-05-031-3/+33
| | | | | | | | | | | | | | | | | | | | | 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
* Fix crasher when the range in a C++ range-for loop has an ill-formed ↵Douglas Gregor2013-05-021-2/+11
| | | | | | | | initializer. Fixes <rdar://problem/13712739>. llvm-svn: 180937
* Don't treat a non-deduced 'auto' type as being type-dependent. Instead, thereRichard Smith2013-04-301-1/+5
| | | | | | | | 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
* Implement C++1y decltype(auto).Richard Smith2013-04-261-6/+6
| | | | llvm-svn: 180610
* C++1y: Allow aggregates to have default initializers.Richard Smith2013-04-201-0/+26
| | | | | | | | | | | Add a CXXDefaultInitExpr, analogous to CXXDefaultArgExpr, and use it both in CXXCtorInitializers and in InitListExprs to represent a default initializer. There's an additional complication here: because the default initializer can refer to the initialized object via its 'this' pointer, we need to make sure that 'this' points to the right thing within the evaluation. llvm-svn: 179958
* Implement CapturedStmt ASTTareq A. Siraj2013-04-161-0/+6
| | | | | | | | | | | | | | | CapturedStmt can be used to implement generic function outlining as described in http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-January/027540.html. CapturedStmt is not exposed to the C api. Serialization and template support are pending. Author: Wei Pan <wei.pan@intel.com> Differential Revision: http://llvm-reviews.chandlerc.com/D370 llvm-svn: 179615
* Basic support for Microsoft property declarations andJohn McCall2013-04-161-0/+26
| | | | | | | | references thereto. Patch by Tong Shen! llvm-svn: 179585
* Drop ObjCIndirectCopyRestoreExprs during template instantiation.John McCall2013-04-111-10/+5
| | | | | | | | | It's a kind of implicit conversion, which we generally drop, but more importantly it's got very specific placement requirements. rdar://13617051 llvm-svn: 179254
* Mark as referenced the functions from instantiated UserDefinedLiterals.Argyrios Kyrtzidis2013-04-091-0/+2
| | | | | | Fixes rdar://13589856 llvm-svn: 179078
* <rdar://problem/13540921> Cope with instantiations of the C++11 range-based ↵Douglas Gregor2013-04-081-0/+14
| | | | | | for loop that end up being Objective-C fast enumeration loops. llvm-svn: 179037
* Add 178663 back.Rafael Espindola2013-04-031-1/+0
| | | | | | | | | | | 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-0/+1
| | | | | | | | | | 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-1/+0
| | | | | | | | | | | 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
* Objective-C: Provide fixit suggestions when class objectFariborz Jahanian2013-03-281-2/+4
| | | | | | | | is accessed via accessing 'isa' ivar to use object_getClass/object_setClass apis. // rdar://13503456 llvm-svn: 178282
* Don't reject __restrict applied to a dependent type; it might instantiate to ↵Richard Smith2013-03-271-1/+3
| | | | | | a pointer or reference type. llvm-svn: 178198
* <rdar://problem/13170740> Be a little more careful when instantiating 'this' ↵Douglas Gregor2013-03-081-2/+7
| | | | | | expressions. llvm-svn: 176731
OpenPOWER on IntegriCloud