summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclTemplate.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Port getLocStart -> getBeginLocStephen Kelly2018-08-091-1/+1
| | | | | | | | | | Reviewers: teemperor! Subscribers: jholewinski, whisperity, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D50350 llvm-svn: 339385
* [AST][1/4] Move the bit-fields from TagDecl, EnumDecl and RecordDecl into ↵Erich Keane2018-08-011-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DeclContext DeclContext has a little less than 8 bytes free due to the alignment requirements on 64 bits archs. This set of patches moves the bit-fields from classes deriving from DeclContext into DeclContext. On 32 bits archs this increases the size of DeclContext by 4 bytes but this is balanced by an equal or larger reduction in the size of the classes deriving from it. On 64 bits archs the size of DeclContext stays the same but most of the classes deriving from it shrink by 8/16 bytes. (-print-stats diff here https://reviews.llvm.org/D49728) When doing an -fsyntax-only on all of Boost this result in a 3.6% reduction in the size of all Decls and a 1% reduction in the run time due to the lower cache miss rate. For now CXXRecordDecl is not touched but there is an easy 6 (if I count correctly) bytes gain available there by moving some bits from DefinitionData into the free space of DeclContext. This will be the subject of another patch. This patch sequence also enable the possibility of refactoring FunctionDecl: To save space some bits from classes deriving from FunctionDecl were moved to FunctionDecl. This resulted in a lot of stuff in FunctionDecl which do not belong logically to it. After this set of patches however it is just a simple matter of adding a SomethingDeclBitfields in DeclContext and moving the bits to it from FunctionDecl. This first patch introduces the anonymous union in DeclContext and all the *DeclBitfields classes holding the bit-fields, and moves the bits from TagDecl, EnumDecl and RecordDecl into DeclContext. This patch is followed by https://reviews.llvm.org/D49732, https://reviews.llvm.org/D49733 and https://reviews.llvm.org/D49734. Differential Revision: https://reviews.llvm.org/D49729 Patch By: bricci llvm-svn: 338630
* Remove trailing spaceFangrui Song2018-07-301-7/+7
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338291
* Revert rC330794 and some dependent tiny bug fixes Faisal Vali2018-04-261-21/+0
| | | | | | | | | | | | | | See Richard's humbling feedback here: http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226482.html http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226486.html Wish I'd had the patience to solicit the feedback prior to committing :) Sorry for the noise guys. Thank you Richard for being the steward that clang deserves! llvm-svn: 330888
* [c++2a] [concepts] Add rudimentary parsing support for template concept ↵Faisal Vali2018-04-251-0/+21
| | | | | | | | | | | | | | declarations This patch is a tweak of changyu's patch: https://reviews.llvm.org/D40381. It differs in that the recognition of the 'concept' token is moved into the machinery that recognizes declaration-specifiers - this allows us to leverage the attribute handling machinery more seamlessly. See the test file to get a sense of the basic parsing that this patch supports. There is much more work to be done before concepts are usable... Thanks Changyu! llvm-svn: 330794
* [AST] Fix some Clang-tidy modernize-use-auto warnings; other minor fixes (NFC).Eugene Zelenko2018-03-291-29/+27
| | | | llvm-svn: 328826
* D40901: Refactor lazy loading of template specializations. NFCVassil Vassilev2017-12-141-39/+17
| | | | llvm-svn: 320763
* PR35456: Track definedness of variable template specializations separately fromRichard Smith2017-12-021-2/+2
| | | | | | | | | | whether they have an initializer. We cannot distinguish between a declaration of a variable template specialization and a definition of one that lacks an initializer without this, and would previously mistake the latter for the former. llvm-svn: 319605
* [AST] Fix some Clang-tidy modernize and Include What You Use warnings; other ↵Eugene Zelenko2017-11-291-31/+49
| | | | | | minor fixes (NFC). llvm-svn: 319376
* Refactor functions PrintTemplateArgumentListSerge Pavlov2017-11-281-8/+4
| | | | | | | | | | | These functions were defined as static members of TemplateSpecializationType. Now they are moved to namespace level. Previously there were different implementations for lists containing TemplateArgument and TemplateArgumentLoc, now these implementations share the same code. This change is a result of refactoring patch D40508. NFC. llvm-svn: 319178
* 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
OpenPOWER on IntegriCloud