summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2014-08-04 04:35:10 +0000
committerBill Wendling <isanbard@gmail.com>2014-08-04 04:35:10 +0000
commit24816d294452aa017014a0f215333b45a6b49cbc (patch)
treef1dd74acc9ec496da9d83493d953a6e3ce22ebfd
parent9efbb8e0f658e1aa793711f84c15ef0fe2feccef (diff)
Merging r213613:
------------------------------------------------------------------------ r213613 | rtrieu | 2014-07-21 21:42:15 -0700 (Mon, 21 Jul 2014) | 2 lines Fix '&' printing for template arguments in parentheses in template diffing. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_35@214692 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/ASTDiagnostic.cpp9
-rw-r--r--test/Misc/diag-template-diffing.cpp8
2 files changed, 12 insertions, 5 deletions
diff --git a/lib/AST/ASTDiagnostic.cpp b/lib/AST/ASTDiagnostic.cpp
index 20540f3ce1..5f78df2c47 100644
--- a/lib/AST/ASTDiagnostic.cpp
+++ b/lib/AST/ASTDiagnostic.cpp
@@ -994,7 +994,8 @@ class TemplateDiff {
bool FromAddressOf = false;
if (FromValueDecl) {
if (FromExpr) {
- if (UnaryOperator *UO = dyn_cast<UnaryOperator>(FromExpr)) {
+ if (UnaryOperator *UO =
+ dyn_cast<UnaryOperator>(FromExpr->IgnoreParens())) {
if (UO->getOpcode() == UO_AddrOf)
FromAddressOf = true;
}
@@ -1007,14 +1008,16 @@ class TemplateDiff {
bool ToAddressOf = false;
if (ToValueDecl) {
if (ToExpr) {
- if (UnaryOperator *UO = dyn_cast<UnaryOperator>(ToExpr)) {
+ if (UnaryOperator *UO =
+ dyn_cast<UnaryOperator>(ToExpr->IgnoreParens())) {
if (UO->getOpcode() == UO_AddrOf) {
ToAddressOf = true;
}
}
} else {
- if (!ArgumentType->isReferenceType())
+ if (!ArgumentType->isReferenceType()) {
ToAddressOf = true;
+ }
}
}
Tree.SetNode(FromValueDecl, ToValueDecl, FromAddressOf, ToAddressOf);
diff --git a/test/Misc/diag-template-diffing.cpp b/test/Misc/diag-template-diffing.cpp
index 391915ee97..fcafb33256 100644
--- a/test/Misc/diag-template-diffing.cpp
+++ b/test/Misc/diag-template-diffing.cpp
@@ -1120,9 +1120,13 @@ Wrapper<S<ptr>> W = MakeWrapper<S<&global>>();
// Don't print an extra '&' for 'ptr'
// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global>>' to 'Wrapper<S<ptr>>'
-Wrapper<S<(&global2)>> W2 = MakeWrapper<S<&global>>();
// Handle parens correctly
-// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global>>' to 'Wrapper<S<global2>>'
+Wrapper<S<(&global2)>> W2 = MakeWrapper<S<&global>>();
+// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global>>' to 'Wrapper<S<&global2>>'
+Wrapper<S<&global2>> W3 = MakeWrapper<S<(&global)>>();
+// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global>>' to 'Wrapper<S<&global2>>'
+Wrapper<S<(&global2)>> W4 = MakeWrapper<S<(&global)>>();
+// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global>>' to 'Wrapper<S<&global2>>'
}
// CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated.