]> granicus.if.org Git - clang/commitdiff
Merging r213613:
authorBill Wendling <isanbard@gmail.com>
Mon, 4 Aug 2014 04:35:10 +0000 (04:35 +0000)
committerBill Wendling <isanbard@gmail.com>
Mon, 4 Aug 2014 04:35:10 +0000 (04:35 +0000)
------------------------------------------------------------------------
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

lib/AST/ASTDiagnostic.cpp
test/Misc/diag-template-diffing.cpp

index 20540f3ce128a23a06c18d4124267268fb38d3a2..5f78df2c473b4a3dbb2069872d86bf578b928c62 100644 (file)
@@ -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);
index 391915ee970e1f7bf7d5eece987f59872ffaa6c6..fcafb33256400c7149d874a1af59df31fabf4027 100644 (file)
@@ -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.