|
@@ -198,54 +198,8 @@ bool DebugLocDwarfExpression::isFrameRegister(const TargetRegisterInfo &TRI,
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-bool DbgVariable::isBlockByrefVariable() const {
|
|
|
- assert(getVariable() && "Invalid complex DbgVariable!");
|
|
|
- return getVariable()->getType()->isBlockByrefStruct();
|
|
|
-}
|
|
|
-
|
|
|
const DIType *DbgVariable::getType() const {
|
|
|
- DIType *Ty = getVariable()->getType();
|
|
|
- // FIXME: isBlockByrefVariable should be reformulated in terms of complex
|
|
|
- // addresses instead.
|
|
|
- if (Ty->isBlockByrefStruct()) {
|
|
|
- /* Byref variables, in Blocks, are declared by the programmer as
|
|
|
- "SomeType VarName;", but the compiler creates a
|
|
|
- __Block_byref_x_VarName struct, and gives the variable VarName
|
|
|
- either the struct, or a pointer to the struct, as its type. This
|
|
|
- is necessary for various behind-the-scenes things the compiler
|
|
|
- needs to do with by-reference variables in blocks.
|
|
|
-
|
|
|
- However, as far as the original *programmer* is concerned, the
|
|
|
- variable should still have type 'SomeType', as originally declared.
|
|
|
-
|
|
|
- The following function dives into the __Block_byref_x_VarName
|
|
|
- struct to find the original type of the variable. This will be
|
|
|
- passed back to the code generating the type for the Debug
|
|
|
- Information Entry for the variable 'VarName'. 'VarName' will then
|
|
|
- have the original type 'SomeType' in its debug information.
|
|
|
-
|
|
|
- The original type 'SomeType' will be the type of the field named
|
|
|
- 'VarName' inside the __Block_byref_x_VarName struct.
|
|
|
-
|
|
|
- NOTE: In order for this to not completely fail on the debugger
|
|
|
- side, the Debug Information Entry for the variable VarName needs to
|
|
|
- have a DW_AT_location that tells the debugger how to unwind through
|
|
|
- the pointers and __Block_byref_x_VarName struct to find the actual
|
|
|
- value of the variable. The function addBlockByrefType does this. */
|
|
|
- DIType *subType = Ty;
|
|
|
- uint16_t tag = Ty->getTag();
|
|
|
-
|
|
|
- if (tag == dwarf::DW_TAG_pointer_type)
|
|
|
- subType = cast<DIDerivedType>(Ty)->getBaseType();
|
|
|
-
|
|
|
- auto Elements = cast<DICompositeType>(subType)->getElements();
|
|
|
- for (unsigned i = 0, N = Elements.size(); i < N; ++i) {
|
|
|
- auto *DT = cast<DIDerivedType>(Elements[i]);
|
|
|
- if (getName() == DT->getName())
|
|
|
- return DT->getBaseType();
|
|
|
- }
|
|
|
- }
|
|
|
- return Ty;
|
|
|
+ return getVariable()->getType();
|
|
|
}
|
|
|
|
|
|
/// Get .debug_loc entry for the instruction range starting at MI.
|