Skip to content

Commit f1903e0

Browse files
committed
Parser fixes
1 parent 2e929cb commit f1903e0

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

llvm/lib/AsmParser/LLParser.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6564,18 +6564,16 @@ bool LLParser::parseDebugRecord(DbgRecord *&DR, PerFunctionState &PFS) {
65646564

65656565
// Parse Expression field.
65666566
LocTy ExprLoc = Lex.getLoc();
6567-
Metadata *Expression;
6568-
if (parseMetadata(Expression, &PFS))
6567+
MDNode *Expression;
6568+
if (parseMDNode(Expression))
65696569
return true;
6570-
if (!isa<DIExpression>(Expression))
6571-
return error(ExprLoc, "expected valid inline DIExpression here");
65726570
if (parseToken(lltok::comma, "Expected ',' here"))
65736571
return true;
65746572

65756573
// Parse additional fields for #dbg_assign.
65766574
MDNode *AssignID = nullptr;
65776575
Metadata *AddressLocation = nullptr;
6578-
Metadata *AddressExpression = nullptr;
6576+
MDNode *AddressExpression = nullptr;
65796577
if (ValueType == LocType::Assign) {
65806578
// Parse DIAssignID.
65816579
if (parseMDNode(AssignID))
@@ -6591,10 +6589,8 @@ bool LLParser::parseDebugRecord(DbgRecord *&DR, PerFunctionState &PFS) {
65916589

65926590
// Parse address DIExpression.
65936591
LocTy AddressExprLoc = Lex.getLoc();
6594-
if (parseMetadata(AddressExpression, &PFS))
6592+
if (parseMDNode(AddressExpression))
65956593
return true;
6596-
if (!isa<DIExpression>(AddressExpression))
6597-
return error(AddressExprLoc, "expected valid inline DIExpression here");
65986594
if (parseToken(lltok::comma, "Expected ',' here"))
65996595
return true;
66006596
}
@@ -6607,8 +6603,8 @@ bool LLParser::parseDebugRecord(DbgRecord *&DR, PerFunctionState &PFS) {
66076603
if (parseToken(lltok::rparen, "Expected ')' here"))
66086604
return true;
66096605
DR = DPValue::createUnresolvedDPValue(
6610-
ValueType, ValLocMD, Variable, cast<DIExpression>(Expression), AssignID,
6611-
AddressLocation, cast_or_null<DIExpression>(AddressExpression), DebugLoc);
6606+
ValueType, ValLocMD, Variable, Expression, AssignID,
6607+
AddressLocation, AddressExpression, DebugLoc);
66126608
return false;
66136609
}
66146610
//===----------------------------------------------------------------------===//

llvm/lib/IR/DebugProgramInstruction.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ DbgRecord::createDebugIntrinsic(Module *M, Instruction *InsertBefore) const {
142142
DPLabel::DPLabel(MDNode *Label, MDNode *DL)
143143
: DbgRecord(LabelKind, DebugLoc(DL)), Label(Label) {
144144
assert(Label && "Unexpected nullptr");
145-
assert(isa<DILabel>(Label) || Label->isTemporary() && "Label type must be or resolve to a DILabel");
145+
assert((isa<DILabel>(Label) || Label->isTemporary()) && "Label type must be or resolve to a DILabel");
146146
}
147147
DPLabel::DPLabel(DILabel *Label, DebugLoc DL)
148148
: DbgRecord(LabelKind, DL), Label(Label) {
@@ -156,9 +156,8 @@ DPLabel *DPLabel::createUnresolvedDPLabel(MDNode *Label, MDNode *DL) {
156156
DPValue::DPValue(DPValue::LocationType Type, Metadata *Val, MDNode *Variable,
157157
MDNode *Expression, MDNode *AssignID, Metadata *Address,
158158
MDNode *AddressExpression, MDNode *DI)
159-
: DbgRecord(ValueKind, DebugLoc(DI)), DebugValueUser({Val, Address, AssignID}), Variable(Variable),
160-
Expression(Expression), AddressExpression(AddressExpression),
161-
Type(Type) {}
159+
: DbgRecord(ValueKind, DebugLoc(DI)), DebugValueUser({Val, Address, AssignID}), Type(Type), Variable(Variable),
160+
Expression(Expression), AddressExpression(AddressExpression) {}
162161

163162
DPValue *DPValue::createUnresolvedDPValue(DPValue::LocationType Type,
164163
Metadata *Val, MDNode *Variable,

0 commit comments

Comments
 (0)