mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-19 18:10:14 +00:00
1. Use null for serialized empty strings.
2. Allow for user defined debug descriptors. 3. Allow for user augmented fields on debug descriptors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26760 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cec12a5c30
commit
2140798cc4
@ -270,7 +270,11 @@ public:
|
|||||||
Elements.push_back(ConstantBool::get(Field));
|
Elements.push_back(ConstantBool::get(Field));
|
||||||
}
|
}
|
||||||
virtual void Apply(std::string &Field) {
|
virtual void Apply(std::string &Field) {
|
||||||
Elements.push_back(SR.getString(Field));
|
if (Field.empty()) {
|
||||||
|
Elements.push_back(NULL);
|
||||||
|
} else {
|
||||||
|
Elements.push_back(SR.getString(Field));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
virtual void Apply(DebugInfoDesc *&Field) {
|
virtual void Apply(DebugInfoDesc *&Field) {
|
||||||
GlobalVariable *GV = NULL;
|
GlobalVariable *GV = NULL;
|
||||||
@ -417,7 +421,7 @@ public:
|
|||||||
}
|
}
|
||||||
virtual void Apply(std::string &Field) {
|
virtual void Apply(std::string &Field) {
|
||||||
Constant *C = CI->getOperand(I++);
|
Constant *C = CI->getOperand(I++);
|
||||||
IsValid = IsValid && isStringValue(C);
|
IsValid = IsValid && (!C || isStringValue(C));
|
||||||
}
|
}
|
||||||
virtual void Apply(DebugInfoDesc *&Field) {
|
virtual void Apply(DebugInfoDesc *&Field) {
|
||||||
// FIXME - Prepare the correct descriptor.
|
// FIXME - Prepare the correct descriptor.
|
||||||
@ -1086,11 +1090,13 @@ DebugInfoDesc *DIDeserializer::Deserialize(GlobalVariable *GV) {
|
|||||||
|
|
||||||
// Create an empty instance of the correct sort.
|
// Create an empty instance of the correct sort.
|
||||||
Slot = DebugInfoDesc::DescFactory(Tag);
|
Slot = DebugInfoDesc::DescFactory(Tag);
|
||||||
assert(Slot && "Unknown Tag");
|
|
||||||
|
|
||||||
// Deserialize the fields.
|
// If not a user defined descriptor.
|
||||||
DIDeserializeVisitor DRAM(*this, GV);
|
if (Slot) {
|
||||||
DRAM.ApplyToFields(Slot);
|
// Deserialize the fields.
|
||||||
|
DIDeserializeVisitor DRAM(*this, GV);
|
||||||
|
DRAM.ApplyToFields(Slot);
|
||||||
|
}
|
||||||
|
|
||||||
return Slot;
|
return Slot;
|
||||||
}
|
}
|
||||||
@ -1238,7 +1244,9 @@ bool DIVerifier::Verify(GlobalVariable *GV) {
|
|||||||
|
|
||||||
// Construct an empty DebugInfoDesc.
|
// Construct an empty DebugInfoDesc.
|
||||||
DebugInfoDesc *DD = DebugInfoDesc::DescFactory(Tag);
|
DebugInfoDesc *DD = DebugInfoDesc::DescFactory(Tag);
|
||||||
if (!DD) return false;
|
|
||||||
|
// Allow for user defined descriptors.
|
||||||
|
if (!DD) return true;
|
||||||
|
|
||||||
// Get the initializer constant.
|
// Get the initializer constant.
|
||||||
ConstantStruct *CI = cast<ConstantStruct>(GV->getInitializer());
|
ConstantStruct *CI = cast<ConstantStruct>(GV->getInitializer());
|
||||||
@ -1255,8 +1263,8 @@ bool DIVerifier::Verify(GlobalVariable *GV) {
|
|||||||
Slot = CTAM.getCount();
|
Slot = CTAM.getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Field count must equal operand count.
|
// Field count must be at most equal operand count.
|
||||||
if (Slot != N) {
|
if (Slot > N) {
|
||||||
delete DD;
|
delete DD;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user