Skip to content

Commit

Permalink
LLParser: llvm::Optional => std::optional
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskRay committed Dec 13, 2022
1 parent 255c3e3 commit edec84b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion llvm/include/llvm/AsmParser/LLParser.h
Expand Up @@ -292,7 +292,7 @@ namespace llvm {
bool parseOptionalDerefAttrBytes(lltok::Kind AttrKind, uint64_t &Bytes);
bool parseOptionalUWTableKind(UWTableKind &Kind);
bool parseAllocKind(AllocFnKind &Kind);
Optional<MemoryEffects> parseMemoryAttr();
std::optional<MemoryEffects> parseMemoryAttr();
bool parseScopeAndOrdering(bool IsAtomic, SyncScope::ID &SSID,
AtomicOrdering &Ordering);
bool parseScope(SyncScope::ID &SSID);
Expand Down
12 changes: 6 additions & 6 deletions llvm/lib/AsmParser/LLParser.cpp
Expand Up @@ -1470,7 +1470,7 @@ bool LLParser::parseEnumAttribute(Attribute::AttrKind Attr, AttrBuilder &B,
return false;
}
case Attribute::Memory: {
Optional<MemoryEffects> ME = parseMemoryAttr();
std::optional<MemoryEffects> ME = parseMemoryAttr();
if (!ME)
return true;
B.addMemoryAttr(*ME);
Expand Down Expand Up @@ -2262,7 +2262,7 @@ bool LLParser::parseAllocKind(AllocFnKind &Kind) {
return false;
}

static Optional<MemoryEffects::Location> keywordToLoc(lltok::Kind Tok) {
static std::optional<MemoryEffects::Location> keywordToLoc(lltok::Kind Tok) {
switch (Tok) {
case lltok::kw_argmem:
return MemoryEffects::ArgMem;
Expand All @@ -2273,7 +2273,7 @@ static Optional<MemoryEffects::Location> keywordToLoc(lltok::Kind Tok) {
}
}

static Optional<ModRefInfo> keywordToModRef(lltok::Kind Tok) {
static std::optional<ModRefInfo> keywordToModRef(lltok::Kind Tok) {
switch (Tok) {
case lltok::kw_none:
return ModRefInfo::NoModRef;
Expand All @@ -2288,7 +2288,7 @@ static Optional<ModRefInfo> keywordToModRef(lltok::Kind Tok) {
}
}

Optional<MemoryEffects> LLParser::parseMemoryAttr() {
std::optional<MemoryEffects> LLParser::parseMemoryAttr() {
MemoryEffects ME = MemoryEffects::none();

// We use syntax like memory(argmem: read), so the colon should not be
Expand All @@ -2304,7 +2304,7 @@ Optional<MemoryEffects> LLParser::parseMemoryAttr() {

bool SeenLoc = false;
do {
Optional<MemoryEffects::Location> Loc = keywordToLoc(Lex.getKind());
std::optional<MemoryEffects::Location> Loc = keywordToLoc(Lex.getKind());
if (Loc) {
Lex.Lex();
if (!EatIfPresent(lltok::colon)) {
Expand All @@ -2313,7 +2313,7 @@ Optional<MemoryEffects> LLParser::parseMemoryAttr() {
}
}

Optional<ModRefInfo> MR = keywordToModRef(Lex.getKind());
std::optional<ModRefInfo> MR = keywordToModRef(Lex.getKind());
if (!MR) {
if (!Loc)
tokError("expected memory location (argmem, inaccessiblemem) "
Expand Down

0 comments on commit edec84b

Please sign in to comment.