summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclTemplate.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [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
* PR9023: A template template parameter whose template parameter list contains anRichard Smith2012-09-071-3/+55
| | | | | | | | | | | | | unexpanded parameter pack is a pack expansion. Thus, as with a non-type template parameter which is a pack expansion, it needs to be expanded early into a fixed list of template parameters. Since the expanded list of template parameters is not itself a parameter pack, it is permitted to appear before the end of the template parameter list, so also remove that restriction (for both template template parameter pack expansions and non-type template parameter pack expansions). llvm-svn: 163369
* Fix misaligned allocation of TemplateParameterList objects.Richard Smith2012-08-161-1/+2
| | | | llvm-svn: 162056
* Make explicit specializations at class scope workNico Weber2012-06-251-1/+2
| | | | | | | for non-type template parameters in microsoft mode. PR12709. llvm-svn: 159147
* Fix non-deterministic iteration order when walking the specializationsChandler Carruth2012-05-031-7/+8
| | | | | | | | | | | | | of templates by using the newly introduce FoldingSetVector. This preserves insertion order for all iteration of specializations. I've also included a somewhat terrifying testcase that rapidly builds up a large number of functions. This is enough that any system with ASLR will have non-deterministic debug information generated for the test case without the fix here as the debug information is generated in part by walking these specializations. llvm-svn: 156133
* When we form a new function/class template specialization, we firstDouglas Gregor2012-03-281-3/+21
| | | | | | | | | | | search for the specialization (in a folding set) and, if not found form a *Decl that is then inserted into that folding set. In rare cases, the folding set may be reallocated between the search and the insertion, causing a crash. No test case, because triggering rehashing consistently in a small test case is not feasible. Fixes <rdar://problem/11115071>. llvm-svn: 153575
* Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr toJohn McCall2012-03-101-1/+1
| | | | | | | | track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. llvm-svn: 152491
* De-virtualize getPreviousDecl() and getMostRecentDecl() when we knowDouglas Gregor2012-01-141-6/+6
| | | | | | | | | | | | we have a redeclarable type, and only use the new virtual versions (getPreviousDeclImpl() and getMostRecentDeclImpl()) when we don't have that type information. This keeps us from penalizing users with strict type information (and is the moral equivalent of a "final" method). Plus, settle on the names getPreviousDecl() and getMostRecentDecl() throughout. llvm-svn: 148187
* Add a FIXME for mutation of the common pointer of a ↵Douglas Gregor2012-01-141-1/+5
| | | | | | RedeclarableTemplateDecl. It is not clear that it's worth delaying the allocation of said pointer llvm-svn: 148182
* Reimplement RedeclarableTemplateDecl in terms ofDouglas Gregor2012-01-141-33/+21
| | | | | | | | | | | Redeclarable<RedeclarableTemplateDecl>, eliminating a bunch of redeclaration-chain logic both in RedeclarableTemplateDecl and especially in its (de-)serialization. As part of this, eliminate the RedeclarableTemplate<> class template, which was an abstraction that didn't actually save anything. llvm-svn: 148181
* When creating declarations that are deserialized from an module file,Douglas Gregor2012-01-051-21/+68
| | | | | | | go through a central allocation routine Decl::AllocateDeserializedDecl(). No actual functionality change (yet). llvm-svn: 147614
* Unweaken vtables as per ↵David Blaikie2011-12-201-0/+17
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146959
* Fixed source range for template implicit instantiations.Abramo Bagnara2011-10-031-9/+21
| | | | llvm-svn: 141018
* Don't use TemplateArgumentListInfo inside AST nodes because it may leak.Argyrios Kyrtzidis2011-09-221-0/+18
| | | | | | Use ASTTemplateArgumentListInfo instead. llvm-svn: 140331
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-2/+2
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Implement support for C++0x alias templates.Richard Smith2011-05-051-0/+31
| | | | llvm-svn: 130953
* Re-applies the patch first applied way back in r106099, withChandler Carruth2011-05-011-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | accompanying fixes to make it work today. The core of this patch is to provide a link from a TemplateTypeParmType back to the TemplateTypeParmDecl node which declared it. This in turn provides much more precise information about the type, where it came from, and how it functions for AST consumers. To make the patch work almost a year after its first attempt, it needed serialization support, and it now retains the old getName() interface. Finally, it requires us to not attempt to instantiate the type in an unsupported friend decl -- specifically those coming from template friend decls but which refer to a specific type through a dependent name. A cleaner representation of the last item would be to build FriendTemplateDecl nodes for these, storing their template parameters etc, and to perform proper instantation of them like any other template declaration. They can still be flagged as unsupported for the purpose of access checking, etc. This passed an asserts-enabled bootstrap for me, and the reduced test case mentioned in the original review thread no longer causes issues, likely fixed at somewhere amidst the 24k revisions that have elapsed. llvm-svn: 130628
* Chained PCH: Remember when additional specializations are added to a ↵Sebastian Redl2011-04-141-0/+7
| | | | | | function template from a previous PCH. Fixes the only crasher when using massive chains on Clang's Sema component. We still have some incomplete codegen there. llvm-svn: 129516
* Fixed InnerLocStart.Abramo Bagnara2011-03-091-10/+18
| | | | llvm-svn: 127330
* Fixed source range for StaticAssertDecl and LinkageSpecDecl. Fixed source ↵Abramo Bagnara2011-03-081-3/+3
| | | | | | range for declarations using postfix types. llvm-svn: 127251
* Fixed source range for all DeclaratorDecl's.Abramo Bagnara2011-03-081-17/+15
| | | | llvm-svn: 127225
OpenPOWER on IntegriCloud