File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -108,27 +108,23 @@ Pointer Program::getPtrGlobal(unsigned Idx) const {
108
108
}
109
109
110
110
std::optional<unsigned > Program::getGlobal (const ValueDecl *VD) {
111
- auto It = GlobalIndices.find (VD);
112
- if (It != GlobalIndices.end ())
111
+ if (auto It = GlobalIndices.find (VD); It != GlobalIndices.end ())
113
112
return It->second ;
114
113
115
114
// Find any previous declarations which were already evaluated.
116
115
std::optional<unsigned > Index;
117
- for (const Decl *P = VD; P; P = P->getPreviousDecl ()) {
118
- auto It = GlobalIndices.find (P);
119
- if (It != GlobalIndices.end ()) {
116
+ for (const Decl *P = VD->getPreviousDecl (); P; P = P->getPreviousDecl ()) {
117
+ if (auto It = GlobalIndices.find (P); It != GlobalIndices.end ()) {
120
118
Index = It->second ;
121
119
break ;
122
120
}
123
121
}
124
122
125
123
// Map the decl to the existing index.
126
- if (Index) {
124
+ if (Index)
127
125
GlobalIndices[VD] = *Index;
128
- return std::nullopt;
129
- }
130
126
131
- return Index ;
127
+ return std::nullopt ;
132
128
}
133
129
134
130
std::optional<unsigned > Program::getOrCreateGlobal (const ValueDecl *VD,
You can’t perform that action at this time.
0 commit comments