[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang-tools-extra / test / clang-move / move-type-alias.cpp
blobab70237f28d785d2ad81bbd3123397895ff102aa
1 // RUN: mkdir -p %T/move-type-alias
2 // RUN: cp %S/Inputs/type_alias.h %T/move-type-alias/type_alias.h
3 // RUN: echo '#include "type_alias.h"' > %T/move-type-alias/type_alias.cpp
4 // RUN: cd %T/move-type-alias
5 //
6 // -----------------------------------------------------------------------------
7 // Test moving typedef declarations.
8 // -----------------------------------------------------------------------------
9 // RUN: clang-move -names="Int1" -new_cc=%T/move-type-alias/new_test.cpp -new_header=%T/move-type-alias/new_test.h -old_cc=%T/move-type-alias/type_alias.cpp -old_header=%T/move-type-alias/type_alias.h %T/move-type-alias/type_alias.cpp -- -std=c++11
10 // RUN: FileCheck -input-file=%T/move-type-alias/new_test.h -check-prefix=CHECK-NEW-TEST-H-CASE1 %s
11 // RUN: FileCheck -input-file=%T/move-type-alias/type_alias.h -check-prefix=CHECK-OLD-TEST-H-CASE1 %s
13 // CHECK-NEW-TEST-H-CASE1: typedef int Int1;
15 // CHECK-OLD-TEST-H-CASE1-NOT: typedef int Int1;
18 // -----------------------------------------------------------------------------
19 // Test moving type alias declarations.
20 // -----------------------------------------------------------------------------
21 // RUN: cp %S/Inputs/type_alias.h %T/move-type-alias/type_alias.h
22 // RUN: echo '#include "type_alias.h"' > %T/move-type-alias/type_alias.cpp
23 // RUN: clang-move -names="Int2" -new_cc=%T/move-type-alias/new_test.cpp -new_header=%T/move-type-alias/new_test.h -old_cc=%T/move-type-alias/type_alias.cpp -old_header=%T/move-type-alias/type_alias.h %T/move-type-alias/type_alias.cpp -- -std=c++11
24 // RUN: FileCheck -input-file=%T/move-type-alias/new_test.h -check-prefix=CHECK-NEW-TEST-H-CASE2 %s
25 // RUN: FileCheck -input-file=%T/move-type-alias/type_alias.h -check-prefix=CHECK-OLD-TEST-H-CASE2 %s
27 // CHECK-NEW-TEST-H-CASE2: using Int2 = int;
29 // CHECK-OLD-TEST-H-CASE2-NOT: using Int2 = int;
32 // -----------------------------------------------------------------------------
33 // Test moving template type alias declarations.
34 // -----------------------------------------------------------------------------
35 // RUN: cp %S/Inputs/type_alias.h %T/move-type-alias/type_alias.h
36 // RUN: echo '#include "type_alias.h"' > %T/move-type-alias/type_alias.cpp
37 // RUN: clang-move -names="B" -new_cc=%T/move-type-alias/new_test.cpp -new_header=%T/move-type-alias/new_test.h -old_cc=%T/move-type-alias/type_alias.cpp -old_header=%T/move-type-alias/type_alias.h %T/move-type-alias/type_alias.cpp -- -std=c++11
38 // RUN: FileCheck -input-file=%T/move-type-alias/new_test.h -check-prefix=CHECK-OLD-TEST-H-CASE3 %s
40 // CHECK-NEW-TEST-H-CASE3: template<class T> using B = A<T>;
41 // CHECK-OLD-TEST-H-CASE3-NOT: template<class T> using B = A<T>;
44 // -----------------------------------------------------------------------------
45 // Test not moving class-insided typedef declarations.
46 // -----------------------------------------------------------------------------
47 // RUN: cp %S/Inputs/type_alias.h %T/move-type-alias/type_alias.h
48 // RUN: echo '#include "type_alias.h"' > %T/move-type-alias/type_alias.cpp
49 // RUN: clang-move -names="C::Int3" -new_cc=%T/move-type-alias/new_test.cpp -new_header=%T/move-type-alias/new_test.h -old_cc=%T/move-type-alias/type_alias.cpp -old_header=%T/move-type-alias/type_alias.h %T/move-type-alias/type_alias.cpp -- -std=c++11
50 // RUN: FileCheck -input-file=%T/move-type-alias/new_test.h -allow-empty -check-prefix=CHECK-EMPTY %s
52 // CHECK-EMPTY: {{^}}{{$}}