File: CanonicalizeInstantiatedDecls.cpp

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (86 lines) | stat: -rw-r--r-- 3,855 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

template<typename T>
class BaseTemplate {
public:
  T baseTemplateFunction();

  T baseTemplateField;

  struct NestedBaseType { };
};

template<typename T, typename S>
class TemplateClass: public BaseTemplate<T> {
public:
  T function() { return T(); }

  static void staticFunction() { }

  T field;

  struct NestedType {
    T nestedField;

    class SubNestedType {
    public:
      SubNestedType(int);
    };
    using TypeAlias = T;

    typedef int Typedef;

    enum Enum {
      EnumCase
    };
  };
};

void canonicalizeInstaniationReferences(TemplateClass<int, float> &object) {
  (void)object.function();
// CHECK1: 'c:@ST>2#T#T@TemplateClass@F@function#'
// RUN: clang-refactor-test rename-initiate -at=%s:%(line-2):16 -new-name=x -dump-symbols %s | FileCheck --check-prefix=CHECK1 %s
  (void)object.field;
// CHECK2: 'c:@ST>2#T#T@TemplateClass@FI@field'
// RUN: clang-refactor-test rename-initiate -at=%s:%(line-2):16 -new-name=x -dump-symbols %s | FileCheck --check-prefix=CHECK2 %s
  (void)object.baseTemplateFunction();
// CHECK3: 'c:@ST>1#T@BaseTemplate@F@baseTemplateFunction#'
// RUN: clang-refactor-test rename-initiate -at=%s:%(line-2):16 -new-name=x -dump-symbols %s | FileCheck --check-prefix=CHECK3 %s
  (void)object.baseTemplateField;
// CHECK4: 'c:@ST>1#T@BaseTemplate@FI@baseTemplateField'
// RUN: clang-refactor-test rename-initiate -at=%s:%(line-2):16 -new-name=x -dump-symbols %s | FileCheck --check-prefix=CHECK4 %s

  TemplateClass<int, float>::staticFunction();
// CHECK5: 'c:@ST>2#T#T@TemplateClass@F@staticFunction#S'
// RUN: clang-refactor-test rename-initiate -at=%s:%(line-2):30 -new-name=x -dump-symbols %s | FileCheck --check-prefix=CHECK5 %s

  TemplateClass<int, float>::NestedBaseType nestedBaseType;
// CHECK6: 'c:@ST>1#T@BaseTemplate@S@NestedBaseType'
// RUN: clang-refactor-test rename-initiate -at=%s:%(line-2):30 -new-name=x -dump-symbols %s | FileCheck --check-prefix=CHECK6 %s
  TemplateClass<int, float>::NestedType nestedSubType;
// CHECK7: 'c:@ST>2#T#T@TemplateClass@S@NestedType'
// RUN: clang-refactor-test rename-initiate -at=%s:%(line-2):30 -new-name=x -dump-symbols %s | FileCheck --check-prefix=CHECK7 %s
  (void)nestedSubType.nestedField;
// CHECK8: 'c:@ST>2#T#T@TemplateClass@S@NestedType@FI@nestedField'
// RUN: clang-refactor-test rename-initiate -at=%s:%(line-2):23 -new-name=x -dump-symbols %s | FileCheck --check-prefix=CHECK8 %s

  typedef TemplateClass<int, float> TT;
  TT::NestedType::SubNestedType subNestedType(0);
// CHECK9: 'c:@ST>2#T#T@TemplateClass@S@NestedType'
// RUN: clang-refactor-test rename-initiate -at=%s:%(line-2):7 -new-name=x -dump-symbols %s | FileCheck --check-prefix=CHECK9 %s
// CHECK10: 'c:@ST>2#T#T@TemplateClass@S@NestedType@S@SubNestedType'
// RUN: clang-refactor-test rename-initiate -at=%s:%(line-4):19 -new-name=x -dump-symbols %s | FileCheck --check-prefix=CHECK10 %s

  TT::NestedType::TypeAlias nestedTypeAlias;
// CHECK11: 'c:@ST>2#T#T@TemplateClass@S@NestedType@TypeAlias'
// RUN: clang-refactor-test rename-initiate -at=%s:%(line-2):19 -new-name=x -dump-symbols %s | FileCheck --check-prefix=CHECK11 %s
  TT::NestedType::Typedef nestedTypedef;
// CHECK12: 'c:{{.*}}CanonicalizeInstantiatedDecls.cpp@ST>2#T#T@TemplateClass@S@NestedType@T@Typedef'
// RUN: clang-refactor-test rename-initiate -at=%s:%(line-2):19 -new-name=x -dump-symbols %s | FileCheck --check-prefix=CHECK12 %s

  TT::NestedType::Enum nestedEnum;
// CHECK13: 'c:@ST>2#T#T@TemplateClass@S@NestedType@E@Enum'
// RUN: clang-refactor-test rename-initiate -at=%s:%(line-2):19 -new-name=x -dump-symbols %s | FileCheck --check-prefix=CHECK13 %s
  (void)TT::NestedType::Enum::EnumCase;
// CHECK14: 'c:@ST>2#T#T@TemplateClass@S@NestedType@E@Enum@EnumCase'
// RUN: clang-refactor-test rename-initiate -at=%s:%(line-2):31 -new-name=x -dump-symbols %s | FileCheck --check-prefix=CHECK14 %s
}