fix parsing of mdstring values.

llvm-svn: 92290
This commit is contained in:
Chris Lattner 2009-12-30 04:13:37 +00:00
parent 41a3666fc1
commit c42b8ff24e
2 changed files with 12 additions and 7 deletions

View File

@ -1888,7 +1888,7 @@ bool LLParser::ParseValID(ValID &ID) {
ID.StrVal = Lex.getStrVal();
ID.Kind = ValID::t_LocalName;
break;
case lltok::Metadata: { // !{...} MDNode, !"foo" MDString
case lltok::Metadata: // !{...} MDNode, !"foo" MDString
Lex.Lex();
// FIXME: This doesn't belong here.
@ -1905,20 +1905,17 @@ bool LLParser::ParseValID(ValID &ID) {
// Standalone metadata reference
// !{ ..., !42, ... }
// FIXME: Split MetadataVal into one for MDNode and one for MDString.
if (!ParseMDNode(ID.MDNodeVal)) {
if (Lex.getKind() == lltok::APSInt) {
if (ParseMDNode(ID.MDNodeVal)) return true;
ID.Kind = ValID::t_MDNode;
return false;
}
// FIXME: This can't work.
// MDString:
// ::= '!' STRINGCONSTANT
if (ParseMDString(ID.MDStringVal)) return true;
ID.Kind = ValID::t_MDString;
return false;
}
case lltok::APSInt:
ID.APSIntVal = Lex.getAPSIntVal();
ID.Kind = ValID::t_APSInt;
@ -2473,7 +2470,7 @@ bool LLParser::ConvertValIDToValue(const Type *Ty, ValID &ID, Value *&V,
case ValID::t_LocalID: V = PFS.GetVal(ID.UIntVal, Ty, ID.Loc); break;
case ValID::t_LocalName: V = PFS.GetVal(ID.StrVal, Ty, ID.Loc); break;
case ValID::t_MDNode: V = ID.MDNodeVal; break;
case ValID::t_MDString: V = ID.MDStringVal;
case ValID::t_MDString: V = ID.MDStringVal; break;
case ValID::t_InlineAsm: {
const PointerType *PTy = dyn_cast<PointerType>(Ty);
const FunctionType *FTy =

View File

@ -2,8 +2,16 @@
define void @test() {
add i32 2, 1, !bar !0
add i32 1, 2, !foo !1
call void @llvm.dbg.func.start(metadata !"foo")
ret void, !foo !0, !bar !1
}
!0 = metadata !{i32 662302, i32 26, metadata !1, null}
!1 = metadata !{i32 4}
declare void @llvm.dbg.func.start(metadata) nounwind readnone
; !foo = !{ !0, !"foo" }