[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
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 688347b..130cd9f2 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -4791,7 +4791,6 @@
case tok::kw___kindof:
- case tok::kw_private:
case tok::kw___private:
case tok::kw___local:
case tok::kw___global:
@@ -4800,9 +4799,11 @@
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 @@
case tok::kw___kindof:
- case tok::kw_private:
case tok::kw___private:
case tok::kw___local:
case tok::kw___global:
@@ -4995,6 +4995,9 @@
#include "clang/Basic/OpenCLImageTypes.def"
return true;
+
+ case tok::kw_private:
+ return getLangOpts().OpenCL;
}
}
@@ -5196,6 +5199,9 @@
// 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: