diff options
author | Bill Schmidt <wschmidt@linux.vnet.ibm.com> | 2013-07-03 20:54:09 +0000 |
---|---|---|
committer | Bill Schmidt <wschmidt@linux.vnet.ibm.com> | 2013-07-03 20:54:09 +0000 |
commit | 3e3d20b2b26a885fcae855bb0b02dbc42d7c5739 (patch) | |
tree | 340c386acf7c9cb1dc6f90705ed3fbddb4e5d829 /lib/Sema/DeclSpec.cpp | |
parent | f0d14cb8c8f95c9039e4ea1f5966f233a76ba1d8 (diff) |
"bool" should be a context-sensitive keyword in Altivec mode.
PR16456 reported that Clang implements a hybrid between AltiVec's
"Keyword and Predefine Method" and its "Context Sensitive Keyword
Method," where "bool" is always a keyword, but "vector" and "pixel"
are context-sensitive keywords. This isn't permitted by the AltiVec
spec. For consistency with gcc, this patch implements the Context
Sensitive Keyword Method for bool, and stops treating true and false
as keywords in Altivec mode.
The patch removes KEYALTIVEC as a trigger for defining these keywords
in include/clang/Basic/TokenKinds.def, and adds logic for "vector
bool" that mirrors the existing logic for "vector pixel." The test
case is taken from the bug report.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185580 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/DeclSpec.cpp')
-rw-r--r-- | lib/Sema/DeclSpec.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp index dfce324b70..e75dc7b1bc 100644 --- a/lib/Sema/DeclSpec.cpp +++ b/lib/Sema/DeclSpec.cpp @@ -707,6 +707,20 @@ bool DeclSpec::SetTypeAltiVecPixel(bool isAltiVecPixel, SourceLocation Loc, return false; } +bool DeclSpec::SetTypeAltiVecBool(bool isAltiVecBool, SourceLocation Loc, + const char *&PrevSpec, unsigned &DiagID) { + if (!TypeAltiVecVector || TypeAltiVecBool || + (TypeSpecType != TST_unspecified)) { + PrevSpec = DeclSpec::getSpecifierName((TST) TypeSpecType); + DiagID = diag::err_invalid_vector_bool_decl_spec; + return true; + } + TypeAltiVecBool = isAltiVecBool; + TSTLoc = Loc; + TSTNameLoc = Loc; + return false; +} + bool DeclSpec::SetTypeSpecError() { TypeSpecType = TST_error; TypeSpecOwned = false; |