changeset 4:e68854097132

recognize __code. but it's true type is void.
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Thu, 06 Jun 2013 15:05:00 +0900
parents 9ad51c7bc036
children 7a2c806705bf
files tools/clang/include/clang/Basic/Specifiers.h tools/clang/include/clang/Basic/TokenKinds.def tools/clang/include/clang/Sema/DeclSpec.h tools/clang/lib/Format/TokenAnnotator.cpp tools/clang/lib/Parse/ParseDecl.cpp tools/clang/lib/Parse/ParseExpr.cpp tools/clang/lib/Parse/ParseExprCXX.cpp tools/clang/lib/Parse/ParseTentative.cpp
diffstat 8 files changed, 56 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tools/clang/include/clang/Basic/Specifiers.h	Wed May 15 06:43:32 2013 +0900
+++ b/tools/clang/include/clang/Basic/Specifiers.h	Thu Jun 06 15:05:00 2013 +0900
@@ -71,6 +71,11 @@
     TST_image3d_t,        // OpenCL image3d_t
     TST_sampler_t,        // OpenCL sampler_t
     TST_event_t,          // OpenCL event_t
+
+#ifndef noCbC
+    TST___code,
+#endif
+
     TST_error         // erroneous type
   };
   
--- a/tools/clang/include/clang/Basic/TokenKinds.def	Wed May 15 06:43:32 2013 +0900
+++ b/tools/clang/include/clang/Basic/TokenKinds.def	Thu Jun 06 15:05:00 2013 +0900
@@ -267,6 +267,9 @@
 KEYWORD(__objc_yes                  , KEYALL)
 KEYWORD(__objc_no                   , KEYALL)
 
+#ifndef noCbC
+KEYWORD(__code                      , KEYALL)
+#endif
 
 // C++ 2.11p1: Keywords.
 KEYWORD(asm                         , KEYCXX|KEYGNU)
--- a/tools/clang/include/clang/Sema/DeclSpec.h	Wed May 15 06:43:32 2013 +0900
+++ b/tools/clang/include/clang/Sema/DeclSpec.h	Thu Jun 06 15:05:00 2013 +0900
@@ -295,6 +295,9 @@
   static const TST TST_event_t = clang::TST_event_t;
   static const TST TST_error = clang::TST_error;
 
+#ifndef noCbC
+  static const TST TST___code = clang::TST___code;
+#endif 
   // type-qualifiers
   enum TQ {   // NOTE: These flags must be kept in sync with Qualifiers::TQ.
     TQ_unspecified = 0,
--- a/tools/clang/lib/Format/TokenAnnotator.cpp	Wed May 15 06:43:32 2013 +0900
+++ b/tools/clang/lib/Format/TokenAnnotator.cpp	Thu Jun 06 15:05:00 2013 +0900
@@ -752,6 +752,9 @@
     case tok::kw_signed:
     case tok::kw_unsigned:
     case tok::kw_void:
+#ifndef noCbC
+    case tok::kw___code:
+#endif 
     case tok::kw_char:
     case tok::kw_int:
     case tok::kw_half:
--- a/tools/clang/lib/Parse/ParseDecl.cpp	Wed May 15 06:43:32 2013 +0900
+++ b/tools/clang/lib/Parse/ParseDecl.cpp	Thu Jun 06 15:05:00 2013 +0900
@@ -241,6 +241,10 @@
   case tok::kw_double:
   case tok::kw_void:
   case tok::kw_typeof:
+#ifndef noCbC
+  case tok::kw___code:
+#endif
+
     // __attribute__(( vec_type_hint(char) ))
     BuiltinType = true;
     T = ParseTypeName(&TypeRange);
@@ -2870,6 +2874,12 @@
       isInvalid = DS.SetTypeSpecType(DeclSpec::TST_void, Loc, PrevSpec,
                                      DiagID);
       break;
+#ifndef noCbC
+    case tok::kw___code:
+      isInvalid = DS.SetTypeSpecType(DeclSpec::TST_void, Loc, PrevSpec,
+				      DiagID);
+      break;
+#endif
     case tok::kw_char:
       isInvalid = DS.SetTypeSpecType(DeclSpec::TST_char, Loc, PrevSpec,
                                      DiagID);
@@ -3839,6 +3849,9 @@
   case tok::kw__Decimal64:
   case tok::kw__Decimal128:
   case tok::kw___vector:
+#ifndef noCbC
+  case tok::kw___code:
+#endif
 
     // OpenCL specific types:
   case tok::kw_image1d_t:
@@ -3921,6 +3934,9 @@
   case tok::kw__Decimal64:
   case tok::kw__Decimal128:
   case tok::kw___vector:
+#ifndef noCbC
+  case tok::kw___code:
+#endif
 
     // OpenCL specific types:
   case tok::kw_image1d_t:
@@ -4078,6 +4094,10 @@
   case tok::kw__Decimal128:
   case tok::kw___vector:
 
+#ifndef noCbC
+  case tok::kw___code:
+#endif
+
     // OpenCL specific types:
   case tok::kw_image1d_t:
   case tok::kw_image1d_array_t:
@@ -5579,6 +5599,9 @@
   case tok::kw_double:
   case tok::kw_bool:
   case tok::kw___pixel:
+#ifndef noCbC
+  case tok::kw___code:
+#endif
     Tok.setKind(tok::kw___vector);
     return true;
   case tok::identifier:
@@ -5607,6 +5630,9 @@
     case tok::kw_double:
     case tok::kw_bool:
     case tok::kw___pixel:
+#ifndef noCbC
+    case tok::kw___code:
+#endif
       isInvalid = DS.SetTypeAltiVecVector(true, Loc, PrevSpec, DiagID);
       return true;
     case tok::identifier:
--- a/tools/clang/lib/Parse/ParseExpr.cpp	Wed May 15 06:43:32 2013 +0900
+++ b/tools/clang/lib/Parse/ParseExpr.cpp	Thu Jun 06 15:05:00 2013 +0900
@@ -1021,6 +1021,10 @@
   case tok::kw_float:
   case tok::kw_double:
   case tok::kw_void:
+#ifndef noCbC
+  case tok::kw___code:
+#endif
+
   case tok::kw_typename:
   case tok::kw_typeof:
   case tok::kw___vector:
--- a/tools/clang/lib/Parse/ParseExprCXX.cpp	Wed May 15 06:43:32 2013 +0900
+++ b/tools/clang/lib/Parse/ParseExprCXX.cpp	Thu Jun 06 15:05:00 2013 +0900
@@ -1581,6 +1581,12 @@
   case tok::kw_void:
     DS.SetTypeSpecType(DeclSpec::TST_void, Loc, PrevSpec, DiagID);
     break;
+#ifndef noCbC
+  case tok::kw___code:
+    DS.SetTypeSpecType(DeclSpec::TST_void, Loc, PrevSpec, DiagID);
+    break;
+#endif
+
   case tok::kw_char:
     DS.SetTypeSpecType(DeclSpec::TST_char, Loc, PrevSpec, DiagID);
     break;
--- a/tools/clang/lib/Parse/ParseTentative.cpp	Wed May 15 06:43:32 2013 +0900
+++ b/tools/clang/lib/Parse/ParseTentative.cpp	Thu Jun 06 15:05:00 2013 +0900
@@ -828,6 +828,9 @@
   case tok::kw_union:
   case tok::kw_unsigned:
   case tok::kw_void:
+#ifndef noCbc
+  case tok::kw___code:
+#endif
   case tok::kw_volatile:
   case tok::kw__Bool:
   case tok::kw__Complex:
@@ -1267,6 +1270,9 @@
   case tok::kw_float:
   case tok::kw_double:
   case tok::kw_void:
+#ifndef noCbC
+  case tok::kw___code:
+#endif
   case tok::annot_decltype:
     if (NextToken().is(tok::l_paren))
       return TPResult::Ambiguous();