- Constant *Aliasee;
- LocTy AliaseeLoc = Lex.getLoc();
- if (Lex.getKind() != lltok::kw_bitcast &&
- Lex.getKind() != lltok::kw_getelementptr) {
- if (ParseGlobalTypeAndValue(Aliasee)) return true;
+ if (!isValidVisibilityForLinkage(Visibility, L))
+ return Error(LinkageLoc,
+ "symbol with local linkage must have default visibility");
+
+ bool HasAddrSpace = Lex.getKind() == lltok::kw_addrspace;
+ unsigned AddrSpace;
+ LocTy AddrSpaceLoc = Lex.getLoc();
+ if (ParseOptionalAddrSpace(AddrSpace))
+ return true;
+
+ LocTy TyLoc = Lex.getLoc();
+ Type *Ty = nullptr;
+ if (ParseType(Ty))
+ return true;
+
+ bool DifferentType = EatIfPresent(lltok::comma);
+ if (HasAddrSpace && !DifferentType)
+ return Error(AddrSpaceLoc, "A type is required if addrspace is given");
+
+ Type *AliaseeType = nullptr;
+ if (DifferentType) {
+ if (ParseType(AliaseeType))
+ return true;