[llvm-commits] [llvm] r92275 - /llvm/trunk/lib/AsmParser/LLParser.cpp
Chris Lattner
sabre at nondot.org
Tue Dec 29 14:01:50 PST 2009
Author: lattner
Date: Tue Dec 29 16:01:50 2009
New Revision: 92275
URL: http://llvm.org/viewvc/llvm-project?rev=92275&view=rev
Log:
clean up some really strange code.
Modified:
llvm/trunk/lib/AsmParser/LLParser.cpp
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=92275&r1=92274&r2=92275&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Tue Dec 29 16:01:50 2009
@@ -492,11 +492,12 @@
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<Value *, 1> 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 @@
Lex.Lex();
SmallVector<MetadataBase *, 8> 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);
More information about the llvm-commits
mailing list