summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiateDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Concept] Associated Constraints InfrastructureSaar Raz2019-10-151-4/+11
| | | | | | | | | Add code to correctly calculate the associated constraints of a template (no enforcement yet). D41284 on Phabricator. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374938 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP50]Multiple vendors in vendor context must be treated as logicalAlexey Bataev2019-10-081-3/+5
| | | | | | | | | | | | | and of vendors, not or. If several vendors are provided in the same vendor context trait, the context shall match only if all vendors are matching, not one of them. This is per OpenMP 5.0, 2.3.3 Matching and Scoring Context Selectors, all selectors in the construct, device, and implementation sets of the context selector appear in the corresponding trait set of the OpenMP context. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374107 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP50]Add parsing/sema analysis for declare variant score.Alexey Bataev2019-10-021-2/+7
| | | | | | | | Context selectors may include optional score clause in format `score(<expr>):`, where `<expr>` must be a constant integer expression. Added parsing/sema analysis only. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373502 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP50]Parsing/sema support for 'implementation/vendor' contextAlexey Bataev2019-09-251-1/+3
| | | | | | | | | selector. Added basic parsing/semantic support for 'implementation={vendor(<vendor>)}' context selector. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372917 91177308-0d34-0410-b5e6-96231b3b80d8
* For P0784R7: add support for constexpr destructors, and call them asRichard Smith2019-09-231-4/+3
| | | | | | | | | | | appropriate during constant evaluation. Note that the evaluator is sometimes invoked on incomplete expressions. In such cases, if an object is constructed but we never reach the point where it would be destroyed (and it has non-trivial destruction), we treat the expression as having an unmodeled side-effect. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372538 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP5.0]Allow multiple context selectors in the context selectorAlexey Bataev2019-09-181-2/+10
| | | | | | | | | sets. According to OpenMP 5.0, context selector set might include several context selectors, separated with commas. Patch fixes this problem. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372235 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP5.0]Introduce attribute for declare variant directive.Alexey Bataev2019-09-171-0/+49
| | | | | | | | Added attribute for declare variant directive. It will allow to handle declare variant directive at the codegen and will allow to add extra checks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372147 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFCI]Create CommonAttributeInfo Type as base type of *Attr and ParsedAttr.Erich Keane2019-09-131-29/+16
| | | | | | | | | | | | In order to enable future improvements to our attribute diagnostics, this moves info from ParsedAttr into CommonAttributeInfo, then makes this type the base of the *Attr and ParsedAttr types. Quite a bit of refactoring took place, including removing a bunch of redundant Spelling Index propogation. Differential Revision: https://reviews.llvm.org/D67368 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371875 91177308-0d34-0410-b5e6-96231b3b80d8
* Reland [LifetimeAnalysis] Support more STL idioms (template forward ↵Matthias Gehre2019-09-061-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | declaration and DependentNameType) Reland after https://reviews.llvm.org/D66806 fixed the false-positive diagnostics. Summary: This fixes inference of gsl::Pointer on std::set::iterator with libstdc++ (the typedef for iterator on the template is a DependentNameType - we can only put the gsl::Pointer attribute on the underlaying record after instantiation) inference of gsl::Pointer on std::vector::iterator with libc++ (the class was forward-declared, we added the gsl::Pointer on the canonical decl (the forward decl), and later when the template was instantiated, there was no attribute on the definition so it was not instantiated). and a duplicate gsl::Pointer on some class with libstdc++ (we first added an attribute to a incomplete instantiation, and then another was copied from the template definition when the instantiation was completed). We now add the attributes to all redeclarations to fix thos issues and make their usage easier. Reviewers: gribozavr Subscribers: Szelethus, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66179 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371182 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR43213, track whether template parameters are implicit throughRichard Smith2019-09-041-0/+3
| | | | | | | template instantiation so we know whether to mangle them in lambda-expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370991 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve behavior in the case of stack exhaustion.Richard Smith2019-08-261-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Clang performs various recursive operations (such as template instantiation), and may use non-trivial amounts of stack space in each recursive step (for instance, due to recursive AST walks). While we try to keep the stack space used by such steps to a minimum and we have explicit limits on the number of such steps we perform, it's impractical to guarantee that we won't blow out the stack on deeply recursive template instantiations on complex ASTs, even with only a moderately high instantiation depth limit. The user experience in these cases is generally terrible: we crash with no hint of what went wrong. Under this patch, we attempt to do better: * Detect when the stack is nearly exhausted, and produce a warning with a nice template instantiation backtrace, telling the user that we might run slowly or crash. * For cases where we're forced to trigger recursive template instantiation in arbitrarily-deeply-nested contexts, check whether we're nearly out of stack space and allocate a new stack (by spawning a new thread) after producing the warning. Reviewers: rnk, aaron.ballman Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66361 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369940 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC] Move some variable declarations into their 'if' conditions.Erich Keane2019-08-231-9/+7
| | | | | | | | A couple of variables are being declared outside of the 'if' condition that is their only actual use. Additionally, switch a few 'const TYPE *' to 'const auto *' for consistency. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369773 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[LifetimeAnalysis] Support more STL idioms (template forward ↵Richard Smith2019-08-221-15/+0
| | | | | | | | | | declaration and DependentNameType)" This reverts commit r369591, because it causes the formerly-reliable -Wreturn-stack-address warning to start issuing false positives. Testcase provided on the commit thread. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369677 91177308-0d34-0410-b5e6-96231b3b80d8
* [LifetimeAnalysis] Support more STL idioms (template forward declaration and ↵Matthias Gehre2019-08-211-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | DependentNameType) Summary: This fixes inference of gsl::Pointer on std::set::iterator with libstdc++ (the typedef for iterator on the template is a DependentNameType - we can only put the gsl::Pointer attribute on the underlaying record after instantiation) inference of gsl::Pointer on std::vector::iterator with libc++ (the class was forward-declared, we added the gsl::Pointer on the canonical decl (the forward decl), and later when the template was instantiated, there was no attribute on the definition so it was not instantiated). and a duplicate gsl::Pointer on some class with libstdc++ (we first added an attribute to a incomplete instantiation, and then another was copied from the template definition when the instantiation was completed). We now add the attributes to all redeclarations to fix thos issues and make their usage easier. Reviewers: gribozavr Subscribers: Szelethus, xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66179 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369591 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Actually map a variable template specialization from pattern to ↵Erik Pilkington2019-07-301-21/+19
| | | | | | | | | | | | | instantiation We were previously just using a specialization in the class template instead of creating a new specialization in the class instantiation. Fixes llvm.org/PR42779. Differential revision: https://reviews.llvm.org/D65359 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@367367 91177308-0d34-0410-b5e6-96231b3b80d8
* [Concepts] Concept definitions (D40381)Saar Raz2019-07-101-0/+4
| | | | | | | | First in a series of patches to land C++2a Concepts support. This patch adds AST and parsing support for concept-declarations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@365699 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++20] add Basic consteval specifierGauthier Harnisch2019-06-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: this revision adds Lexing, Parsing and Basic Semantic for the consteval specifier as specified by http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1073r3.html with this patch, the consteval specifier is treated as constexpr but can only be applied to function declaration. Changes: - add the consteval keyword. - add parsing of consteval specifier for normal declarations and lambdas expressions. - add the whether a declaration is constexpr is now represented by and enum everywhere except for variable because they can't be consteval. - adapt diagnostic about constexpr to print constexpr or consteval depending on the case. - add tests for basic semantic. Reviewers: rsmith, martong, shafik Reviewed By: rsmith Subscribers: eraman, efriedma, rnkovacs, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61790 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363362 91177308-0d34-0410-b5e6-96231b3b80d8
* For DR712: store on a DeclRefExpr whether it constitutes an odr-use.Richard Smith2019-06-111-2/+17
| | | | | | | Begin restructuring to support the forms of non-odr-use reference permitted by DR712. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363086 91177308-0d34-0410-b5e6-96231b3b80d8
* make -ftime-trace also print template argumentsLubos Lunak2019-05-121-1/+5
| | | | | | | | | Without this, I get e.g. 'PerformPendingInstantiations' -> 'std::fill', now I get 'std::fill<unsigned long *, int>'. Differential Revision: https://reviews.llvm.org/D61822 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360539 91177308-0d34-0410-b5e6-96231b3b80d8
* [c++20] Add support for explicit(bool), as described in P0892R2.Richard Smith2019-05-091-8/+45
| | | | | | | | Patch by Tyker! Differential Revision: https://reviews.llvm.org/D60934 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360311 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r359949 "[clang] adding explicit(bool) from c++2a"Hans Wennborg2019-05-061-45/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This caused Clang to start erroring on the following: struct S {   template <typename = int> explicit S(); }; struct T : S {}; struct U : T {   U(); }; U::U() {} $ clang -c /tmp/x.cc /tmp/x.cc:10:4: error: call to implicitly-deleted default constructor of 'T' U::U() {}    ^ /tmp/x.cc:5:12: note: default constructor of 'T' is implicitly deleted because base class 'S' has no default constructor struct T : S {};            ^ 1 error generated. See discussion on the cfe-commits email thread. This also reverts the follow-ups r359966 and r359968. > this patch adds support for the explicit bool specifier. > > Changes: > - The parsing for the explicit(bool) specifier was added in ParseDecl.cpp. > - The storage of the explicit specifier was changed. the explicit specifier was stored as a boolean value in the FunctionDeclBitfields and in the DeclSpec class. now it is stored as a PointerIntPair<Expr*, 2> with a flag and a potential expression in CXXConstructorDecl, CXXDeductionGuideDecl, CXXConversionDecl and in the DeclSpec class. > - Following the AST change, Serialization, ASTMatchers, ASTComparator and ASTPrinter were adapted. > - Template instantiation was adapted to instantiate the potential expressions of the explicit(bool) specifier When instantiating their associated declaration. > - The Add*Candidate functions were adapted, they now take a Boolean indicating if the context allowing explicit constructor or conversion function and this boolean is used to remove invalid overloads that required template instantiation to be detected. > - Test for Semantic and Serialization were added. > > This patch is not yet complete. I still need to check that interaction with CTAD and deduction guides is correct. and add more tests for AST operations. But I wanted first feedback. > Perhaps this patch should be spited in smaller patches, but making each patch testable as a standalone may be tricky. > > Patch by Tyker > > Differential Revision: https://reviews.llvm.org/D60934 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360024 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang] adding explicit(bool) from c++2aNicolas Lesser2019-05-041-8/+45
| | | | | | | | | | | | | | | | | | | | | this patch adds support for the explicit bool specifier. Changes: - The parsing for the explicit(bool) specifier was added in ParseDecl.cpp. - The storage of the explicit specifier was changed. the explicit specifier was stored as a boolean value in the FunctionDeclBitfields and in the DeclSpec class. now it is stored as a PointerIntPair<Expr*, 2> with a flag and a potential expression in CXXConstructorDecl, CXXDeductionGuideDecl, CXXConversionDecl and in the DeclSpec class. - Following the AST change, Serialization, ASTMatchers, ASTComparator and ASTPrinter were adapted. - Template instantiation was adapted to instantiate the potential expressions of the explicit(bool) specifier When instantiating their associated declaration. - The Add*Candidate functions were adapted, they now take a Boolean indicating if the context allowing explicit constructor or conversion function and this boolean is used to remove invalid overloads that required template instantiation to be detected. - Test for Semantic and Serialization were added. This patch is not yet complete. I still need to check that interaction with CTAD and deduction guides is correct. and add more tests for AST operations. But I wanted first feedback. Perhaps this patch should be spited in smaller patches, but making each patch testable as a standalone may be tricky. Patch by Tyker Differential Revision: https://reviews.llvm.org/D60934 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359949 91177308-0d34-0410-b5e6-96231b3b80d8
* CWG issue 727: Fix numerous bugs in support for class-scope explicitRichard Smith2019-05-031-86/+95
| | | | | | specializations for variable templates. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359947 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace ad-hoc tracking of pattern for an instantiated class-scopeRichard Smith2019-05-021-44/+28
| | | | | | | | | | explicit function specialization with the MemberSpecializationInfo used everywhere else. Not NFC: the ad-hoc pattern tracking was not being serialized / deserialized properly. That's fixed here. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359747 91177308-0d34-0410-b5e6-96231b3b80d8
* Adds `-ftime-trace` option to clang that produces Chrome `chrome://tracing` ↵Anton Afanasyev2019-03-301-0/+5
| | | | | | | | | | | | | | compatible JSON profiling output dumps. This change adds hierarchical "time trace" profiling blocks that can be visualized in Chrome, in a "flame chart" style. Each profiling block can have a "detail" string that for example indicates the file being processed, template name being instantiated, function being optimized etc. This is taken from GitHub PR: https://github.com/aras-p/llvm-project-20170507/pull/2 Patch by Aras Pranckevičius. Differential Revision: https://reviews.llvm.org/D58675 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357340 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit "Support attribute used in member funcs of class templates"Rafael Auler2019-03-201-0/+14
| | | | | | | | | | | | | | | | | | | | This diff previously exposed a bug in LLVM's IRLinker, breaking buildbots that tried to self-host LLVM with monolithic LTO. The bug is now in LLVM by D59552 Original commit message: As PR17480 describes, clang does not support the used attribute for member functions of class templates. This means that if the member function is not used, its definition is never instantiated. This patch changes clang to emit the definition if it has the used attribute. Test Plan: Added a testcase Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D56928 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@356598 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove an assert in template pack deduction during nested instantiation.Richard Trieu2019-03-151-18/+18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@356231 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP 5.0]Initial support for 'allocator' clause.Alexey Bataev2019-03-121-2/+13
| | | | | | | Added parsing/sema analysis/serialization/deserialization for the 'allocator' clause of the 'allocate' directive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355952 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Recommit "Support attribute used in member funcs of class templates""Rafael Auler2019-03-081-14/+0
| | | | | | | | | There is nontrivial bug caused in lld that I need to further investigate. Meanwhile, I'll revert this. This reverts commit 8297e93480c636dc90fd14653c5a66406193363f. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355721 91177308-0d34-0410-b5e6-96231b3b80d8
* Recommit "Support attribute used in member funcs of class templates"Rafael Auler2019-03-071-0/+14
| | | | | | | | | | | | | | | | | | | | The patch originally broke code that was incompatible with GCC, but we want to follow GCC behavior here according to the discussion in https://reviews.llvm.org/D58216 Original commit message: As PR17480 describes, clang does not support the used attribute for member functions of class templates. This means that if the member function is not used, its definition is never instantiated. This patch changes clang to emit the definition if it has the used attribute. Test Plan: Added a testcase Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D56928 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355627 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP 5.0]Add initial support for 'allocate' directive.Alexey Bataev2019-03-071-0/+15
| | | | | | | Added parsing/sema analysis/serialization/deserialization support for 'allocate' directive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355614 91177308-0d34-0410-b5e6-96231b3b80d8
* [AMDGPU] Allow using integral non-type template parametersMichael Liao2019-02-261-0/+57
| | | | | | | | | | | | | | | | | | | Summary: - Allow using integral non-type template parameters in the following attributes __attribute__((amdgpu_flat_work_group_size(<min>, <max>))) __attribute__((amdgpu_waves_per_eu(<min>[, <max>]))) Reviewers: kzhuravl, yaxunl Subscribers: jvesely, wdng, nhaehnle, dstuttard, tpr, t-tye, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58623 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354909 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenMP 5.0] Parsing/sema support for map clause with mapper modifier.Michael Kruse2019-02-191-4/+12
| | | | | | | | | | | | | | | | | | | This patch implements the parsing and sema support for OpenMP map clauses with potential user-defined mapper attached. User defined mapper is a new feature in OpenMP 5.0. A map clause can have an explicit or implicit associated mapper, which instructs the compiler to generate extra data mapping. An example is shown below: struct S { int len; int *d; }; #pragma omp declare mapper(id: struct S s) map(s, s.d[0:s.len]) struct S ss; #pragma omp target map(mapper(id) tofrom: ss) // use the mapper with name 'id' to map ss Contributed-by: Lingda Li <lildmh@gmail.com> Differential Revision: https://reviews.llvm.org/D58074 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354347 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenMP 5.0] Parsing/sema support for "omp declare mapper" directive.Michael Kruse2019-02-011-1/+83
| | | | | | | | | | | | | | | | | This patch implements parsing and sema for "omp declare mapper" directive. User defined mapper, i.e., declare mapper directive, is a new feature in OpenMP 5.0. It is introduced to extend existing map clauses for the purpose of simplifying the copy of complex data structures between host and device (i.e., deep copy). An example is shown below: struct S { int len; int *d; }; #pragma omp declare mapper(struct S s) map(s, s.d[0:s.len]) // Memory region that d points to is also mapped using this mapper. Contributed-by: Lingda Li <lildmh@gmail.com> Differential Revision: https://reviews.llvm.org/D56326 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352906 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Support attribute used in member funcs of class templates"Rafael Auler2019-01-311-14/+0
| | | | | | This reverts commit 352740: broke swift build git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352748 91177308-0d34-0410-b5e6-96231b3b80d8
* Support attribute used in member funcs of class templatesRafael Auler2019-01-311-0/+14
| | | | | | | | | | | | | | | | Summary: As PR17480 describes, clang does not support the used attribute for member functions of class templates. This means that if the member function is not used, its definition is never instantiated. This patch changes clang to emit the definition if it has the used attribute. Test Plan: Added a testcase Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D56928 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352740 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename getTypeQualifiers to getMethodQualifiers.Anastasia Stulova2019-01-281-1/+1
| | | | | | | | | | Use more descriptive name for the method qualifiers getter. Differential Revision: https://reviews.llvm.org/D56792 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352349 91177308-0d34-0410-b5e6-96231b3b80d8
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
* Remember to instantiate explicit template argument lists in a friendRichard Smith2019-01-111-11/+73
| | | | | | | | | | | | | | | function declaration. We'd previously often just drop these on the floor, and friend redeclaration matching would usually (but not always) figure out the right redeclaration anyway. Also, don't try to match a dependent friend function template specialization to a template until instantiation, and don't forget to reject qualified friend declarations in dependent contexts that don't name an already-declared entity. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350915 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Add generic AS to 'this' pointerMikael Nilsson2018-12-131-5/+5
| | | | | | | | | | | | | | Address spaces are cast into generic before invoking the constructor. Added support for a trailing Qualifiers object in FunctionProtoType. Note: This recommits the previously reverted patch, but now it is commited together with a fix for lldb. Differential Revision: https://reviews.llvm.org/D54862 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349019 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[OpenCL] Add generic AS to 'this' pointer"Mikael Nilsson2018-12-121-5/+5
| | | | | | | | Reverting because the patch broke lldb. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348931 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenCL] Add generic AS to 'this' pointerMikael Nilsson2018-12-121-5/+5
| | | | | | | | | | | Address spaces are cast into generic before invoking the constructor. Added support for a trailing Qualifiers object in FunctionProtoType. Differential Revision: https://reviews.llvm.org/D54862 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348927 91177308-0d34-0410-b5e6-96231b3b80d8
* Diagnose friend function template redefinitions.Serge Pavlov2018-12-061-1/+3
| | | | | | | | | | | | | | | Friend function template defined in a class template becomes available if the enclosing class template is instantiated. Until the function template is used, it does not have a body, but still is considered a definition for the purpose of redeclaration checks. This change modifies redefinition check so that it can find the friend function template definitions in instantiated classes. Differential Revision: http://reviews.llvm.org/D21508 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348473 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix crash if an in-class explicit function specialization has explicitRichard Smith2018-12-041-10/+12
| | | | | | template arguments referring to template paramaeters. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348313 91177308-0d34-0410-b5e6-96231b3b80d8
* [attributes] Add a family of OS_CONSUMED, OS_RETURNS and OS_RETURNS_RETAINED ↵George Karpenkov2018-11-301-5/+20
| | | | | | | | | | | | | | | | | | | | | attributes The addition adds three attributes for communicating ownership, analogous to existing NS_ and CF_ attributes. The attributes are meant to be used for communicating ownership of all objects in XNU (Darwin kernel) and all of the kernel modules. The ownership model there is very similar, but still different from the Foundation model, so we think that introducing a new family of attributes is appropriate. The addition required a sizeable refactoring of the existing code for CF_ and NS_ ownership attributes, due to tight coupling and the fact that differentiating between the types was previously done using a boolean. Differential Revision: https://reviews.llvm.org/D54912 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347947 91177308-0d34-0410-b5e6-96231b3b80d8
* Follow-up to r345699: Call CheckStaticLocalForDllExport later for templatesHans Wennborg2018-10-311-3/+3
| | | | | | | | Calling it too early might cause dllimport to get inherited onto the VarDecl before the initializer got attached. See the test case for an example where this broke things. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345709 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-cl] Inherit dllexport to static locals also in template ↵Hans Wennborg2018-10-311-0/+3
| | | | | | | | | | | | | | | | instantiations (PR39496) In the course of D51340, @takuto.ikuta discovered that Clang fails to put dllexport/import attributes on static locals during template instantiation. For regular functions, this happens in Sema::FinalizeDeclaration(), however for template instantiations we need to do something in or around TemplateDeclInstantiator::VisitVarDecl(). This patch does that, and extracts the code to a utility function. Differential Revision: https://reviews.llvm.org/D53870 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345699 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Add support for OMP5 requires directive + unified_address clauseKelvin Li2018-09-261-0/+5
| | | | | | | | | | Add support for OMP5.0 requires directive and unified_address clause. Patches to follow will include support for additional clauses. Differential Revision: https://reviews.llvm.org/D52359 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343063 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang] Make sure attributes on member classes are applied properlyLouis Dionne2018-09-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | | Summary: Attributes on member classes of class templates and member class templates of class templates are not currently instantiated. This was discovered by Richard Smith here: http://lists.llvm.org/pipermail/cfe-dev/2018-September/059291.html This commit makes sure that attributes are instantiated properly. This commit does not fix the broken behavior for member partial and explicit specializations of class templates. PR38913 Reviewers: rsmith Subscribers: dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D51997 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342238 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Fix PR38903: Crash on instantiation of the non-dependentAlexey Bataev2018-09-131-32/+47
| | | | | | | | | | | declare reduction. If the declare reduction construct with the non-dependent type is defined in the template construct, the compiler might crash on the template instantition. Reworked the whole instantiation scheme for the declare reduction constructs to fix this problem correctly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342151 91177308-0d34-0410-b5e6-96231b3b80d8