File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -2119,27 +2119,33 @@ bool ByteCodeExprGen<Emitter>::visitDecl(const VarDecl *VD) {
2119
2119
if (!this ->visitVarDecl (VD))
2120
2120
return false ;
2121
2121
2122
+ std::optional<PrimType> VarT = classify (VD->getType ());
2122
2123
// Get a pointer to the variable
2123
2124
if (Context::shouldBeGloballyIndexed (VD)) {
2124
2125
auto GlobalIndex = P.getGlobal (VD);
2125
2126
assert (GlobalIndex); // visitVarDecl() didn't return false.
2126
- if (!this ->emitGetPtrGlobal (*GlobalIndex, VD))
2127
- return false ;
2127
+ if (VarT) {
2128
+ if (!this ->emitGetGlobal (*VarT, *GlobalIndex, VD))
2129
+ return false ;
2130
+ } else {
2131
+ if (!this ->emitGetPtrGlobal (*GlobalIndex, VD))
2132
+ return false ;
2133
+ }
2128
2134
} else {
2129
2135
auto Local = Locals.find (VD);
2130
2136
assert (Local != Locals.end ()); // Same here.
2131
- if (!this ->emitGetPtrLocal (Local->second .Offset , VD))
2132
- return false ;
2137
+ if (VarT) {
2138
+ if (!this ->emitGetLocal (*VarT, Local->second .Offset , VD))
2139
+ return false ;
2140
+ } else {
2141
+ if (!this ->emitGetPtrLocal (Local->second .Offset , VD))
2142
+ return false ;
2143
+ }
2133
2144
}
2134
2145
2135
2146
// Return the value
2136
- if (std::optional<PrimType> VarT = classify (VD->getType ())) {
2137
- if (!this ->emitLoadPop (*VarT, VD))
2138
- return false ;
2139
-
2147
+ if (VarT)
2140
2148
return this ->emitRet (*VarT, VD);
2141
- }
2142
-
2143
2149
return this ->emitRetValue (VD);
2144
2150
}
2145
2151
You can’t perform that action at this time.
0 commit comments