summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/TemplateBase.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove trailing spaceFangrui Song2018-07-301-34/+34
| | | | | | sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338291
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-091-1/+1
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 llvm-svn: 331834
* Remove redundant casts. NFCGeorge Burgess IV2018-03-011-1/+1
| | | | | | | | | | | | | | | | | | | So I wrote a clang-tidy check to lint out redundant `isa`, `cast`, and `dyn_cast`s for fun. This is a portion of what it found for clang; I plan to do similar cleanups in LLVM and other subprojects when I find time. Because of the volume of changes, I explicitly avoided making any change that wasn't highly local and obviously correct to me (e.g. we still have a number of foo(cast<Bar>(baz)) that I didn't touch, since overloading is a thing and the cast<Bar> did actually change the type -- just up the class hierarchy). I also tried to leave the types we were cast<>ing to somewhere nearby, in cases where it wasn't locally obvious what we were dealing with before. llvm-svn: 326416
* [AST] Fix some Clang-tidy modernize and Include What You Use warnings; other ↵Eugene Zelenko2017-11-211-5/+19
| | | | | | minor fixes (NFC). llvm-svn: 318813
* [AST] Give TemplateArgumentLoc a constexpr ctor.Benjamin Kramer2017-01-301-4/+0
| | | | | | | This removes the thread-safe static from clang::TemplateTemplateParmDecl::getDefaultArgument() const::None llvm-svn: 293523
* When merging two deduced non-type template arguments for the same parameter,Richard Smith2016-12-231-0/+25
| | | | | | | | | | | | | | | | | | | fail the merge if the arguments have different types (except if one of them was deduced from an array bound, in which case take the type from the other). This is correct because (except in the array bound case) the type of the template argument in each deduction must match the type of the parameter, so at least one of the two deduced arguments must have a mismatched type. This is necessary because we would otherwise lose the type information for the discarded template argument in the merge, and fail to diagnose the mismatch. In order to power this, we now properly retain the type of a deduced non-type template argument deduced from a declaration, rather than giving it the type of the template parameter; we'll convert it to the template parameter type when checking the deduced arguments. llvm-svn: 290399
* Retire llvm::alignOf in favor of C++11 alignof.Benjamin Kramer2016-10-201-1/+1
| | | | | | No functionality change intended. llvm-svn: 284730
* 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
OpenPOWER on IntegriCloud