@@ -53,7 +53,7 @@ class SILGlobalVariable
53
53
54
54
// / The SIL location of the variable, which provides a link back to the AST.
55
55
// / The variable only gets a location after it's been emitted.
56
- Optional< SILLocation> Location;
56
+ const SILLocation Location;
57
57
58
58
// / The linkage of the global variable.
59
59
unsigned Linkage : NumSILLinkageBits;
@@ -67,13 +67,16 @@ class SILGlobalVariable
67
67
// / once (either in its declaration, or once later), making it immutable.
68
68
unsigned IsLet : 1 ;
69
69
70
+ // / Whether or not this is a declaration.
71
+ unsigned IsDeclaration : 1 ;
72
+
73
+ // / Whether or not there is a valid SILLocation.
74
+ unsigned HasLocation : 1 ;
75
+
70
76
// / The VarDecl associated with this SILGlobalVariable. Must by nonnull for
71
77
// / language-level global variables.
72
78
VarDecl *VDecl;
73
79
74
- // / Whether or not this is a declaration.
75
- bool IsDeclaration;
76
-
77
80
// / If this block is not empty, the global variable has a static initializer.
78
81
// /
79
82
// / The last instruction of this block is the top-level value of the static
@@ -132,20 +135,17 @@ class SILGlobalVariable
132
135
133
136
VarDecl *getDecl () const { return VDecl; }
134
137
135
- // / Initialize the source location of the function.
136
- void setLocation (SILLocation L) { Location = L; }
137
-
138
138
// / Check if the function has a location.
139
139
// / FIXME: All functions should have locations, so this method should not be
140
140
// / necessary.
141
141
bool hasLocation () const {
142
- return Location. hasValue () ;
142
+ return HasLocation ;
143
143
}
144
144
145
145
// / Get the source location of the function.
146
146
SILLocation getLocation () const {
147
- assert (Location. hasValue () );
148
- return Location. getValue () ;
147
+ assert (HasLocation );
148
+ return Location;
149
149
}
150
150
151
151
// / Returns the value of the static initializer or null if the global has no
0 commit comments