Addressing code review comments for commit 135509 - Add FixItHints in case a C++ function call is missing * or & operators on
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135643 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/FixIt/fixit-function-call.cpp b/test/FixIt/fixit-function-call.cpp
index e59e21b..d954267 100644
--- a/test/FixIt/fixit-function-call.cpp
+++ b/test/FixIt/fixit-function-call.cpp
@@ -24,7 +24,7 @@
// This call cannot be fixed since without resulting in null pointer dereference.
// CHECK: error: no matching function for call to 'f1
-// CHECK-NOT: take the address of the argument with &
+// CHECK-NOT: dereference the argument with *
// CHECK-NOT: fix-it
f1((int *)0);
}
@@ -65,16 +65,19 @@
double y;
};
+class C : A {};
+
bool br(A &a);
bool bp(A *a);
bool dv(B b);
-void dbcaller(A *ptra, B *ptrb) {
+void dbcaller(A *ptra, B *ptrb, C &c) {
B b;
// CHECK: error: no matching function for call to 'br
// CHECK: fix-it{{.*}}*
br(ptrb); // good
+
// CHECK: error: no matching function for call to 'bp
// CHECK: fix-it{{.*}}&
bp(b); // good
@@ -82,6 +85,20 @@
// CHECK: error: no matching function for call to 'dv
// CHECK-NOT: fix-it
dv(ptra); // bad: base to derived
+
+// CHECK: error: no matching function for call to 'dv
+// CHECK: remove &
+ dv(&b);
+
+// CHECK: error: no matching function for call to 'bp
+// CHECK: remove *
+ bp(*ptra);
+
+// TODO: Test that we do not provide a fixit when inheritance is private.
+// CHECK: error: no matching function for call to 'bp
+// There should not be a fixit here:
+// CHECK: fix-it
+ bp(c);
}
// CHECK: errors generated