summaryrefslogtreecommitdiffstats
path: root/clang/test/Misc/diag-template-diffing.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Print nested name specifiers for typedefs and type aliasesAlex Lorenz2017-03-101-4/+4
| | | | | | | | | | | | Printing typedefs or type aliases using clang_getTypeSpelling() is missing the namespace they are defined in. This is in contrast to other types that always yield the full typename including namespaces. Patch by Michael Reiher! Differential Revision: https://reviews.llvm.org/D29944 llvm-svn: 297465
* Implement C++ DR1391 (wg21.link/cwg1391)Richard Smith2017-01-091-3/+3
| | | | | | | | | | | | | | Check for implicit conversion sequences for non-dependent function template parameters between deduction and substitution. The idea is to accept as many cases as possible, on the basis that substitution failure outside the immediate context is much more common during substitution than during implicit conversion sequence formation. This re-commits r290808, reverted in r290811 and r291412, with a couple of fixes for handling of explicitly-specified non-trailing template argument packs. llvm-svn: 291427
* Revert r291410 and r291411.Richard Smith2017-01-091-3/+3
| | | | | | The test-suite bots are still failing even after r291410's fix. llvm-svn: 291412
* Implement C++ DR1391 (wg21.link/cwg1391)Richard Smith2017-01-091-3/+3
| | | | | | | | | | | | | Check for implicit conversion sequences for non-dependent function template parameters between deduction and substitution. The idea is to accept as many cases as possible, on the basis that substitution failure outside the immediate context is much more common during substitution than during implicit conversion sequence formation. This re-commits r290808, reverted in r290811, with a fix for handling of explicitly-specified template argument packs. llvm-svn: 291410
* Revert "DR1391: Check for implicit conversion sequences for non-dependent ↵Renato Golin2017-01-021-1/+1
| | | | | | | | | | | | | | function template parameters between deduction and substitution. The idea is to accept as many cases as possible, on the basis that substitution failure outside the immediate context is much more common during substitution than during implicit conversion sequence formation." This reverts commit r290808, as it broken all ARM and AArch64 test-suite test: MultiSource/UnitTests/C++11/frame_layout Also, please, next time, try to write a commit message in according to our guidelines: http://llvm.org/docs/DeveloperPolicy.html#commit-messages llvm-svn: 290811
* DR1391: Check for implicit conversion sequences for non-dependent functionRichard Smith2017-01-021-1/+1
| | | | | | | | | | | | template parameters between deduction and substitution. The idea is to accept as many cases as possible, on the basis that substitution failure outside the immediate context is much more common during substitution than during implicit conversion sequence formation. This does not implement the partial ordering portion of DR1391, which so far appears to be misguided. llvm-svn: 290808
* PR30831: Teach template type diffing to cope with TemplateSpecializationTypesRichard Smith2016-10-281-0/+5
| | | | | | that desugar to non-TSTs (such as injected-class-names). llvm-svn: 285437
* Fix crash in template type diffing.Richard Trieu2016-08-051-0/+30
| | | | | | | | | When the type being diffed is a type alias, and the orginal type is not a templated type, then there will be no unsugared TemplateSpecializationType. When this happens, exit early from the constructor. Also add assertions to the other iterator accessor to prevent the iterator from being used. llvm-svn: 277797
* Fix Clang crash with template type diffing.Richard Trieu2016-03-301-0/+37
| | | | | | | | | | Fixes https://llvm.org/bugs/show_bug.cgi?id=27129 which is crash involving type aliases and template type diffing. Template arguments for type aliases and template arguments for the underlying desugared type may not have one-to-one relations, which could mess us the attempt to get more information from the desugared type. For type aliases, ignore the iterator over the desugared type. llvm-svn: 264940
* Template Type Diffing changeRichard Trieu2016-02-021-22/+16
| | | | | | | When all the arguments of a template are elided, print "A<...>" instead of "A<[2 * ...]>". Also remove comment fragment that means nothing. llvm-svn: 259445
* Fixing more issues with template type diffingRichard Trieu2016-01-151-0/+56
| | | | | | | | | | | | 1) Print qualifiers for templates with zero arguments 2) Add a few more tests for the template type diffing refactoring. Specifically, PR24587 has been fixed and has a test case from http://reviews.llvm.org/D15384 3) Adds asserts to check the DiffTree is in correct state when moving nodes 4) Rename the field FromType and ToType since it is heavily used within member functions. llvm-svn: 257870
* Add new diff modes to template type diffing.Richard Trieu2016-01-151-0/+83
| | | | | | | | Remove an old assertion that does not hold. It is possible for a template argument to be a declaration in one instantiation and an integer in another. Create two new diff kinds for these (decl vs int and int vs decl). llvm-svn: 257869
* Save the integer type for integral template arguments.Richard Trieu2016-01-151-1/+15
| | | | | | | | | Save the integer type when diffing integers in template type diffing. When integers are different sizes, print out the type along with the integer value. Also with the type information, print true and false instead of 1 and 0 for boolean values. llvm-svn: 257861
* Make template type diffing use the new desguared iterator.Richard Trieu2016-01-151-4/+4
| | | | | | | | | | | | | If available, use the canonical template argument to fill in information for template type diffing instead of attempting to special case and evaluate Expr's for the value. Since those are the values used in template instantiation, we don't have to worry about difference between our evaluator and theirs. Also move the nullptr template arguments from DiffKind::Expression to DiffKind::Declaration and allow DiffKind::Declaration to set an Expr. The only effect that should result is that a named nullptr will show up as 'ptr aka nullptr' in diagnostics. llvm-svn: 257853
* Refactor template type diffingRichard Trieu2016-01-141-1/+1
| | | | | | | | | | | | | | | 1) Instead of using pairs of From/To* fields, combine fields into a struct TemplateArgInfo and have two in each DiffNode. 2) Use default initialization in DiffNode so that the constructor shows the only field that is initialized differently on construction. 3) Use Set and Get functions per each DiffKind to make sure all fields for the diff is set. In one case, the Expr fields were not set. 4) Don't print boolean literals for boolean template arguments. This prevents printing 'false aka 0' Only #3 has a functional change, which is reflected in the test change. llvm-svn: 257831
* Fix typo from r237482. "to reference of type" --> "to reference to type"Richard Trieu2015-05-161-1/+1
| | | | llvm-svn: 237507
* When emitting a dropped qualifier error, show which qualifiers are dropped.Richard Trieu2015-05-161-1/+1
| | | | llvm-svn: 237505
* Reverse the order of types in the reference dropping qualifiers error.Richard Trieu2015-05-151-1/+1
| | | | | | | | The error has the form ... 'int' ... 'const int' ... dropped qualifiers. At first glance, it appears that the const qualifier is added. Reverse the types so that the second type is less qualified than the first. llvm-svn: 237482
* Update assumption in template diffing about integer template arguments.Richard Trieu2015-02-261-0/+13
| | | | | | | | | | Fix for PR22017. Integer template arguments are automatically bit extended to the size of the integer type. In template diffing, evaluated expressions were not having their results extending, leading to comparing two APSInt's with different widths. Apply the proper bit extending when evaluating template arguments. This mainly affected bool template arguments. llvm-svn: 230603
* When checking the template argument list, use a copy of that list for changesRichard Trieu2015-01-241-0/+14
| | | | | | | | | | | | | | | | | | | and only update the orginal list on a valid arugment list. When checking an individual expression template argument, and conversions are required, update the expression in the template argument. Since template arguments are speculatively checked, the copying of the template argument list prevents updating the template arguments when the list does not match the template. Additionally, clean up the integer checking code in the template diffing code. The code performs unneccessary conversions from APSInt to APInt. Fixes PR21758. This essentially reverts r224770 to recommits r224667 and r224668 with extra changes to prevent the template instantiation problems seen in PR22006. A test to catch the discovered problem is also added. llvm-svn: 226983
* This reverts commit r224668 and r224667.Rafael Espindola2014-12-231-14/+0
| | | | | | | | | | r224667 broke bootstrap on Fedora 20 X86_64 (at least). See pr22006 for the details. r224668 depends on r224667. llvm-svn: 224770
* Fix for PR21758Richard Trieu2014-12-201-0/+14
| | | | | | | | | When a non-type template argument expression needs a conversion to change it into the argument type, preserve that information by remaking the TemplateArgument with an expression that has those conversions. Also a small fix to template type diffing to handle the extra conversions in some cases. llvm-svn: 224667
* If a template argument is non-evaluable expression, use the profile ID to seeRichard Trieu2014-07-261-0/+35
| | | | | | if the two arguments are equal. llvm-svn: 214008
* Pass the PrintingPolicy when converting types to strings in template typeRichard Trieu2014-07-251-6/+14
| | | | | | | diffing. This removes extra "struct"/"class" in the type names and gives "bool" instead of "_Bool" for booleans. llvm-svn: 213912
* Print "(default)" for default template template arguments to match theRichard Trieu2014-07-241-1/+22
| | | | | | printing of other types. llvm-svn: 213902
* Add support for nullptr template arguments to template type diffing.Richard Trieu2014-07-241-0/+54
| | | | llvm-svn: 213840
* Fix '&' printing for template arguments in parentheses in template diffing.Richard Trieu2014-07-221-2/+6
| | | | llvm-svn: 213613
* More gracefully handle parentheses in templare arguments in template diffing.Richard Trieu2014-07-221-1/+5
| | | | llvm-svn: 213611
* Fix a template diffing problem were an '&' is unexpectedly printed inRichard Trieu2014-07-221-0/+16
| | | | | | a template argument. llvm-svn: 213609
* PR15677 - Crash in template diffing. Check that expression is evaluatable ↵Nikola Smiljanic2014-07-011-0/+37
| | | | | | before evaluating it. llvm-svn: 212090
* Fix an edge case in the template differ with default arguments.Benjamin Kramer2013-10-081-1/+17
| | | | | | | | In the test case one type is coming from a typedef with no default arg, the other has the default arg. Taking the default arg from the typedef crashes, so always use the real template paramter declaration. PR17510. llvm-svn: 192202
* If a default argument is a dependent type, get the real type from the desugaredRichard Trieu2013-07-201-2/+24
| | | | | | | template. Passing around dependent types can lead to integral arguments that cannot be evaluated. llvm-svn: 186757
* Add 'not' to commands that are expected to fail.Rafael Espindola2013-07-041-4/+4
| | | | | | | This is at least good documentation, but also opens the possibility of using pipefail. llvm-svn: 185652
* Fix crash on invalid in template type diffing.Richard Trieu2013-05-071-0/+27
| | | | | | | | | This is a fix for PR15895, where Clang will crash when trying to print a template diff and the template uses an address of operator. This resulted from expecting a DeclRefExpr when the Expr could have also been UnaryOperator->DeclRefExpr. llvm-svn: 181365
* Do not assume the template argument is an integer only because theRichard Trieu2013-04-031-0/+5
| | | | | | | | | | expressions are integer. It can also be ValueDecl expressions Use the type information from the TemplateParameterList instead Patch by Olivier Goffart! llvm-svn: 178611
* Fix a crasher in Template Diffing.Richard Trieu2013-04-031-0/+39
| | | | | | | | | | When support was added for declaration arguments, the case of variadic declaration arguments was not supported. This patch fixes that problem by not crashing when certain ValueDecl's are null. Patch by Olivier Goffart! llvm-svn: 178610
* Fix a crasher in Template Diffing.Richard Trieu2013-04-031-0/+55
| | | | | | | | | | | | Value depenedent expressions for default arguments cannot be evaluated. Instead, use the desugared template type to get an argument expression that can be used. This is needed for both integer and declaration arguements. Also, move this common code into a separate function. Patch by Olivier Goffart! llvm-svn: 178609
* Strip off local qualifiers when converting from RecordType toRichard Trieu2013-03-231-24/+24
| | | | | | | TemplateSpecializationType during template type diffing. This allows the correct printing of diffing qualifiers on templates. llvm-svn: 177809
* Improve template diffing handling of default integer values.Richard Trieu2013-03-151-1/+1
| | | | | | | | | | When the template argument is both default and value dependent, the expression retrieved for the default argument cannot be evaluated, thus never matching any argument value. To get the proper value, get the template argument from the desugared template specialization. Also, output the original expression to provide more information about the argument mismatch. llvm-svn: 177209
* Update template diffing to handle template arguments that are declarations.Richard Trieu2013-02-271-0/+34
| | | | llvm-svn: 176153
* When comparing two template template arguments in the template differ, considerRichard Trieu2013-01-311-0/+8
| | | | | | | | | | | them the same if they are actually the same; having the same name isn't enough. Similar to r174013, template template arguments were also mistakenly considered the same when they had the same name but were in different namespaces. In addition, when printing template template arguments, use the qualified name if the regular name is the same. llvm-svn: 174029
* When comparing two templates in the template differ, consider them theDouglas Gregor2013-01-311-0/+17
| | | | | | | same if they are actually the same; having the same name isn't enough. Fixes <rdar://problem/12931988>. llvm-svn: 174013
* Handle passing non-Qualtypes to %diff better. Instead of asserting, fall backRichard Trieu2013-01-301-0/+15
| | | | | | to printing the default case. This is a fix for PR15023. llvm-svn: 173965
* Use a safe default width for template-diff'ing integral arguments, inDouglas Gregor2012-12-211-0/+18
| | | | | | | case we can't find an exact width to use. Fixes crash in <rdar://problem/12456626>. llvm-svn: 170951
* Fix a crash in diagnostic printing when a template class type is diff'edEli Friedman2012-12-181-0/+12
| | | | | | against itself. PR14489. llvm-svn: 170474
* Make template diffing handle integral expressions of various widths correctly.Eli Friedman2012-11-141-0/+7
| | | | | | PR14342. llvm-svn: 168005
* Fix the template type diffing to handle integral template arguments.Richard Trieu2012-11-011-0/+163
| | | | llvm-svn: 167252
* Update template type diffing to handle qualifiers. Differing qualifiers willRichard Trieu2012-09-281-0/+185
| | | | | | now be printed with highlighting. llvm-svn: 164843
* Teach Type::getAs<TemplateSpecializationType> that a TemplateSpecializationTypeRichard Smith2012-09-261-0/+18
| | | | | | | for a type alias template can appear as sugar at any level of desugaring, just like a TypedefType. llvm-svn: 164655
* Fix typos from r159463 and update tests. Added Matt Beaumont-Gay's suggestionRichard Trieu2012-06-291-38/+38
| | | | | | to improve wording of a diagnostic message. llvm-svn: 159473
OpenPOWER on IntegriCloud