summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser/LLParser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp23
1 files changed, 6 insertions, 17 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index b6a753d97cf..e5e6dc77da5 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -518,28 +518,17 @@ bool LLParser::ParseMDString(MDString *&Result) {
// MDNode:
// ::= '!' MDNodeNumber
-//
-/// This version of ParseMDNodeID returns the slot number and null in the case
-/// of a forward reference.
-bool LLParser::ParseMDNodeID(MDNode *&Result, unsigned &SlotNo) {
- // !{ ..., !42, ... }
- if (ParseUInt32(SlotNo)) return true;
-
- // Check existing MDNode.
- if (SlotNo < NumberedMetadata.size() && NumberedMetadata[SlotNo] != nullptr)
- Result = NumberedMetadata[SlotNo];
- else
- Result = nullptr;
- return false;
-}
-
bool LLParser::ParseMDNodeID(MDNode *&Result) {
// !{ ..., !42, ... }
unsigned MID = 0;
- if (ParseMDNodeID(Result, MID)) return true;
+ if (ParseUInt32(MID))
+ return true;
// If not a forward reference, just return it now.
- if (Result) return false;
+ if (MID < NumberedMetadata.size() && NumberedMetadata[MID] != nullptr) {
+ Result = NumberedMetadata[MID];
+ return false;
+ }
// Otherwise, create MDNode forward reference.
MDNodeFwdDecl *FwdNode = MDNode::getTemporary(Context, None);
OpenPOWER on IntegriCloud