diff options
| author | Alexander Shaposhnikov <shal1t712@gmail.com> | 2017-07-30 06:43:03 +0000 |
|---|---|---|
| committer | Alexander Shaposhnikov <shal1t712@gmail.com> | 2017-07-30 06:43:03 +0000 |
| commit | b687fdda29085c9f9e4925be38b7cac97f871c99 (patch) | |
| tree | d200a781616028dde2847f6093cfda196c8b718c /clang-tools-extra/test/clang-reorder-fields/ClassDerived.cpp | |
| parent | b7b8250502f3270e8358648b83ae05aa9633fb20 (diff) | |
| download | bcm5719-llvm-b687fdda29085c9f9e4925be38b7cac97f871c99.tar.gz bcm5719-llvm-b687fdda29085c9f9e4925be38b7cac97f871c99.zip | |
[clang-reorder-fields] Emit warning when reordering breaks member init list dependencies
This diff adds a warning emitted by clang-reorder-fields
when reordering breaks dependencies in the initializer list.
Patch by Sam Conrad!
Differential revision: https://reviews.llvm.org/D35972
llvm-svn: 309505
Diffstat (limited to 'clang-tools-extra/test/clang-reorder-fields/ClassDerived.cpp')
| -rw-r--r-- | clang-tools-extra/test/clang-reorder-fields/ClassDerived.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-reorder-fields/ClassDerived.cpp b/clang-tools-extra/test/clang-reorder-fields/ClassDerived.cpp new file mode 100644 index 00000000000..e7e9ac1c6db --- /dev/null +++ b/clang-tools-extra/test/clang-reorder-fields/ClassDerived.cpp @@ -0,0 +1,33 @@ +// RUN: clang-reorder-fields -record-name bar::Derived -fields-order z,y %s -- | FileCheck %s + +namespace bar { +class Base { +public: + Base(int nx, int np) : x(nx), p(np) {} + int x; + int p; +}; + + +class Derived : public Base { +public: + Derived(long ny); + Derived(char nz); +private: + long y; + char z; +}; + +Derived::Derived(long ny) : + Base(ny, 0), + y(ny), // CHECK: {{^ z\(static_cast<char>\(ny\)\),}} + z(static_cast<char>(ny)) // CHECK-NEXT: {{^ y\(ny\)}} +{} + +Derived::Derived(char nz) : + Base(1, 2), + y(nz), // CHECK: {{^ z\(x\),}} + z(x) // CHECK-NEXT: {{^ y\(nz\)}} +{} + +} // namespace bar |

