mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 15:41:46 +00:00
[OpenACC] Fix bug with directive name being a 'special token'
If the 'directive name' is a special token instead of an identifier, we end up asserting. This fixes that.
This commit is contained in:
parent
965fe352a7
commit
731361cd15
@ -206,7 +206,7 @@ OpenACCDirectiveKind ParseOpenACCDirectiveKind(Parser &P) {
|
||||
|
||||
// Just #pragma acc can get us immediately to the end, make sure we don't
|
||||
// introspect on the spelling before then.
|
||||
if (FirstTok.isAnnotation()) {
|
||||
if (FirstTok.isNot(tok::identifier)) {
|
||||
P.Diag(FirstTok, diag::err_acc_missing_directive);
|
||||
return OpenACCDirectiveKind::Invalid;
|
||||
}
|
||||
@ -224,11 +224,8 @@ OpenACCDirectiveKind ParseOpenACCDirectiveKind(Parser &P) {
|
||||
if (ExDirKind >= OpenACCDirectiveKindEx::Invalid) {
|
||||
switch (ExDirKind) {
|
||||
case OpenACCDirectiveKindEx::Invalid: {
|
||||
if (!FirstTok.is(tok::identifier))
|
||||
P.Diag(FirstTok, diag::err_expected) << tok::identifier;
|
||||
else
|
||||
P.Diag(FirstTok, diag::err_acc_invalid_directive)
|
||||
<< 0 << FirstTok.getIdentifierInfo();
|
||||
P.Diag(FirstTok, diag::err_acc_invalid_directive)
|
||||
<< 0 << FirstTok.getIdentifierInfo();
|
||||
return OpenACCDirectiveKind::Invalid;
|
||||
}
|
||||
case OpenACCDirectiveKindEx::Enter:
|
||||
|
@ -7,6 +7,17 @@ void func() {
|
||||
#pragma acc
|
||||
for(;;){}
|
||||
|
||||
// expected-error@+4{{expected OpenACC directive}}
|
||||
// expected-error@+3{{expected clause-list or newline in OpenACC directive}}
|
||||
// expected-warning@+2{{OpenACC clause parsing not yet implemented}}
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc(whatever) routine
|
||||
|
||||
// expected-error@+3{{expected OpenACC directive}}
|
||||
// expected-warning@+2{{OpenACC clause parsing not yet implemented}}
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc) routine
|
||||
|
||||
// expected-error@+2{{invalid OpenACC directive 'invalid'}}
|
||||
// expected-warning@+1{{OpenACC directives not yet implemented, pragma ignored}}
|
||||
#pragma acc invalid
|
||||
|
Loading…
Reference in New Issue
Block a user