| 1 | // RUN: %clang_delta --transformation=remove-namespace --counter=1 %s 2>&1 | %remove_lit_checks | FileCheck %s -check-prefix=CHECK-FIRST |
| 2 | // RUN: %clang_delta --transformation=remove-namespace --counter=2 %s 2>&1 | %remove_lit_checks | FileCheck %s -check-prefix=CHECK-SECOND |
| 3 | |
| 4 | namespace NS1 { |
| 5 | template <int> struct foo { operator long double() const; }; |
| 6 | namespace NS2 { |
| 7 | typedef struct { |
| 8 | int f; |
| 9 | } S; |
| 10 | S bar(int); |
| 11 | } |
| 12 | using namespace NS2; |
| 13 | template <> foo<32>::operator long double() const { |
| 14 | long double t; |
| 15 | *reinterpret_cast<S *>(&t) = bar(0); |
| 16 | return t; |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | // CHECK-FIRST-NOT: namespace NS1 { |
| 21 | // CHECK-FIRST: template <int> struct foo { operator long double() const; }; |
| 22 | // CHECK-FIRST: namespace NS2 { |
| 23 | // CHECK-FIRST: typedef struct { |
| 24 | // CHECK-FIRST: int f; |
| 25 | // CHECK-FIRST: } S; |
| 26 | // CHECK-FIRST: S bar(int); |
| 27 | // CHECK-FIRST: } |
| 28 | // CHECK-FIRST-NOT: using namespace NS2; |
| 29 | // CHECK-FIRST: template <> foo<32>::operator long double() const { |
| 30 | // CHECK-FIRST: long double t; |
| 31 | // CHECK-FIRST: *reinterpret_cast<NS2::S *>(&t) = NS2::bar(0); |
| 32 | // CHECK-FIRST: return t; |
| 33 | // CHECK-FIRST: } |
| 34 | // CHECK-FIRST-NOT: } |
| 35 | |
| 36 | // CHECK-SECOND: namespace NS1 { |
| 37 | // CHECK-SECOND: template <int> struct foo { operator long double() const; }; |
| 38 | // CHECK-SECOND-NOT: namespace NS2 { |
| 39 | // CHECK-SECOND: typedef struct { |
| 40 | // CHECK-SECOND: int f; |
| 41 | // CHECK-SECOND: } S; |
| 42 | // CHECK-SECOND: S bar(int); |
| 43 | // CHECK-SECOND-NOT: } |
| 44 | // CHECK-SECOND-NOT: using namespace NS2; |
| 45 | // CHECK-SECOND: template <> foo<32>::operator long double() const { |
| 46 | // CHECK-SECOND: long double t; |
| 47 | // CHECK-SECOND: *reinterpret_cast<S *>(&t) = bar(0); |
| 48 | // CHECK-SECOND: return t; |
| 49 | // CHECK-SECOND: } |
| 50 | // CHECK-SECOND: } |
| 51 |