mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-11 17:08:42 +00:00
[OpenACC][NFC] Change Readonly token check to use isSpecialTokenKind
As brought up in a previous review, instead of checking a token's spelling in text everywhere, we added a 'special token kind'. This adds the only other use of a special kind to use the checking function instead.
This commit is contained in:
parent
c64385cc8c
commit
9b154dad5b
@ -84,6 +84,7 @@ OpenACCAtomicKind getOpenACCAtomicKind(Token Tok) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum class OpenACCSpecialTokenKind {
|
enum class OpenACCSpecialTokenKind {
|
||||||
|
ReadOnly,
|
||||||
DevNum,
|
DevNum,
|
||||||
Queues,
|
Queues,
|
||||||
};
|
};
|
||||||
@ -93,6 +94,8 @@ bool isOpenACCSpecialToken(OpenACCSpecialTokenKind Kind, Token Tok) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
switch (Kind) {
|
switch (Kind) {
|
||||||
|
case OpenACCSpecialTokenKind::ReadOnly:
|
||||||
|
return Tok.getIdentifierInfo()->isStr("readonly");
|
||||||
case OpenACCSpecialTokenKind::DevNum:
|
case OpenACCSpecialTokenKind::DevNum:
|
||||||
return Tok.getIdentifierInfo()->isStr("devnum");
|
return Tok.getIdentifierInfo()->isStr("devnum");
|
||||||
case OpenACCSpecialTokenKind::Queues:
|
case OpenACCSpecialTokenKind::Queues:
|
||||||
@ -422,8 +425,7 @@ void Parser::ParseOpenACCCacheVarList() {
|
|||||||
// specifications. First, see if we have `readonly:`, else we back-out and
|
// specifications. First, see if we have `readonly:`, else we back-out and
|
||||||
// treat it like the beginning of a reference to a potentially-existing
|
// treat it like the beginning of a reference to a potentially-existing
|
||||||
// `readonly` variable.
|
// `readonly` variable.
|
||||||
if (getCurToken().is(tok::identifier) &&
|
if (isOpenACCSpecialToken(OpenACCSpecialTokenKind::ReadOnly, Tok) &&
|
||||||
getCurToken().getIdentifierInfo()->isStr("readonly") &&
|
|
||||||
NextToken().is(tok::colon)) {
|
NextToken().is(tok::colon)) {
|
||||||
// Consume both tokens.
|
// Consume both tokens.
|
||||||
ConsumeToken();
|
ConsumeToken();
|
||||||
|
Loading…
Reference in New Issue
Block a user