Browse Source

Fix a typo in r204164 that made *all* keywords available in OpenCL mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204196 91177308-0d34-0410-b5e6-96231b3b80d8
Richard Smith 11 năm trước cách đây
mục cha
commit
08c7b3dd96
2 tập tin đã thay đổi với 9 bổ sung1 xóa
  1. 1 1
      lib/Basic/IdentifierTable.cpp
  2. 8 0
      test/Parser/opencl-keywords.cl

+ 1 - 1
lib/Basic/IdentifierTable.cpp

@@ -130,7 +130,7 @@ static void AddKeyword(StringRef Keyword,
   else if (LangOpts.MicrosoftExt && (Flags & KEYMS)) AddResult = 1;
   else if (LangOpts.Borland && (Flags & KEYBORLAND)) AddResult = 1;
   else if (LangOpts.Bool && (Flags & BOOLSUPPORT)) AddResult = 2;
-  else if (LangOpts.Half && (Flags && HALFSUPPORT)) AddResult = 2;
+  else if (LangOpts.Half && (Flags & HALFSUPPORT)) AddResult = 2;
   else if (LangOpts.WChar && (Flags & WCHARSUPPORT)) AddResult = 2;
   else if (LangOpts.AltiVec && (Flags & KEYALTIVEC)) AddResult = 2;
   else if (LangOpts.OpenCL && (Flags & KEYOPENCL)) AddResult = 2;

+ 8 - 0
test/Parser/opencl-keywords.cl

@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+// expected-no-diagnostics
+
+void f(half *h) {
+  bool b;
+  int wchar_t;
+  int constexpr;
+}