summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/TemplateBase.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith ↵Yaron Keren2016-01-291-1/+1
| | | | | | r259192 post commit comment. llvm-svn: 259232
* Implement TemplateArgument::dump() method for debugging, patterned after ↵Yaron Keren2016-01-291-0/+9
| | | | | | TemplateName::dump(). llvm-svn: 259192
* [TrailingObjects] Convert AST classes that had a ASTTemplateKWAndArgsInfo.James Y Knight2015-12-291-13/+9
| | | | | | | | | | | | | | | | | | | | So, also: - Moved the TemplateArgumentLoc array out of the ASTTemplateKWAndArgsInfo class (making it a simple fixed-size object), to avoid needing to have a variable-length object as part of a variable-length object. Now the objects that have a ASTTemplateKWAndArgsInfo also have some TemplateArgumentLoc objects appended directly. - Removed some internal-use accessors which became simply a wrapper on getTrailingObjects. - Moved MemberNameQualifier out of the MemberExpr class, renamed it MemberExprNameQualifier, because the template can't refer to a class nested within the class it's defining. llvm-svn: 256570
* [TrailingObjects] Convert ASTTemplateKWAndArgsInfo and ↵James Y Knight2015-12-241-58/+35
| | | | | | | | | | | | | | | | | | | ASTTemplateArgumentListInfo. Doing so required separating them so that the former doesn't inherit from the latter anymore. Investigating that, it became clear that the inheritance wasn't actually providing real value in any case. So also: - Remove a bunch of redundant functions (getExplicitTemplateArgs, getOptionalExplicitTemplateArgs) on various Expr subclasses which depended on the inheritance relationship. - Switched external callers to use pre-existing accessors that return the data they're actually interested in (getTemplateArgs, getNumTemplateArgs, etc). - Switched internal callers to use pre-existing getTemplateKWAndArgsInfo. llvm-svn: 256359
* Print qualified display names when emitting CodeViewReid Kleckner2015-12-161-1/+1
| | | | | | This is what debuggers expect. Words towards fixing PR21528. llvm-svn: 255744
* [AST] ArrayRefize template argument packs. No functionality change intended.Benjamin Kramer2015-08-051-8/+6
| | | | llvm-svn: 244026
* Use APSInt::isSameValue instead of operator== in a place where two APSInt'sRichard Trieu2015-01-091-1/+5
| | | | | | may have different sizes. Fixes PR22017 llvm-svn: 225488
* NFC: Minor formatting fixWill Wilson2014-12-131-1/+1
| | | | llvm-svn: 224185
* Pretty print support for template arg enum constantsWill Wilson2014-12-131-2/+13
| | | | llvm-svn: 224184
* Fix the rest of PR21289: a pack expansion that we can't expand yet makes aRichard Smith2014-10-171-2/+4
| | | | | | | template specialization type dependent, even if it has no dependent template arguments. I've filed a corresponding bug against the C++ standard. llvm-svn: 220088
* PR21246: DebugInfo: Emit the appropriate type (cv qualifiers, ↵David Blaikie2014-10-161-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | reference-ness, etc) for non-type template parameters Plumb through the full QualType of the TemplateArgument::Declaration, as it's insufficient to only know whether the type is a reference or pointer (that was necessary for mangling, but insufficient for debug info). This shouldn't increase the size of TemplateArgument as TemplateArgument::Integer is still longer by another 32 bits. Several bits of code were testing that the reference-ness of the parameters matched, but this seemed to be insufficient (various other features of the type could've mismatched and wouldn't've been caught) and unnecessary, at least insofar as removing those tests didn't cause anything to fail. (Richard - perchaps you can hypothesize why any of these checks might need to test reference-ness of the parameters (& explain why reference-ness is part of the mangling - I would've figured that for the reference-ness to be different, a prior template argument would have to be different). I'd be happy to add them in/beef them up and add test cases if there's a reason for them) llvm-svn: 219900
* Added the pack_elements range accessor. Refactoring some for loops to use ↵Aaron Ballman2014-07-151-13/+8
| | | | | | range-based for loops instead. No functional changes intended. llvm-svn: 213095
* [C++11] Use 'nullptr'. AST edition.Craig Topper2014-05-121-3/+3
| | | | llvm-svn: 208517
* Render anonymous entities as '(anonymous <thing>)' (and lambdas as '(lambda ↵David Blaikie2014-04-021-2/+2
| | | | | | | | | | | | at ... )') For namespaces, this is consistent with mangling and GCC's debug info behavior. For structs, GCC uses <anonymous struct> but we prefer consistency between all anonymous entities but don't want to confuse them with template arguments, etc, so we'll just go with parens in all cases. llvm-svn: 205398
* PR19278: Align ASTTemplateArgumentListInfo to match its following dynamic arrayRichard Smith2014-03-281-0/+2
| | | | | | | of TemplateArgumentLocs. 'uint64_t' has higher alignment requirements than a pointer on some platforms. llvm-svn: 205068
* Reduce sizeof(TemplateArgument) from 32 to 24.Eli Friedman2013-08-211-6/+10
| | | | | | No intended functionality change. llvm-svn: 188959
* Fix one place I missed that was memcpy'ing TypeLocs in a way that messesEli Friedman2013-06-201-62/+0
| | | | | | | | | up alignment. Fixes utilities/tuple/tuple.tuple/tuple.creation/tuple_cat.pass.cpp from the libc++ testsuite. llvm-svn: 184397
* Debug Info: include address-of ('&') operator and qualified names in ↵David Blaikie2013-05-091-1/+2
| | | | | | | | | | | | template argument lists This fixes several (7 out of 16) cases of PR14492 in the GDB 7.5 test suite. It seems GDB was bailing out whenever it had even the slightest problem with the template argument list (& I assume it didn't like seeing template value parameters that were just simple names - perhaps assuming that lone names must be types, not values) llvm-svn: 181556
* Streamify getNameForDiagnostic and remove the string versions of ↵Benjamin Kramer2013-02-221-3/+1
| | | | | | PrintTemplateArgumentList. llvm-svn: 175894
* Use None rather than Optional<T>() where possible.David Blaikie2013-02-211-1/+1
| | | | llvm-svn: 175705
* Include llvm::Optional in clang/Basic/LLVM.hDavid Blaikie2013-02-201-6/+5
| | | | | | Post-commit CR feedback from Jordan Rose regarding r175594. llvm-svn: 175679
* Replace TypeLoc llvm::cast support to be well-defined.David Blaikie2013-02-181-2/+2
| | | | | | | | | | | | | | The TypeLoc hierarchy used the llvm::cast machinery to perform undefined behavior by casting pointers/references to TypeLoc objects to derived types and then using the derived copy constructors (or even returning pointers to derived types that actually point to the original TypeLoc object). Some context is in this thread: http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html Though it's spread over a few months which can be hard to read in the mail archive. llvm-svn: 175462
* Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.Jordan Rose2013-02-081-1/+0
| | | | | | | Nearly all of these changes are one-to-one replacements; the few that aren't have to do with custom identifier validation. llvm-svn: 174768
* Include pruning and general cleanup.Benjamin Kramer2012-12-011-0/+1
| | | | llvm-svn: 169095
* Added forgotten break.Abramo Bagnara2012-10-051-2/+2
| | | | llvm-svn: 165298
* Fix the AST representation for non-type template arguments to encodeEli Friedman2012-09-261-24/+39
| | | | | | | | | | | | enough information so we can mangle them correctly in cases involving dependent parameter types. (This specifically impacts cases involving null pointers and cases involving parameters of reference type.) Fix the mangler to use this information instead of trying to scavenge it out of the parameter declaration. <rdar://problem/12296776>. llvm-svn: 164656
* Fix overallocation and underalignment of ASTTemplateArgumentListInfo objects.Richard Smith2012-08-151-3/+3
| | | | llvm-svn: 161918
* Reuse APInt's getNumWords, which gets rounding right (my ad-hoc solution ↵Benjamin Kramer2012-06-071-3/+4
| | | | | | missed it). llvm-svn: 158151
* Plug a long standing memory leak in TemplateArgument.Benjamin Kramer2012-06-071-7/+25
| | | | | | | | | | | | | | | The integral APSInt value is now stored in a decomposed form and the backing store for large values is allocated via the ASTContext. This way its not leaked as TemplateArguments are never destructed when they are allocated in the ASTContext. Since the integral data is immutable it is now shared between instances, making copying TemplateArguments a trivial operation. Currently getting the integral data out of a TemplateArgument requires creating a new APSInt object. This is cheap when the value is small but can be expensive if it's not. If this turns out to be an issue a more efficient accessor could be added. llvm-svn: 158150
* Implement support for null non-type template arguments for non-typeDouglas Gregor2012-04-061-14/+21
| | | | | | | template parameters of pointer, pointer-to-member, or nullptr_t type in C++11. Fixes PR9700 / <rdar://problem/11193097>. llvm-svn: 154219
* Print NamedDecls directly to a raw_ostream where possible.Benjamin Kramer2012-02-071-1/+1
| | | | llvm-svn: 149982
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-2/+2
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Move a method from IdentifierTable.h out of line and remove the SmallString ↵Benjamin Kramer2012-02-041-3/+3
| | | | | | | | include. Fix all the transitive include users. llvm-svn: 149783
* Added source location for the template keyword in AST template-id expressions.Abramo Bagnara2012-01-271-4/+35
| | | | llvm-svn: 149127
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-15/+13
| | | | llvm-svn: 148577
* Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie2011-09-231-2/+0
| | | | llvm-svn: 140407
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-2/+2
| | | | llvm-svn: 140367
* Don't use TemplateArgumentListInfo inside AST nodes because it may leak.Argyrios Kyrtzidis2011-09-221-0/+62
| | | | | | 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
* Introduce the notion of instantiation dependence into Clang's AST. ADouglas Gregor2011-07-011-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | type/expression/template argument/etc. is instantiation-dependent if it somehow involves a template parameter, even if it doesn't meet the requirements for the more common kinds of dependence (dependent type, type-dependent expression, value-dependent expression). When we see an instantiation-dependent type, we know we always need to perform substitution into that instantiation-dependent type. This keeps us from short-circuiting evaluation in places where we shouldn't, and lets us properly implement C++0x [temp.type]p2. In theory, this would also allow us to properly mangle instantiation-dependent-but-not-dependent decltype types per the Itanium C++ ABI, but we aren't quite there because we still mangle based on the canonical type in cases like, e.g., template<unsigned> struct A { }; template<typename T> void f(A<sizeof(sizeof(decltype(T() + T())))>) { } template void f<int>(A<sizeof(sizeof(int))>); and therefore get the wrong answer. llvm-svn: 134225
* Objective-ARC++: infer template type arguments ofDouglas Gregor2011-06-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | ownership-unqualified retainable object type as __strong. This allows us to write, e.g., std::vector<id> and we'll infer that the vector's element types have __strong ownership semantics, which is far nicer than requiring: std::vector<__strong id> Note that we allow one to override the ownership qualifier of a substituted template type parameter, e.g., given template<typename T> struct X { typedef __weak T type; }; X<id> is treated the same as X<__strong id>. At instantiation type, the __weak in "__weak T" overrides the (inferred or specified) __strong on the template argument type, so that we can still provide metaprogramming transformations. This is part of <rdar://problem/9595486>. llvm-svn: 133303
* Silence more -Wnon-pod-memset given its current implementation. I may beChandler Carruth2011-04-281-1/+1
| | | | | | | able to revert these based on a patch I'm working on, but no reason for people to be spammed with warnings in the interim. llvm-svn: 130394
* Push nested-name-specifier source location information into templateDouglas Gregor2011-03-021-5/+5
| | | | | | | | | | | | template arguments. I believe that this is the last place in the AST where we were storing a source range for a nested-name-specifier rather than a proper nested-name-specifier location structure. (Yay!) There is still a lot of cleanup to do in the TreeTransform, which doesn't take advantage of nested-name-specifiers with source-location information everywhere it could. llvm-svn: 126844
* Clean up some gross code in the printer here. No more string streamChandler Carruth2011-02-251-13/+5
| | | | | | | | | | silliness, and actually use the existing facilities of raw_ostream to do escaping. This will also hopefully fix an assert when building with signed char (MSVC I think). llvm-svn: 126505
* Improve bool and char integral template argument printing inChandler Carruth2011-02-191-1/+34
| | | | | | | | | diagnostics, resolving PR9227. Patch originally by Mihai Rusu and Stephen Hines with some minimal style tweaks from me. llvm-svn: 125999
* Teach template template argument pack expansions to keep track of theDouglas Gregor2011-01-141-2/+10
| | | | | | | number of expansions, when we know it, and propagate that information through Sema. llvm-svn: 123493
* Teach PackExpansionExpr to keep track of the number of pack expansionsDouglas Gregor2011-01-141-1/+1
| | | | | | it will expand to, if known. Propagate this information throughout Sema. llvm-svn: 123470
* Keep track of the number of expansions to be produced from a type packDouglas Gregor2011-01-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | | expansion, when it is known due to the substitution of an out parameter pack. This allows us to properly handle substitution into pack expansions that involve multiple parameter packs at different template parameter levels, even when this substitution happens one level at a time (as with partial specializations of member class templates and the signatures of member function templates). Note that the diagnostic we provide when there is an arity mismatch between an outer parameter pack and an inner parameter pack in this case isn't as clear as the normal diagnostic for an arity mismatch. However, this doesn't matter because these cases are very, very rare and (even then) only typically occur in a SFINAE context. The other kinds of pack expansions (expression, template, etc.) still need to support optional tracking of the number of expansions, and we need the moral equivalent of SubstTemplateTypeParmPackType for substituted argument packs of template template and non-type template parameters. llvm-svn: 123448
* PR3558: mark "logically const" accessor methods in ASTContext as const,Jay Foad2011-01-121-1/+1
| | | | | | | and mark the fields they use as mutable. This allows us to remove a few const_casts. llvm-svn: 123314
* Add TemplateArgument::CreatePackCopy() to create a new parameter packDouglas Gregor2011-01-111-0/+12
| | | | | | | in ASTContext-allocated memory, copying the provided template arguments. Use this new routine where we can. No functionality change. llvm-svn: 123289
OpenPOWER on IntegriCloud