#include "llvm/DerivedTypes.h"
#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
-#include "llvm/LLVMContext.h"
-#include "llvm/Metadata.h"
#include "llvm/Module.h"
#include "llvm/Operator.h"
#include "llvm/ValueSymbolTable.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
-namespace llvm {
- /// ValID - Represents a reference of a definition of some sort with no type.
- /// There are several cases where we have to parse the value but where the
- /// type can depend on later context. This may either be a numeric reference
- /// or a symbolic (%var) reference. This is just a discriminated union.
- struct ValID {
- enum {
- t_LocalID, t_GlobalID, // ID in UIntVal.
- t_LocalName, t_GlobalName, // Name in StrVal.
- t_APSInt, t_APFloat, // Value in APSIntVal/APFloatVal.
- t_Null, t_Undef, t_Zero, // No value.
- t_EmptyArray, // No value: []
- t_Constant, // Value in ConstantVal.
- t_InlineAsm, // Value in StrVal/StrVal2/UIntVal.
- t_Metadata // Value in MetadataVal.
- } Kind;
-
- LLParser::LocTy Loc;
- unsigned UIntVal;
- std::string StrVal, StrVal2;
- APSInt APSIntVal;
- APFloat APFloatVal;
- Constant *ConstantVal;
- MetadataBase *MetadataVal;
- ValID() : APFloatVal(0.0) {}
- };
-}
-
/// Run: module ::= toplevelentity*
bool LLParser::Run() {
// Prime the lexer.
// declaration of "malloc". In that case, iterate over all calls to MallocF
// and get them to call the declared "malloc" instead.
if (MallocF->getName() != "malloc") {
- Constant* RealMallocF = M->getFunction("malloc");
+ Constant *RealMallocF = M->getFunction("malloc");
if (RealMallocF->getType() != MallocF->getType())
RealMallocF = ConstantExpr::getBitCast(RealMallocF, MallocF->getType());
MallocF->replaceAllUsesWith(RealMallocF);
MallocF = NULL;
}
}
-
+
+
+ // If there are entries in ForwardRefBlockAddresses at this point, they are
+ // references after the function was defined. Resolve those now.
+ while (!ForwardRefBlockAddresses.empty()) {
+ // Okay, we are referencing an already-parsed function, resolve them now.
+ Function *TheFn = 0;
+ const ValID &Fn = ForwardRefBlockAddresses.begin()->first;
+ if (Fn.Kind == ValID::t_GlobalName)
+ TheFn = M->getFunction(Fn.StrVal);
+ else if (Fn.UIntVal < NumberedVals.size())
+ TheFn = dyn_cast<Function>(NumberedVals[Fn.UIntVal]);
+
+ if (TheFn == 0)
+ return Error(Fn.Loc, "unknown function referenced by blockaddress");
+
+ // Resolve all these references.
+ if (ResolveForwardRefBlockAddresses(TheFn,
+ ForwardRefBlockAddresses.begin()->second,
+ 0))
+ return true;
+
+ ForwardRefBlockAddresses.erase(ForwardRefBlockAddresses.begin());
+ }
+
+
if (!ForwardRefTypes.empty())
return Error(ForwardRefTypes.begin()->second.second,
"use of undefined type named '" +
return false;
}
+bool LLParser::ResolveForwardRefBlockAddresses(Function *TheFn,
+ std::vector<std::pair<ValID, GlobalValue*> > &Refs,
+ PerFunctionState *PFS) {
+ // Loop over all the references, resolving them.
+ for (unsigned i = 0, e = Refs.size(); i != e; ++i) {
+ BasicBlock *Res;
+ if (PFS) {
+ if (Refs[i].first.Kind == ValID::t_LocalName)
+ Res = PFS->GetBB(Refs[i].first.StrVal, Refs[i].first.Loc);
+ else
+ Res = PFS->GetBB(Refs[i].first.UIntVal, Refs[i].first.Loc);
+ } else if (Refs[i].first.Kind == ValID::t_LocalID) {
+ return Error(Refs[i].first.Loc,
+ "cannot take address of numeric label after the function is defined");
+ } else {
+ Res = dyn_cast_or_null<BasicBlock>(
+ TheFn->getValueSymbolTable().lookup(Refs[i].first.StrVal));
+ }
+
+ if (Res == 0)
+ return Error(Refs[i].first.Loc,
+ "referenced value is not a basic block");
+
+ // Get the BlockAddress for this and update references to use it.
+ BlockAddress *BA = BlockAddress::get(TheFn, Res);
+ Refs[i].second->replaceAllUsesWith(BA);
+ Refs[i].second->eraseFromParent();
+ }
+ return false;
+}
+
+
//===----------------------------------------------------------------------===//
// Top-Level Entities
//===----------------------------------------------------------------------===//
// MDString:
// ::= '!' STRINGCONSTANT
-bool LLParser::ParseMDString(MetadataBase *&MDS) {
+bool LLParser::ParseMDString(MDString *&Result) {
std::string Str;
if (ParseStringConstant(Str)) return true;
- MDS = MDString::get(Context, Str);
+ Result = MDString::get(Context, Str);
return false;
}
// MDNode:
// ::= '!' MDNodeNumber
-bool LLParser::ParseMDNode(MetadataBase *&Node) {
+bool LLParser::ParseMDNode(MDNode *&Result) {
// !{ ..., !42, ... }
unsigned MID = 0;
- if (ParseUInt32(MID)) return true;
+ if (ParseUInt32(MID)) return true;
// Check existing MDNode.
- std::map<unsigned, MetadataBase *>::iterator I = MetadataCache.find(MID);
+ std::map<unsigned, TrackingVH<MDNode> >::iterator I = MetadataCache.find(MID);
if (I != MetadataCache.end()) {
- Node = I->second;
+ Result = I->second;
return false;
}
// Check known forward references.
- std::map<unsigned, std::pair<MetadataBase *, LocTy> >::iterator
+ std::map<unsigned, std::pair<TrackingVH<MDNode>, LocTy> >::iterator
FI = ForwardRefMDNodes.find(MID);
if (FI != ForwardRefMDNodes.end()) {
- Node = FI->second.first;
+ Result = FI->second.first;
return false;
}
- // Create MDNode forward reference
- SmallVector<Value *, 1> Elts;
+ // Create MDNode forward reference.
+
+ // FIXME: This is not unique enough!
std::string FwdRefName = "llvm.mdnode.fwdref." + utostr(MID);
- 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());
- Node = FwdNode;
+ Result = FwdNode;
return false;
}
Lex.Lex();
SmallVector<MetadataBase *, 8> Elts;
do {
- if (Lex.getKind() != lltok::Metadata)
- return TokError("Expected '!' here");
+ if (ParseToken(lltok::Metadata, "Expected '!' here"))
+ return true;
Lex.Lex();
- MetadataBase *N = 0;
+
+ // 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);
} while (EatIfPresent(lltok::comma));
unsigned MetadataID = 0;
if (ParseUInt32(MetadataID))
return true;
- if (MetadataCache.find(MetadataID) != MetadataCache.end())
+ if (MetadataCache.count(MetadataID))
return TokError("Metadata id is already used");
if (ParseToken(lltok::equal, "expected '=' here"))
return true;
if (Lex.getKind() != lltok::lbrace)
return TokError("Expected '{' here");
+ // FIXME: This doesn't make sense here.
SmallVector<Value *, 16> Elts;
if (ParseMDNodeVector(Elts)
|| ParseToken(lltok::rbrace, "expected end of metadata node"))
MDNode *Init = MDNode::get(Context, Elts.data(), Elts.size());
MetadataCache[MetadataID] = Init;
- std::map<unsigned, std::pair<MetadataBase *, LocTy> >::iterator
+ std::map<unsigned, std::pair<TrackingVH<MDNode>, LocTy> >::iterator
FI = ForwardRefMDNodes.find(MetadataID);
if (FI != ForwardRefMDNodes.end()) {
- MDNode *FwdNode = cast<MDNode>(FI->second.first);
- FwdNode->replaceAllUsesWith(Init);
+ FI->second.first->replaceAllUsesWith(Init);
ForwardRefMDNodes.erase(FI);
}
return false;
}
+/// ParseInlineMetadata:
+/// !{type %instr}
+/// !{...} MDNode
+/// !"foo" MDString
+bool LLParser::ParseInlineMetadata(Value *&V, PerFunctionState &PFS) {
+ assert(Lex.getKind() == lltok::Metadata && "Only for Metadata");
+ V = 0;
+
+ Lex.Lex();
+ if (Lex.getKind() == lltok::lbrace) {
+ Lex.Lex();
+ if (ParseTypeAndValue(V, PFS) ||
+ ParseToken(lltok::rbrace, "expected end of metadata node"))
+ return true;
+
+ Value *Vals[] = { V };
+ V = MDNode::get(Context, Vals, 1);
+ return false;
+ }
+
+ // FIXME: This can't possibly work at all. r90497
+
+ // Standalone metadata reference
+ // !{ ..., !42, ... }
+ if (!ParseMDNode((MDNode *&)V))
+ return false;
+
+ // MDString:
+ // '!' STRINGCONSTANT
+ if (ParseMDString((MDString *&)V)) return true;
+ return false;
+}
+
/// ParseAlias:
/// ::= GlobalVar '=' OptionalVisibility 'alias' OptionalLinkage Aliasee
/// Aliasee
/// ::= 'arm_apcscc'
/// ::= 'arm_aapcscc'
/// ::= 'arm_aapcs_vfpcc'
+/// ::= 'msp430_intrcc'
/// ::= 'cc' UINT
///
bool LLParser::ParseOptionalCallingConv(CallingConv::ID &CC) {
case lltok::kw_arm_apcscc: CC = CallingConv::ARM_APCS; break;
case lltok::kw_arm_aapcscc: CC = CallingConv::ARM_AAPCS; break;
case lltok::kw_arm_aapcs_vfpcc:CC = CallingConv::ARM_AAPCS_VFP; break;
+ case lltok::kw_msp430_intrcc: CC = CallingConv::MSP430_INTR; break;
case lltok::kw_cc: {
unsigned ArbitraryCC;
Lex.Lex();
/// ParseOptionalCustomMetadata
/// ::= /* empty */
-/// ::= !dbg !42
+/// ::= !dbg !42 (',' !dbg !57)*
bool LLParser::ParseOptionalCustomMetadata() {
if (Lex.getKind() != lltok::NamedOrCustomMD)
return false;
- std::string Name = Lex.getStrVal();
- Lex.Lex();
+ while (1) {
+ std::string Name = Lex.getStrVal();
+ Lex.Lex();
- if (Lex.getKind() != lltok::Metadata)
- return TokError("Expected '!' here");
- Lex.Lex();
+ if (Lex.getKind() != lltok::Metadata)
+ return TokError("expected '!' here");
+ Lex.Lex();
- MetadataBase *Node;
- if (ParseMDNode(Node)) return true;
+ MDNode *Node;
+ if (ParseMDNode(Node)) return true;
- MetadataContext &TheMetadata = M->getContext().getMetadata();
- unsigned MDK = TheMetadata.getMDKind(Name.c_str());
- if (!MDK)
- MDK = TheMetadata.registerMDKind(Name.c_str());
- MDsOnInst.push_back(std::make_pair(MDK, cast<MDNode>(Node)));
+ unsigned MDK = M->getMDKindID(Name.c_str());
+ MDsOnInst.push_back(std::make_pair(MDK, Node));
- return false;
+ // If this is the end of the list, we're done.
+ if (!EatIfPresent(lltok::comma))
+ return false;
+
+ // The next value must be a custom metadata id.
+ if (Lex.getKind() != lltok::NamedOrCustomMD)
+ return TokError("expected more custom metadata ids");
+ }
}
/// ParseOptionalAlignment
return TokError("expected ',' as start of index list");
while (EatIfPresent(lltok::comma)) {
+ if (Lex.getKind() == lltok::NamedOrCustomMD)
+ break;
unsigned Idx;
if (ParseUInt32(Idx)) return true;
Indices.push_back(Idx);
PATypeHolder Ty(ty);
#if 0
- errs() << "Type '" << Ty->getDescription()
+ dbgs() << "Type '" << Ty->getDescription()
<< "' newly formed. Resolving upreferences.\n"
<< UpRefs.size() << " upreferences active!\n";
#endif
UpRefs[i].LastContainedTy) != Ty->subtype_end();
#if 0
- errs() << " UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
+ dbgs() << " UR#" << i << " - TypeContains(" << Ty->getDescription() << ", "
<< UpRefs[i].LastContainedTy->getDescription() << ") = "
<< (ContainsType ? "true" : "false")
<< " level=" << UpRefs[i].NestingLevel << "\n";
continue;
#if 0
- errs() << " * Resolving upreference for " << UpRefs[i].UpRefTy << "\n";
+ dbgs() << " * Resolving upreference for " << UpRefs[i].UpRefTy << "\n";
#endif
if (!TypeToResolve)
TypeToResolve = UpRefs[i].UpRefTy;
// Parse the argument.
LocTy ArgLoc;
PATypeHolder ArgTy(Type::getVoidTy(Context));
- unsigned ArgAttrs1, ArgAttrs2;
+ unsigned ArgAttrs1 = Attribute::None;
+ unsigned ArgAttrs2 = Attribute::None;
Value *V;
- if (ParseType(ArgTy, ArgLoc) ||
- ParseOptionalAttrs(ArgAttrs1, 0) ||
- ParseValue(ArgTy, V, PFS) ||
- // FIXME: Should not allow attributes after the argument, remove this in
- // LLVM 3.0.
- ParseOptionalAttrs(ArgAttrs2, 3))
+ if (ParseType(ArgTy, ArgLoc))
return true;
+
+ if (Lex.getKind() == lltok::Metadata) {
+ if (ParseInlineMetadata(V, PFS))
+ return true;
+ } else {
+ if (ParseOptionalAttrs(ArgAttrs1, 0) ||
+ ParseValue(ArgTy, V, PFS) ||
+ // FIXME: Should not allow attributes after the argument, remove this
+ // in LLVM 3.0.
+ ParseOptionalAttrs(ArgAttrs2, 3))
+ return true;
+ }
ArgList.push_back(ParamInfo(ArgLoc, V, ArgAttrs1|ArgAttrs2));
}
// Function Semantic Analysis.
//===----------------------------------------------------------------------===//
-LLParser::PerFunctionState::PerFunctionState(LLParser &p, Function &f)
- : P(p), F(f) {
+LLParser::PerFunctionState::PerFunctionState(LLParser &p, Function &f,
+ int functionNumber)
+ : P(p), F(f), FunctionNumber(functionNumber) {
// Insert unnamed arguments into the NumberedVals list.
for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end();
}
}
-bool LLParser::PerFunctionState::VerifyFunctionComplete() {
+bool LLParser::PerFunctionState::FinishFunction() {
+ // Check to see if someone took the address of labels in this block.
+ if (!P.ForwardRefBlockAddresses.empty()) {
+ ValID FunctionID;
+ if (!F.getName().empty()) {
+ FunctionID.Kind = ValID::t_GlobalName;
+ FunctionID.StrVal = F.getName();
+ } else {
+ FunctionID.Kind = ValID::t_GlobalID;
+ FunctionID.UIntVal = FunctionNumber;
+ }
+
+ std::map<ValID, std::vector<std::pair<ValID, GlobalValue*> > >::iterator
+ FRBAI = P.ForwardRefBlockAddresses.find(FunctionID);
+ if (FRBAI != P.ForwardRefBlockAddresses.end()) {
+ // Resolve all these references.
+ if (P.ResolveForwardRefBlockAddresses(&F, FRBAI->second, this))
+ return true;
+
+ P.ForwardRefBlockAddresses.erase(FRBAI);
+ }
+ }
+
if (!ForwardRefVals.empty())
return P.Error(ForwardRefVals.begin()->second.second,
"use of undefined value '%" + ForwardRefVals.begin()->first +
case lltok::Metadata: { // !{...} MDNode, !"foo" MDString
ID.Kind = ValID::t_Metadata;
Lex.Lex();
+
+ // FIXME: This doesn't belong here.
if (Lex.getKind() == lltok::lbrace) {
SmallVector<Value*, 16> Elts;
if (ParseMDNodeVector(Elts) ||
// Standalone metadata reference
// !{ ..., !42, ... }
- if (!ParseMDNode(ID.MetadataVal))
+ // FIXME: Split MetadataVal into one for MDNode and one for MDString.
+ if (!ParseMDNode((MDNode*&)ID.MetadataVal))
return false;
// MDString:
// ::= '!' STRINGCONSTANT
- if (ParseMDString(ID.MetadataVal)) return true;
+ if (ParseMDString((MDString*&)ID.MetadataVal)) return true;
ID.Kind = ValID::t_Metadata;
return false;
}
ParseToken(lltok::StringConstant, "expected constraint string"))
return true;
ID.StrVal2 = Lex.getStrVal();
- ID.UIntVal = HasSideEffect | ((unsigned)AlignStack<<1);
+ ID.UIntVal = unsigned(HasSideEffect) | (unsigned(AlignStack)<<1);
ID.Kind = ValID::t_InlineAsm;
return false;
}
+ case lltok::kw_blockaddress: {
+ // ValID ::= 'blockaddress' '(' @foo ',' %bar ')'
+ Lex.Lex();
+
+ ValID Fn, Label;
+ LocTy FnLoc, LabelLoc;
+
+ if (ParseToken(lltok::lparen, "expected '(' in block address expression") ||
+ ParseValID(Fn) ||
+ ParseToken(lltok::comma, "expected comma in block address expression")||
+ ParseValID(Label) ||
+ ParseToken(lltok::rparen, "expected ')' in block address expression"))
+ return true;
+
+ if (Fn.Kind != ValID::t_GlobalID && Fn.Kind != ValID::t_GlobalName)
+ return Error(Fn.Loc, "expected function name in blockaddress");
+ if (Label.Kind != ValID::t_LocalID && Label.Kind != ValID::t_LocalName)
+ return Error(Label.Loc, "expected basic block name in blockaddress");
+
+ // Make a global variable as a placeholder for this reference.
+ GlobalVariable *FwdRef = new GlobalVariable(*M, Type::getInt8Ty(Context),
+ false, GlobalValue::InternalLinkage,
+ 0, "");
+ ForwardRefBlockAddresses[Fn].push_back(std::make_pair(Label, FwdRef));
+ ID.ConstantVal = FwdRef;
+ ID.Kind = ValID::t_Constant;
+ return false;
+ }
+
case lltok::kw_trunc:
case lltok::kw_zext:
case lltok::kw_sext:
ParseIndexList(Indices) ||
ParseToken(lltok::rparen, "expected ')' in extractvalue constantexpr"))
return true;
+ if (Lex.getKind() == lltok::NamedOrCustomMD)
+ if (ParseOptionalCustomMetadata()) return true;
+
if (!isa<StructType>(Val->getType()) && !isa<ArrayType>(Val->getType()))
return Error(ID.Loc, "extractvalue operand must be array or struct");
if (!ExtractValueInst::getIndexedType(Val->getType(), Indices.begin(),
ParseIndexList(Indices) ||
ParseToken(lltok::rparen, "expected ')' in insertvalue constantexpr"))
return true;
+ if (Lex.getKind() == lltok::NamedOrCustomMD)
+ if (ParseOptionalCustomMetadata()) return true;
if (!isa<StructType>(Val0->getType()) && !isa<ArrayType>(Val0->getType()))
return Error(ID.Loc, "extractvalue operand must be array or struct");
if (!ExtractValueInst::getIndexedType(Val0->getType(), Indices.begin(),
// Add all of the arguments we parsed to the function.
Function::arg_iterator ArgIt = Fn->arg_begin();
for (unsigned i = 0, e = ArgList.size(); i != e; ++i, ++ArgIt) {
+ // If we run out of arguments in the Function prototype, exit early.
+ // FIXME: REMOVE THIS IN LLVM 3.0, this is just for the mismatch case above.
+ if (ArgIt == Fn->arg_end()) break;
+
// If the argument has a name, insert it into the argument symbol table.
if (ArgList[i].Name.empty()) continue;
return TokError("expected '{' in function body");
Lex.Lex(); // eat the {.
- PerFunctionState PFS(*this, Fn);
+ int FunctionNumber = -1;
+ if (!Fn.hasName()) FunctionNumber = NumberedVals.size()-1;
+
+ PerFunctionState PFS(*this, Fn, FunctionNumber);
while (Lex.getKind() != lltok::rbrace && Lex.getKind() != lltok::kw_end)
if (ParseBasicBlock(PFS)) return true;
Lex.Lex();
// Verify function is ok.
- return PFS.VerifyFunctionComplete();
+ return PFS.FinishFunction();
}
/// ParseBasicBlock
ParseOptionalCustomMetadata();
// Set metadata attached with this instruction.
- MetadataContext &TheMetadata = M->getContext().getMetadata();
for (SmallVector<std::pair<unsigned, MDNode *>, 2>::iterator
MDI = MDsOnInst.begin(), MDE = MDsOnInst.end(); MDI != MDE; ++MDI)
- TheMetadata.addMD(MDI->first, MDI->second, Inst);
+ Inst->setMetadata(MDI->first, MDI->second);
MDsOnInst.clear();
BB->getInstList().push_back(Inst);
//===----------------------------------------------------------------------===//
/// ParseRet - Parse a return instruction.
-/// ::= 'ret' void (',' !dbg, !1)
-/// ::= 'ret' TypeAndValue (',' !dbg, !1)
-/// ::= 'ret' TypeAndValue (',' TypeAndValue)+ (',' !dbg, !1)
+/// ::= 'ret' void (',' !dbg, !1)*
+/// ::= 'ret' TypeAndValue (',' !dbg, !1)*
+/// ::= 'ret' TypeAndValue (',' TypeAndValue)+ (',' !dbg, !1)*
/// [[obsolete: LLVM 3.0]]
bool LLParser::ParseRet(Instruction *&Inst, BasicBlock *BB,
PerFunctionState &PFS) {
if (ParseOptionalCustomMetadata()) return true;
} else {
// The normal case is one return value.
- // FIXME: LLVM 3.0 remove MRV support for 'ret i32 1, i32 2', requiring use
- // of 'ret {i32,i32} {i32 1, i32 2}'
+ // FIXME: LLVM 3.0 remove MRV support for 'ret i32 1, i32 2', requiring
+ // use of 'ret {i32,i32} {i32 1, i32 2}'
SmallVector<Value*, 8> RVs;
RVs.push_back(RV);
// Autoupgrade old malloc instruction to malloc call.
// FIXME: Remove in LLVM 3.0.
const Type *IntPtrTy = Type::getInt32Ty(Context);
+ Constant *AllocSize = ConstantExpr::getSizeOf(Ty);
+ AllocSize = ConstantExpr::getTruncOrBitCast(AllocSize, IntPtrTy);
if (!MallocF)
// Prototype malloc as "void *(int32)".
// This function is renamed as "malloc" in ValidateEndOfModule().
MallocF = cast<Function>(
M->getOrInsertFunction("", Type::getInt8PtrTy(Context), IntPtrTy, NULL));
- Inst = CallInst::CreateMalloc(BB, IntPtrTy, Ty, Size, MallocF);
+ Inst = CallInst::CreateMalloc(BB, IntPtrTy, Ty, AllocSize, Size, MallocF);
return false;
}
if (ParseTypeAndValue(Val, Loc, PFS) ||
ParseIndexList(Indices))
return true;
+ if (Lex.getKind() == lltok::NamedOrCustomMD)
+ if (ParseOptionalCustomMetadata()) return true;
if (!isa<StructType>(Val->getType()) && !isa<ArrayType>(Val->getType()))
return Error(Loc, "extractvalue operand must be array or struct");
ParseTypeAndValue(Val1, Loc1, PFS) ||
ParseIndexList(Indices))
return true;
+ if (Lex.getKind() == lltok::NamedOrCustomMD)
+ if (ParseOptionalCustomMetadata()) return true;
if (!isa<StructType>(Val0->getType()) && !isa<ArrayType>(Val0->getType()))
return Error(Loc0, "extractvalue operand must be array or struct");
Lex.Lex();
do {
Value *V = 0;
+ // FIXME: REWRITE.
if (Lex.getKind() == lltok::kw_null) {
Lex.Lex();
V = 0;
if (ParseType(Ty)) return true;
if (Lex.getKind() == lltok::Metadata) {
Lex.Lex();
- MetadataBase *Node = 0;
+ MDNode *Node = 0;
if (!ParseMDNode(Node))
V = Node;
else {
- MetadataBase *MDS = 0;
+ MDString *MDS = 0;
if (ParseMDString(MDS)) return true;
V = MDS;
}