aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/llvm/IR/GlobalAlias.h5
-rw-r--r--lib/AsmParser/LLParser.cpp5
-rw-r--r--lib/IR/Verifier.cpp3
3 files changed, 7 insertions, 6 deletions
diff --git a/include/llvm/IR/GlobalAlias.h b/include/llvm/IR/GlobalAlias.h
index e09fb6a..fec61a7 100644
--- a/include/llvm/IR/GlobalAlias.h
+++ b/include/llvm/IR/GlobalAlias.h
@@ -81,6 +81,11 @@ public:
return const_cast<GlobalAlias *>(this)->resolveAliasedGlobal(stopOnWeak);
}
+ static bool isValidLinkage(LinkageTypes L) {
+ return isExternalLinkage(L) || isLocalLinkage(L) ||
+ isWeakLinkage(L) || isLinkOnceLinkage(L);
+ }
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const Value *V) {
return V->getValueID() == Value::GlobalAliasVal;
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp
index d5c5db1..74c0ea4 100644
--- a/lib/AsmParser/LLParser.cpp
+++ b/lib/AsmParser/LLParser.cpp
@@ -634,10 +634,7 @@ bool LLParser::ParseAlias(const std::string &Name, LocTy NameLoc,
GlobalValue::LinkageTypes Linkage = (GlobalValue::LinkageTypes) L;
- if(!GlobalValue::isExternalLinkage(Linkage) &&
- !GlobalValue::isLocalLinkage(Linkage) &&
- !GlobalValue::isWeakLinkage(Linkage) &&
- !GlobalValue::isLinkOnceLinkage(Linkage))
+ if(!GlobalAlias::isValidLinkage(Linkage))
return Error(LinkageLoc, "invalid linkage type for alias");
Constant *Aliasee;
diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp
index c010839..c7559c1 100644
--- a/lib/IR/Verifier.cpp
+++ b/lib/IR/Verifier.cpp
@@ -529,8 +529,7 @@ void Verifier::visitGlobalVariable(GlobalVariable &GV) {
void Verifier::visitGlobalAlias(GlobalAlias &GA) {
Assert1(!GA.getName().empty(),
"Alias name cannot be empty!", &GA);
- Assert1(GA.hasExternalLinkage() || GA.hasLocalLinkage() ||
- GA.hasWeakLinkage() || GA.hasLinkOnceLinkage(),
+ Assert1(GlobalAlias::isValidLinkage(GA.getLinkage()),
"Alias should have external or external weak linkage!", &GA);
Assert1(GA.getAliasee(),
"Aliasee cannot be NULL!", &GA);