summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Basic/TokenKinds.def1
-rw-r--r--clang/lib/Parse/ParseDecl.cpp5
-rw-r--r--clang/lib/Parse/ParseTentative.cpp1
-rw-r--r--clang/test/Parser/altivec.c14
4 files changed, 21 insertions, 0 deletions
diff --git a/clang/include/clang/Basic/TokenKinds.def b/clang/include/clang/Basic/TokenKinds.def
index da106227c28..3319d4ed35e 100644
--- a/clang/include/clang/Basic/TokenKinds.def
+++ b/clang/include/clang/Basic/TokenKinds.def
@@ -495,6 +495,7 @@ KEYWORD(__pascal , KEYALL)
// Altivec Extension.
KEYWORD(__vector , KEYALTIVEC)
KEYWORD(__pixel , KEYALTIVEC)
+KEYWORD(__bool , KEYALTIVEC)
// ARM NEON extensions.
ALIAS("__fp16", half , KEYALL)
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 66366d99190..c4ab713ea08 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -3200,6 +3200,9 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
case tok::kw___pixel:
isInvalid = DS.SetTypeAltiVecPixel(true, Loc, PrevSpec, DiagID, Policy);
break;
+ case tok::kw___bool:
+ isInvalid = DS.SetTypeAltiVecBool(true, Loc, PrevSpec, DiagID, Policy);
+ break;
case tok::kw___unknown_anytype:
isInvalid = DS.SetTypeSpecType(TST_unknown_anytype, Loc,
PrevSpec, DiagID, Policy);
@@ -6036,6 +6039,7 @@ bool Parser::TryAltiVecVectorTokenOutOfLine() {
case tok::kw_float:
case tok::kw_double:
case tok::kw_bool:
+ case tok::kw___bool:
case tok::kw___pixel:
Tok.setKind(tok::kw___vector);
return true;
@@ -6069,6 +6073,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___pixel:
isInvalid = DS.SetTypeAltiVecVector(true, Loc, PrevSpec, DiagID, Policy);
return true;
diff --git a/clang/lib/Parse/ParseTentative.cpp b/clang/lib/Parse/ParseTentative.cpp
index 929242f2004..abf16fa6222 100644
--- a/clang/lib/Parse/ParseTentative.cpp
+++ b/clang/lib/Parse/ParseTentative.cpp
@@ -992,6 +992,7 @@ Parser::isExpressionOrTypeSpecifierSimple(tok::TokenKind Kind) {
case tok::kw___unaligned:
case tok::kw___vector:
case tok::kw___pixel:
+ case tok::kw___bool:
case tok::kw__Atomic:
case tok::kw___unknown_anytype:
return TPResult::False;
diff --git a/clang/test/Parser/altivec.c b/clang/test/Parser/altivec.c
index 7adca6143bd..d852511fc06 100644
--- a/clang/test/Parser/altivec.c
+++ b/clang/test/Parser/altivec.c
@@ -18,6 +18,9 @@ __vector float vv_f;
__vector bool char vv_bc;
__vector bool short vv_bs;
__vector bool int vv_bi;
+__vector __bool char vv___bc;
+__vector __bool short vv___bs;
+__vector __bool int vv_bi;
__vector __pixel vv_p;
__vector pixel vv__p;
__vector int vf__r();
@@ -40,6 +43,9 @@ vector float v_f;
vector bool char v_bc;
vector bool short v_bs;
vector bool int v_bi;
+vector __bool char v___bc;
+vector __bool short v___bs;
+vector __bool int v___bi;
vector __pixel v_p;
vector pixel v__p;
vector int f__r();
@@ -64,6 +70,7 @@ vector unsigned long int v_uli; // expected-warning {{Use of 'long' with '__
__vector long double vv_ld; // expected-error {{cannot use 'long double' with '__vector'}}
vector long double v_ld; // expected-error {{cannot use 'long double' with '__vector'}}
vector bool v_b; // expected-warning {{type specifier missing, defaults to 'int'}}
+vector __bool v___b; // expected-warning {{type specifier missing, defaults to 'int'}}
// These should have errors.
__vector double vv_d1; // expected-error {{use of 'double' with '__vector' requires VSX support to be enabled (available on the POWER7 or later)}}
@@ -77,6 +84,13 @@ vector bool signed char v_bsc; // expected-error {{cannot use 'signed' wit
vector bool unsigned int v_bsc2; // expected-error {{cannot use 'unsigned' with '__vector bool'}}
vector bool long v_bl; // expected-error {{cannot use 'long' with '__vector bool'}}
vector bool long long v_bll; // expected-error {{cannot use 'long long' with '__vector bool'}}
+vector __bool float v___bf; // expected-error {{cannot use 'float' with '__vector bool'}}
+vector __bool double v___bd; // expected-error {{cannot use 'double' with '__vector bool'}}
+vector __bool pixel v___bp; // expected-error {{cannot use '__pixel' with '__vector bool'}}
+vector __bool signed char v___bsc; // expected-error {{cannot use 'signed' with '__vector bool'}}
+vector __bool unsigned int v___bsc2; // expected-error {{cannot use 'unsigned' with '__vector bool'}}
+vector __bool long v___bl; // expected-error {{cannot use 'long' with '__vector bool'}}
+vector __bool long long v___bll; // expected-error {{cannot use 'long long' with '__vector bool'}}
// vector long is deprecated, but vector long long is not.
vector long long v_ll;
OpenPOWER on IntegriCloud