| 16234 | } |
| 16235 | |
| 16236 | void BfModule::DoLocalVariableDebugInfo(BfLocalVariable* localVarDef, bool doAliasValue, BfIRValue declareBefore, BfIRInitType initType) |
| 16237 | { |
| 16238 | if (localVarDef->mResolvedType->IsVar()) |
| 16239 | return; |
| 16240 | |
| 16241 | if ((mBfIRBuilder->DbgHasInfo()) && |
| 16242 | ((mCurMethodInstance == NULL) || (!mCurMethodInstance->mIsUnspecialized)) && |
| 16243 | (mHasFullDebugInfo) && |
| 16244 | ((mCurMethodState->mClosureState == NULL) || (!mCurMethodState->mClosureState->mCapturing))) |
| 16245 | { |
| 16246 | auto varType = localVarDef->mResolvedType; |
| 16247 | |
| 16248 | if (localVarDef->mResolvedType->IsValuelessType()) |
| 16249 | { |
| 16250 | } |
| 16251 | else |
| 16252 | { |
| 16253 | bool isByAddr = false; |
| 16254 | auto diValue = localVarDef->mValue; |
| 16255 | if (localVarDef->mConstValue) |
| 16256 | diValue = localVarDef->mConstValue; |
| 16257 | else if (localVarDef->mAddr) |
| 16258 | { |
| 16259 | diValue = localVarDef->mAddr; |
| 16260 | isByAddr = true; |
| 16261 | } |
| 16262 | |
| 16263 | if (diValue.IsConst()) |
| 16264 | { |
| 16265 | auto constant = mBfIRBuilder->GetConstant(diValue); |
| 16266 | if ((constant->mConstType == BfConstType_TypeOf) || (constant->mConstType == BfConstType_TypeOf_WithData)) |
| 16267 | { |
| 16268 | // Ignore for now |
| 16269 | return; |
| 16270 | } |
| 16271 | } |
| 16272 | |
| 16273 | auto diType = mBfIRBuilder->DbgGetType(localVarDef->mResolvedType); |
| 16274 | bool didConstToMem = false; |
| 16275 | |
| 16276 | bool isConstant = false; |
| 16277 | |
| 16278 | if ((localVarDef->mIsReadOnly) && (localVarDef->mAddr)) |
| 16279 | diType = mBfIRBuilder->DbgCreateConstType(diType); |
| 16280 | else if (localVarDef->mConstValue) |
| 16281 | { |
| 16282 | auto constant = mBfIRBuilder->GetConstant(localVarDef->mConstValue); |
| 16283 | isConstant = |
| 16284 | (constant->mConstType < BfConstType_GlobalVar) || |
| 16285 | (constant->mConstType == BfConstType_AggZero) || |
| 16286 | (constant->mConstType == BfConstType_Agg); |
| 16287 | if (isConstant) |
| 16288 | { |
| 16289 | if (localVarDef->mResolvedType->IsComposite()) |
| 16290 | { |
| 16291 | mBfIRBuilder->PopulateType(localVarDef->mResolvedType); |
| 16292 | auto constMem = mBfIRBuilder->ConstToMemory(localVarDef->mConstValue); |
| 16293 |
nothing calls this directly
no test coverage detected