summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAnastasia Stulova <anastasia.stulova@arm.com>2019-03-28 11:47:14 +0000
committerAnastasia Stulova <anastasia.stulova@arm.com>2019-03-28 11:47:14 +0000
commit314fab6d7fa9554b77e311577ccd0c527053c6ce (patch)
tree5cdf766aff5a1f272a2cc5c9e59b80903d7b6bb4 /clang/lib
parent38a0616c1df029aff481eb0224dacb55c317865e (diff)
downloadbcm5719-llvm-314fab6d7fa9554b77e311577ccd0c527053c6ce.tar.gz
bcm5719-llvm-314fab6d7fa9554b77e311577ccd0c527053c6ce.zip
[PR41247] Fixed parsing of private keyword in C++.
Fixed bug in C++ to prevent parsing 'private' as a valid address space qualifier. Differential Revision: https://reviews.llvm.org/D59874 llvm-svn: 357162
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp12
-rw-r--r--clang/lib/Parse/ParseTentative.cpp5
2 files changed, 14 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 688347bd2df..130cd9f2065 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -4791,7 +4791,6 @@ bool Parser::isTypeSpecifierQualifier() {
case tok::kw___kindof:
- case tok::kw_private:
case tok::kw___private:
case tok::kw___local:
case tok::kw___global:
@@ -4800,9 +4799,11 @@ bool Parser::isTypeSpecifierQualifier() {
case tok::kw___read_only:
case tok::kw___read_write:
case tok::kw___write_only:
-
return true;
+ case tok::kw_private:
+ return getLangOpts().OpenCL;
+
// C11 _Atomic
case tok::kw__Atomic:
return true;
@@ -4982,7 +4983,6 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) {
case tok::kw___kindof:
- case tok::kw_private:
case tok::kw___private:
case tok::kw___local:
case tok::kw___global:
@@ -4995,6 +4995,9 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) {
#include "clang/Basic/OpenCLImageTypes.def"
return true;
+
+ case tok::kw_private:
+ return getLangOpts().OpenCL;
}
}
@@ -5196,6 +5199,9 @@ void Parser::ParseTypeQualifierListOpt(
// OpenCL qualifiers:
case tok::kw_private:
+ if (!getLangOpts().OpenCL)
+ goto DoneWithTypeQuals;
+ LLVM_FALLTHROUGH;
case tok::kw___private:
case tok::kw___global:
case tok::kw___local:
diff --git a/clang/lib/Parse/ParseTentative.cpp b/clang/lib/Parse/ParseTentative.cpp
index d0549a9725d..46366ff43cf 100644
--- a/clang/lib/Parse/ParseTentative.cpp
+++ b/clang/lib/Parse/ParseTentative.cpp
@@ -1414,8 +1414,13 @@ Parser::isCXXDeclarationSpecifier(Parser::TPResult BracedCastResult,
// cv-qualifier
case tok::kw_const:
case tok::kw_volatile:
+ return TPResult::True;
+
// OpenCL address space qualifiers
case tok::kw_private:
+ if (!getLangOpts().OpenCL)
+ return TPResult::False;
+ LLVM_FALLTHROUGH;
case tok::kw___private:
case tok::kw___local:
case tok::kw___global:
OpenPOWER on IntegriCloud