MCPcopy Create free account
hub / github.com/beefytech/Beef / DoLocalVariableDebugInfo

Method DoLocalVariableDebugInfo

IDEHelper/Compiler/BfModule.cpp:16236–16372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16234}
16235
16236void 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

Callers

nothing calls this directly

Calls 15

BfIRValueClass · 0.85
DbgHasInfoMethod · 0.80
DbgGetTypeMethod · 0.80
DbgCreateConstTypeMethod · 0.80
ConstToMemoryMethod · 0.80
SaveDebugLocationMethod · 0.80
ClearDebugLocationMethod · 0.80
RestoreDebugLocationMethod · 0.80
IsCodeViewMethod · 0.80
DbgCreateAutoVariableMethod · 0.80
HasDebugLocationMethod · 0.80

Tested by

no test coverage detected