aboutsummaryrefslogtreecommitdiff
path: root/test/FixIt/fixit-function-call.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2011-07-21 00:34:39 +0000
committerAnna Zaks <ganna@apple.com>2011-07-21 00:34:39 +0000
commitffe9edd45f26873d58e7ddf79d403dd8072b748b (patch)
treeb0e9055a7d9b0034fa6767dde07a9a9c461a5e97 /test/FixIt/fixit-function-call.cpp
parent40af63b91c15f3cdca5c896441123dc900e92e31 (diff)
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
Diffstat (limited to 'test/FixIt/fixit-function-call.cpp')
-rw-r--r--test/FixIt/fixit-function-call.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/test/FixIt/fixit-function-call.cpp b/test/FixIt/fixit-function-call.cpp
index e59e21b933..d954267f0e 100644
--- a/test/FixIt/fixit-function-call.cpp
+++ b/test/FixIt/fixit-function-call.cpp
@@ -24,7 +24,7 @@ void f2(intTy2 *a) {
// 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 @@ struct B : public A {
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 @@ void dbcaller(A *ptra, B *ptrb) {
// 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