summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclTemplate.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add a destruct-on-exit function to ASTContext.George Burgess IV2017-02-141-19/+4
| | | | | | | | | | | | | | It looks like the only use of AddDeallocation is to indirectly call the destructors of objects. In one case I found (TypeAliasTemplateDecl::Common), the destructor is a nop, so registering it to run later seems pointless. All of the other *::Common types have non-trivial dtors, so deleting the useless AddDeallocation felt somewhat fragile. Happy to kill it + turn the is_trivial_dtor check into a static_assert if people think that'd be better. llvm-svn: 295029
* [Concepts] Class template associated constraintsHubert Tong2017-02-101-3/+11
| | | | | | | | | | | | | | | | Summary: This adds associated constraints as a property of class templates. An error is produced if redeclarations are not similarly constrained. Reviewers: rsmith, faisalv, aaron.ballman Reviewed By: rsmith Subscribers: cfe-commits, nwilson Differential Revision: https://reviews.llvm.org/D25674 llvm-svn: 294697
* PR31469: Don't add friend template class decls to redecl chain in dependent ↵Vassil Vassilev2017-01-121-3/+1
| | | | | | | | | | | | | | | | | contexts. Fixes a crash in modules where the template class decl becomes the most recent decl in the redeclaration chain and forcing the template instantiator try to instantiate the friend declaration, rather than the template definition. In practice, A::list<int> produces a TemplateSpecializationType A::__1::list<int, allocator<type-parameter-0-0> >' failing to replace to subsitute the default argument to allocator<int>. Kudos Richard Smith (D28399). llvm-svn: 291753
* When producing a name of a partial specialization in a diagnostic, use theRichard Smith2016-12-241-6/+20
| | | | | | | template arguments as written rather than the canonical template arguments, so we print more user-friendly names for template parameters. llvm-svn: 290483
* Move generation of injected template arguments for a template parameter listRichard Smith2016-12-231-44/+8
| | | | | | | out of an internal function and into ASTContext; this is needed in template argument deduction for P0522R0. llvm-svn: 290405
* Delete tautological assertion.Jonathan Roelofs2016-12-021-1/+0
| | | | | | | | After r256463, both the LHS and RHS now refer to the same variable. Before, they referred to the member, the parameter respectively. Now GCC6's -Wtautological-compare complains. llvm-svn: 288444
* Retire llvm::alignOf in favor of C++11 alignof.Benjamin Kramer2016-10-201-1/+1
| | | | | | No functionality change intended. llvm-svn: 284730
* Reapply r276069 with workaround for MSVC 2013Hubert Tong2016-07-301-10/+18
| | | | llvm-svn: 277286
* Revert r276069: MSVC bots not happyHubert Tong2016-07-201-18/+10
| | | | llvm-svn: 276074
* Concepts: Create space for requires-clause in TemplateParameterList; NFCHubert Tong2016-07-201-10/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Space for storing the //constraint-expression// of the //requires-clause// associated with a `TemplateParameterList` is arranged by taking a bit out of the `NumParams` field for the purpose of determining whether there is a //requires-clause// or not, and by adding to the trailing objects tied to the `TemplateParameterList`. An accessor is provided. An appropriate argument is supplied to `TemplateParameterList::Create` at the various call sites. Serialization changes will addressed as the Concepts implementation becomes more solid. Drive-by fix: This change also replaces the custom `FixedSizeTemplateParameterListStorage` implementation with one that follows the interface provided by `llvm::TrailingObjects`. Reviewers: aaron.ballman, faisalv, rsmith Subscribers: cfe-commits, nwilson Differential Revision: https://reviews.llvm.org/D19322 llvm-svn: 276069
* [AST] Keep track of the left brace source location of a tag decl.Argyrios Kyrtzidis2016-07-151-1/+1
| | | | | | This is useful for source modification tools. There will be a follow-up commit using it. llvm-svn: 275590
* [AST] Use ArrayRef in more interfacesDavid Majnemer2016-07-071-4/+3
| | | | | | | | | ArrayRef is a little better than passing around a pointer/length pair. No functional change is intended. llvm-svn: 274732
* [AST] Use ArrayRef in more interfacesDavid Majnemer2016-07-061-117/+83
| | | | | | | | ArrayRef is a little better than passing around a pointer/length pair. No functional change is intended. llvm-svn: 274601
* [AST] Use ArrayRef in more interfacesDavid Majnemer2016-07-031-30/+23
| | | | | | | | ArrayRef is a little better than passing around a pointer/length pair. No functional change is intended. llvm-svn: 274475
* [Feature] Add a builtin for indexing into parameter packs. Patch by Louis ↵Eric Fiselier2016-07-011-0/+23
| | | | | | | | | | | | | Dionne. This patch adds a __nth_element builtin that allows fetching the n-th type of a parameter pack with very little compile-time overhead. The patch was inspired by r252036 and r252115 by David Majnemer, which add a similar __make_integer_seq builtin for efficiently creating a std::integer_sequence. Reviewed as D15421. http://reviews.llvm.org/D15421 llvm-svn: 274316
* ArrayRef-ize TemplateParameterList. NFCDavid Majnemer2015-12-271-10/+9
| | | | llvm-svn: 256463
* [Sema] Implement __make_integer_seqDavid Majnemer2015-11-041-0/+67
| | | | | | | | | | | | | | | | | | This new builtin template allows for incredibly fast instantiations of templates like std::integer_sequence. Performance numbers follow: My work station has 64 GB of ram + 20 Xeon Cores at 2.8 GHz. __make_integer_seq<std::integer_sequence, int, 90000> takes 0.25 seconds. std::make_integer_sequence<int, 90000> takes unbound time, it is still running. Clang is consuming gigabytes of memory. Differential Revision: http://reviews.llvm.org/D13786 llvm-svn: 252036
* Convert a few classes over to use the new TrailingObjects helper.James Y Knight2015-08-061-30/+34
| | | | | | | | | | This initial commit serves as an example -- the remainder of the classes using pointer arithmetic for trailing objects will be converted in subsequent changes. Differential Revision: http://reviews.llvm.org/D11298 llvm-svn: 244262
* Remove unused 'Owned' flag from TemplateArgumentList.James Y Knight2015-08-061-1/+1
| | | | llvm-svn: 244261
* [AST] ArrayRefize template argument packs. No functionality change intended.Benjamin Kramer2015-08-051-2/+2
| | | | llvm-svn: 244026
* [modules] Improve diagnostic for a template-id that's invalid because a defaultRichard Smith2015-06-171-0/+5
| | | | | | argument is not visible. llvm-svn: 239934
* [modules] Track all default template arguments for a given parameter acrossRichard Smith2015-06-101-0/+6
| | | | | | | modules, and allow use of a default template argument if any of the parameters providing it is visible. llvm-svn: 239485
* Refactor storage of default template arguments.Richard Smith2015-06-101-9/+14
| | | | | | | This is just a preparatory step towards fixing visibility for default template arguments in modules builds. llvm-svn: 239447
* [modules] Ensure we've imported all declarations of a template beforeRichard Smith2015-02-241-3/+15
| | | | | | | attempting to lazily deserialize its specializations; otherwise, there might be pending specializations that we don't know about yet. llvm-svn: 230301
* Refactor *TemplateDecl::addSpecialization to reduce duplication and add someRichard Smith2015-02-241-32/+36
| | | | | | more asserts. llvm-svn: 230296
* Convert some function arguments to use ArrayRef.Craig Topper2014-06-261-19/+16
| | | | llvm-svn: 211764
* If a declaration is loaded, and then a module import adds a redeclaration, thenRichard Smith2014-05-161-28/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ensure that querying the first declaration for its most recent declaration checks for redeclarations from the imported module. This works as follows: * The 'most recent' pointer on a canonical declaration grows a pointer to the external AST source and a generation number (space- and time-optimized for the case where there is no external source). * Each time the 'most recent' pointer is queried, if it has an external source, we check whether it's up to date, and update it if not. * The ancillary data stored on the canonical declaration is allocated lazily to avoid filling it in for declarations that end up being non-canonical. We'll still perform a redundant (ASTContext) allocation if someone asks for the most recent declaration from a decl before setPreviousDecl is called, but such cases are probably all bugs, and are now easy to find. Some finessing is still in order here -- in particular, we use a very general mechanism for handling the DefinitionData pointer on CXXRecordData, and a more targeted approach would be more compact. Also, the MayHaveOutOfDateDef mechanism should now be expunged, since it was addressing only a corner of the full problem space here. That's not covered by this patch. Early performance benchmarks show that this makes no measurable difference to Clang performance without modules enabled (and fixes a major correctness issue with modules enabled). I'll revert if a full performance comparison shows any problems. llvm-svn: 209046
* [C++11] Use 'nullptr'. AST edition.Craig Topper2014-05-121-36/+37
| | | | llvm-svn: 208517
* Make TypeDecl much less friendly.Richard Smith2014-04-231-4/+4
| | | | llvm-svn: 207007
* Clean up variable template handling a bit, and correct the behavior of nameRichard Smith2014-01-161-5/+2
| | | | | | lookup when declaring a variable template specialization. llvm-svn: 199438
* Fix a tranche of comment, test and doc typosAlp Toker2013-12-051-1/+1
| | | | llvm-svn: 196510
* Add class-specific operator new to Decl hierarchy. This guarantees that DeclsRichard Smith2013-11-221-102/+60
| | | | | | | | | | | | | can't accidentally be allocated the wrong way (missing prefix data for decls from AST files, for instance) and simplifies the CreateDeserialized functions a little. An extra DeclContext* parameter to the not-from-AST-file operator new allows us to ensure that we don't accidentally call the wrong one when deserializing (when we don't have a DeclContext), allows some extra checks, and prepares for some planned modules-related changes to Decl allocation. No functionality change intended. llvm-svn: 195426
* Reduce indentation with an early exit.Rafael Espindola2013-10-191-23/+24
| | | | llvm-svn: 193028
* Rename some functions for consistency.Rafael Espindola2013-10-171-2/+2
| | | | | | Every other function in Redeclarable.h was using Decl instead of Declaration. llvm-svn: 192900
* A clean-up pass, exploring the unification of traversals of class, variable ↵Larisse Voufo2013-08-231-2/+2
| | | | | | and function templates. llvm-svn: 189152
* Remove SequenceNumber from class/variable template partial specializations.Richard Smith2013-08-221-21/+14
| | | | | | | | This was only used to ensure that the traversal order was the same as the insertion order, but that guarantee was already being provided by the use of a FoldingSetVector. llvm-svn: 189075
* variable templates updated for PCH serialization... Still working on test ↵Larisse Voufo2013-08-131-0/+10
| | | | | | cases... llvm-svn: 188249
* Added source locs for angled parentheses in class/var template partial specs.Enea Zaffanella2013-08-101-19/+11
| | | | llvm-svn: 188134
* Started implementing variable templates. Top level declarations should be ↵Larisse Voufo2013-08-061-0/+245
| | | | | | 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
* Lazily deserialize function template specializations. This fixes a cycle inRichard Smith2013-06-281-0/+17
| | | | | | module deserialization / merging, and more laziness here is general goodness. llvm-svn: 185132
* A little ArrayRef'ization.Richard Smith2013-05-171-6/+5
| | | | llvm-svn: 182074
* Streamify getNameForDiagnostic and remove the string versions of ↵Benjamin Kramer2013-02-221-9/+5
| | | | | | PrintTemplateArgumentList. llvm-svn: 175894
* Use None rather than Optional<T>() where possible.David Blaikie2013-02-211-3/+3
| | | | llvm-svn: 175705
* Include llvm::Optional in clang/Basic/LLVM.hDavid Blaikie2013-02-201-7/+5
| | | | | | Post-commit CR feedback from Jordan Rose regarding r175594. llvm-svn: 175679
* Remove const_casts by making spec_begin()/spec_end() constDmitri Gribenko2013-02-141-2/+2
| | | | llvm-svn: 175159
* Ensure that type definitions present in just-loaded modules areDouglas Gregor2013-02-091-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | visible. The basic problem here is that a given translation unit can use forward declarations to form pointers to a given type, say, class X; X *x; and then import a module that includes a definition of X: import XDef; We will then fail when attempting to access a member of X, e.g., x->method() because the AST reader did not know to look for a default of a class named X within the new module. This implementation is a bit of a C-centric hack, because the only definitions that can have this property are enums, structs, unions, Objective-C classes, and Objective-C protocols, and all of those are either visible at the top-level or can't be defined later. Hence, we can use the out-of-date-ness of the name and the identifier-update mechanism to force the update. In C++, we will not be so lucky, and will need a more advanced solution, because the definitions could be in namespaces defined in two different modules, e.g., // module 1 namespace N { struct X; } // module 2 namespace N { struct X { /* ... */ }; } One possible implementation here is for C++ to extend the information associated with each identifier table to include the declaration IDs of any definitions associated with that name, regardless of context. We would have to eagerly load those definitions. llvm-svn: 174794
* Constify some getters in RedeclarableTemplateDeclDmitri Gribenko2013-01-231-6/+6
| | | | llvm-svn: 173272
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-2/+2
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-3/+3
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Fixed ClassTemplateSpecializationDecl source range.Abramo Bagnara2012-10-151-7/+21
| | | | llvm-svn: 165975
OpenPOWER on IntegriCloud