diff options
author | Anna Zaks <ganna@apple.com> | 2011-07-21 00:34:39 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2011-07-21 00:34:39 +0000 |
commit | 9ccf84e35dcf4abf5862eecc7b49f4be4b4cf2ee (patch) | |
tree | 53e7b80ac96df4b07f18c9393cf18d083cd55fa2 /clang/test/FixIt/fixit-function-call.cpp | |
parent | 098ca0e7e6d0060b77854f570f5365985aba757b (diff) | |
download | llvm-9ccf84e35dcf4abf5862eecc7b49f4be4b4cf2ee.zip llvm-9ccf84e35dcf4abf5862eecc7b49f4be4b4cf2ee.tar.gz llvm-9ccf84e35dcf4abf5862eecc7b49f4be4b4cf2ee.tar.bz2 |
Addressing code review comments for commit 135509 - Add FixItHints in case a C++ function call is missing * or & operators on
llvm-svn: 135643
Diffstat (limited to 'clang/test/FixIt/fixit-function-call.cpp')
-rw-r--r-- | clang/test/FixIt/fixit-function-call.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/clang/test/FixIt/fixit-function-call.cpp b/clang/test/FixIt/fixit-function-call.cpp index e59e21b..d954267 100644 --- a/clang/test/FixIt/fixit-function-call.cpp +++ b/clang/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 |