summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2014-07-22 04:42:15 +0000
committerRichard Trieu <rtrieu@google.com>2014-07-22 04:42:15 +0000
commitd53def22efc4a3d3d30ae05ca2d2f720181ae417 (patch)
treecdcf206a85d28fc6a149e2267198e3417bb513a4
parent41b20e77833b05157e258a4868fb25a470f70548 (diff)
downloadbcm5719-llvm-d53def22efc4a3d3d30ae05ca2d2f720181ae417.tar.gz
bcm5719-llvm-d53def22efc4a3d3d30ae05ca2d2f720181ae417.zip
Fix '&' printing for template arguments in parentheses in template diffing.
llvm-svn: 213613
-rw-r--r--clang/lib/AST/ASTDiagnostic.cpp9
-rw-r--r--clang/test/Misc/diag-template-diffing.cpp8
2 files changed, 12 insertions, 5 deletions
diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp
index 20540f3ce12..5f78df2c473 100644
--- a/clang/lib/AST/ASTDiagnostic.cpp
+++ b/clang/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/clang/test/Misc/diag-template-diffing.cpp b/clang/test/Misc/diag-template-diffing.cpp
index 391915ee970..fcafb332564 100644
--- a/clang/test/Misc/diag-template-diffing.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud