diff options
author | Zarko Todorovski <zarko@ca.ibm.com> | 2021-05-13 10:44:40 -0400 |
---|---|---|
committer | Zarko Todorovski <zarko@ca.ibm.com> | 2021-05-13 11:48:32 -0400 |
commit | 8fa168fc50ba4f63b79773c947ef5b3e43d5c02f (patch) | |
tree | cf0db722e0061a7d3a469f25cda9ad3dad68b49c /clang/lib/Parse/ParseDecl.cpp | |
parent | b1a074951ff78bf06a2d944c01ca0a0fcd63dd33 (diff) | |
download | llvm-8fa168fc50ba4f63b79773c947ef5b3e43d5c02f.zip llvm-8fa168fc50ba4f63b79773c947ef5b3e43d5c02f.tar.gz llvm-8fa168fc50ba4f63b79773c947ef5b3e43d5c02f.tar.bz2 |
Parse vector bool when stdbool.h and altivec.h are included
Currently when including stdbool.h and altivec.h declaration of `vector bool` leads to
errors due to `bool` being expanded to '_Bool`. This patch allows the parser
to recognize `_Bool`.
Reviewed By: hubert.reinterpretcast, Everybody0523
Differential Revision: https://reviews.llvm.org/D102064
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 928ef33..fda4275 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -7334,6 +7334,7 @@ bool Parser::TryAltiVecVectorTokenOutOfLine() { case tok::kw_float: case tok::kw_double: case tok::kw_bool: + case tok::kw__Bool: case tok::kw___bool: case tok::kw___pixel: Tok.setKind(tok::kw___vector); @@ -7343,7 +7344,8 @@ bool Parser::TryAltiVecVectorTokenOutOfLine() { Tok.setKind(tok::kw___vector); return true; } - if (Next.getIdentifierInfo() == Ident_bool) { + if (Next.getIdentifierInfo() == Ident_bool || + Next.getIdentifierInfo() == Ident_Bool) { Tok.setKind(tok::kw___vector); return true; } @@ -7368,6 +7370,7 @@ bool Parser::TryAltiVecTokenOutOfLine(DeclSpec &DS, SourceLocation Loc, case tok::kw_float: case tok::kw_double: case tok::kw_bool: + case tok::kw__Bool: case tok::kw___bool: case tok::kw___pixel: isInvalid = DS.SetTypeAltiVecVector(true, Loc, PrevSpec, DiagID, Policy); @@ -7377,8 +7380,10 @@ bool Parser::TryAltiVecTokenOutOfLine(DeclSpec &DS, SourceLocation Loc, isInvalid = DS.SetTypeAltiVecVector(true, Loc, PrevSpec, DiagID,Policy); return true; } - if (Next.getIdentifierInfo() == Ident_bool) { - isInvalid = DS.SetTypeAltiVecVector(true, Loc, PrevSpec, DiagID,Policy); + if (Next.getIdentifierInfo() == Ident_bool || + Next.getIdentifierInfo() == Ident_Bool) { + isInvalid = + DS.SetTypeAltiVecVector(true, Loc, PrevSpec, DiagID, Policy); return true; } break; |