@@ -111,7 +111,7 @@ Pointer Program::getPtrGlobal(unsigned Idx) const {
111111 return Pointer (Globals[Idx]->block ());
112112}
113113
114- std::optional< unsigned > Program::getGlobal (const ValueDecl *VD) {
114+ UnsignedOrNone Program::getGlobal (const ValueDecl *VD) {
115115 if (auto It = GlobalIndices.find (VD); It != GlobalIndices.end ())
116116 return It->second ;
117117
@@ -131,14 +131,14 @@ std::optional<unsigned> Program::getGlobal(const ValueDecl *VD) {
131131 return std::nullopt ;
132132}
133133
134- std::optional< unsigned > Program::getGlobal (const Expr *E) {
134+ UnsignedOrNone Program::getGlobal (const Expr *E) {
135135 if (auto It = GlobalIndices.find (E); It != GlobalIndices.end ())
136136 return It->second ;
137137 return std::nullopt ;
138138}
139139
140- std::optional< unsigned > Program::getOrCreateGlobal (const ValueDecl *VD,
141- const Expr *Init) {
140+ UnsignedOrNone Program::getOrCreateGlobal (const ValueDecl *VD,
141+ const Expr *Init) {
142142 if (auto Idx = getGlobal (VD))
143143 return Idx;
144144
@@ -195,8 +195,7 @@ unsigned Program::getOrCreateDummy(const DeclTy &D) {
195195 return I;
196196}
197197
198- std::optional<unsigned > Program::createGlobal (const ValueDecl *VD,
199- const Expr *Init) {
198+ UnsignedOrNone Program::createGlobal (const ValueDecl *VD, const Expr *Init) {
200199 bool IsStatic, IsExtern;
201200 bool IsWeak = VD->isWeak ();
202201 if (const auto *Var = dyn_cast<VarDecl>(VD)) {
@@ -213,7 +212,7 @@ std::optional<unsigned> Program::createGlobal(const ValueDecl *VD,
213212
214213 // Register all previous declarations as well. For extern blocks, just replace
215214 // the index with the new variable.
216- std::optional< unsigned > Idx =
215+ UnsignedOrNone Idx =
217216 createGlobal (VD, VD->getType (), IsStatic, IsExtern, IsWeak, Init);
218217 if (!Idx)
219218 return std::nullopt ;
@@ -240,7 +239,7 @@ std::optional<unsigned> Program::createGlobal(const ValueDecl *VD,
240239 return *Idx;
241240}
242241
243- std::optional< unsigned > Program::createGlobal (const Expr *E) {
242+ UnsignedOrNone Program::createGlobal (const Expr *E) {
244243 if (auto Idx = getGlobal (E))
245244 return Idx;
246245 if (auto Idx = createGlobal (E, E->getType (), /* isStatic=*/ true ,
@@ -251,9 +250,9 @@ std::optional<unsigned> Program::createGlobal(const Expr *E) {
251250 return std::nullopt ;
252251}
253252
254- std::optional< unsigned > Program::createGlobal (const DeclTy &D, QualType Ty,
255- bool IsStatic, bool IsExtern,
256- bool IsWeak, const Expr *Init) {
253+ UnsignedOrNone Program::createGlobal (const DeclTy &D, QualType Ty,
254+ bool IsStatic, bool IsExtern, bool IsWeak ,
255+ const Expr *Init) {
257256 // Create a descriptor for the global.
258257 Descriptor *Desc;
259258 const bool IsConst = Ty.isConstQualified ();
0 commit comments