From 42991eeb64ee178bd12ac243b0cfa7b3bde97f49 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 29 Dec 2009 22:01:50 +0000 Subject: [PATCH] clean up some really strange code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92275 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AsmParser/LLParser.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index d0cac3f0359..9de1cafb5e0 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -492,11 +492,12 @@ bool LLParser::ParseMDNode(MDNode *&Result) { return false; } - // Create MDNode forward reference + // Create MDNode forward reference. + + // FIXME: This is not unique enough! std::string FwdRefName = "llvm.mdnode.fwdref." + utostr(MID); - SmallVector Elts; - Elts.push_back(MDString::get(Context, FwdRefName)); - MDNode *FwdNode = MDNode::get(Context, Elts.data(), Elts.size()); + Value *V = MDString::get(Context, FwdRefName)); + MDNode *FwdNode = MDNode::get(Context, &V, 1); ForwardRefMDNodes[MID] = std::make_pair(FwdNode, Lex.getLoc()); Result = FwdNode; return false; @@ -521,12 +522,11 @@ bool LLParser::ParseNamedMetadata() { Lex.Lex(); SmallVector Elts; do { - // FIXME: Eat if present. - if (Lex.getKind() != lltok::Metadata) - return TokError("Expected '!' here"); + if (ParseToken(lltok::Metadata, "Expected '!' here")) + return true; Lex.Lex(); - // FIXME: Will crash on mdstrings etc. + // FIXME: This rejects MDStrings. Are they legal in an named MDNode or not? MDNode *N = 0; if (ParseMDNode(N)) return true; Elts.push_back(N); -- 2.34.1