diff options
author | Daniel Jasper <djasper@google.com> | 2013-02-23 08:07:18 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-02-23 08:07:18 +0000 |
commit | 37eff83413a064c504c5a42097e4f5dd0b2962d2 (patch) | |
tree | 435c5cb766867725395d7bfa3cf9b8e8eb2bf128 /unittests/Format/FormatTest.cpp | |
parent | 3a204418482c9ae70ad482e781132c54306c3aa6 (diff) |
Don't recognize unnamed pointer parameters as casts.
This fixes llvm.org/PR15061.
Before: virtual void f(int *)const;
After: virtual void f(int *) const;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175960 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 3cf151e43f..daaeca3fa0 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -1728,10 +1728,12 @@ TEST_F(FormatTest, UndestandsOverloadedOperators) { } TEST_F(FormatTest, UnderstandsNewAndDelete) { - verifyFormat("A *a = new A;"); - verifyFormat("A *a = new (placement) A;"); - verifyFormat("delete a;"); - verifyFormat("delete (A *)a;"); + verifyFormat("void f() {\n" + " A *a = new A;\n" + " A *a = new (placement) A;\n" + " delete a;\n" + " delete (A *)a;\n" + "}"); } TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { @@ -1895,6 +1897,11 @@ TEST_F(FormatTest, FormatsCasts) { verifyFormat("void f(int i = (kA * kB) & kMask) {}"); verifyFormat("int a = sizeof(int) * b;"); verifyFormat("int a = alignof(int) * b;"); + + // These are not casts, but at some point were confused with casts. + verifyFormat("virtual void foo(int *) override;"); + verifyFormat("virtual void foo(char &) const;"); + verifyFormat("virtual void foo(int *a, char *) const;"); } TEST_F(FormatTest, FormatsFunctionTypes) { |