* Both Method & GlobalVariable now subclass GlobalValue
* ConstPoolPointerReference now represents a pointer to a GlobalValue
* Methods name references are now explicit pointers to methods
* Rename Value::GlobalVal to Value::GlobalVariableVal to avoid confusion
llvm-svn: 703
diff --git a/llvm/lib/AsmParser/ParserInternals.h b/llvm/lib/AsmParser/ParserInternals.h
index bedb65f..b00a352 100644
--- a/llvm/lib/AsmParser/ParserInternals.h
+++ b/llvm/lib/AsmParser/ParserInternals.h
@@ -176,7 +176,12 @@
typedef PlaceholderValue<MethPlaceHolderHelper> MethPlaceHolder;
static inline ValID &getValIDFromPlaceHolder(const Value *Val) {
- switch (Val->getType()->getPrimitiveID()) {
+ const Type *Ty = Val->getType();
+ if (isa<PointerType>(Ty) &&
+ isa<MethodType>(cast<PointerType>(Ty)->getValueType()))
+ Ty = cast<PointerType>(Ty)->getValueType();
+
+ switch (Ty->getPrimitiveID()) {
case Type::TypeTyID: return ((TypePlaceHolder*)Val)->getDef();
case Type::LabelTyID: return ((BBPlaceHolder*)Val)->getDef();
case Type::MethodTyID: return ((MethPlaceHolder*)Val)->getDef();
@@ -185,7 +190,12 @@
}
static inline int getLineNumFromPlaceHolder(const Value *Val) {
- switch (Val->getType()->getPrimitiveID()) {
+ const Type *Ty = Val->getType();
+ if (isa<PointerType>(Ty) &&
+ isa<MethodType>(cast<PointerType>(Ty)->getValueType()))
+ Ty = cast<PointerType>(Ty)->getValueType();
+
+ switch (Ty->getPrimitiveID()) {
case Type::TypeTyID: return ((TypePlaceHolder*)Val)->getLineNum();
case Type::LabelTyID: return ((BBPlaceHolder*)Val)->getLineNum();
case Type::MethodTyID: return ((MethPlaceHolder*)Val)->getLineNum();