1 /*
  2  *  Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
  3  *  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  *  This code is free software; you can redistribute it and/or modify it
  6  *  under the terms of the GNU General Public License version 2 only, as
  7  *  published by the Free Software Foundation.  Oracle designates this
  8  *  particular file as subject to the "Classpath" exception as provided
  9  *  by Oracle in the LICENSE file that accompanied this code.
 10  *
 11  *  This code is distributed in the hope that it will be useful, but WITHOUT
 12  *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  *  version 2 for more details (a copy is included in the LICENSE file that
 15  *  accompanied this code).
 16  *
 17  *  You should have received a copy of the GNU General Public License version
 18  *  2 along with this work; if not, write to the Free Software Foundation,
 19  *  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  *
 21  *   Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22  *  or visit www.oracle.com if you need additional information or have any
 23  *  questions.
 24  *
 25  */
 26 package jdk.internal.clang;
 27 
 28 import java.util.HashMap;
 29 import java.util.Map;
 30 import java.util.NoSuchElementException;
 31 import static jdk.internal.clang.libclang.Index_h.*;
 32 
 33 public enum TypeKind {
 34 
 35     Invalid(CXType_Invalid()),
 36     Unexposed(CXType_Unexposed()),
 37     Void(CXType_Void()),
 38     Bool(CXType_Bool()),
 39     Char_U(CXType_Char_U()),
 40     UChar(CXType_UChar()),
 41     Char16(CXType_Char16()),
 42     Char32(CXType_Char32()),
 43     UShort(CXType_UShort()),
 44     UInt(CXType_UInt()),
 45     ULong(CXType_ULong()),
 46     ULongLong(CXType_ULongLong()),
 47     UInt128(CXType_UInt128()),
 48     Char_S(CXType_Char_S()),
 49     SChar(CXType_SChar()),
 50     WChar(CXType_WChar()),
 51     Short(CXType_Short()),
 52     Int(CXType_Int()),
 53     Long(CXType_Long()),
 54     LongLong(CXType_LongLong()),
 55     Int128(CXType_Int128()),
 56     Float(CXType_Float()),
 57     Double(CXType_Double()),
 58     LongDouble(CXType_LongDouble()),
 59     NullPtr(CXType_NullPtr()),
 60     Overload(CXType_Overload()),
 61     Dependent(CXType_Dependent()),
 62     ObjCId(CXType_ObjCId()),
 63     ObjCClass(CXType_ObjCClass()),
 64     ObjCSel(CXType_ObjCSel()),
 65     Float128(CXType_Float128()),
 66     Half(CXType_Half()),
 67     Float16(CXType_Float16()),
 68     ShortAccum(CXType_ShortAccum()),
 69     Accum(CXType_Accum()),
 70     LongAccum(CXType_LongAccum()),
 71     UShortAccum(CXType_UShortAccum()),
 72     UAccum(CXType_UAccum()),
 73     ULongAccum(CXType_ULongAccum()),
 74     Complex(CXType_Complex()),
 75     Pointer(CXType_Pointer()),
 76     BlockPointer(CXType_BlockPointer()),
 77     LValueReference(CXType_LValueReference()),
 78     RValueReference(CXType_RValueReference()),
 79     Record(CXType_Record()),
 80     Enum(CXType_Enum()),
 81     Typedef(CXType_Typedef()),
 82     ObjCInterface(CXType_ObjCInterface()),
 83     ObjCObjectPointer(CXType_ObjCObjectPointer()),
 84     FunctionNoProto(CXType_FunctionNoProto()),
 85     FunctionProto(CXType_FunctionProto()),
 86     ConstantArray(CXType_ConstantArray()),
 87     Vector(CXType_Vector()),
 88     IncompleteArray(CXType_IncompleteArray()),
 89     VariableArray(CXType_VariableArray()),
 90     DependentSizedArray(CXType_DependentSizedArray()),
 91     MemberPointer(CXType_MemberPointer()),
 92     Auto(CXType_Auto()),
 93     Elaborated(CXType_Elaborated()),
 94     Pipe(CXType_Pipe()),
 95     OCLImage1dRO(CXType_OCLImage1dRO()),
 96     OCLImage1dArrayRO(CXType_OCLImage1dArrayRO()),
 97     OCLImage1dBufferRO(CXType_OCLImage1dBufferRO()),
 98     OCLImage2dRO(CXType_OCLImage2dRO()),
 99     OCLImage2dArrayRO(CXType_OCLImage2dArrayRO()),
100     OCLImage2dDepthRO(CXType_OCLImage2dDepthRO()),
101     OCLImage2dArrayDepthRO(CXType_OCLImage2dArrayDepthRO()),
102     OCLImage2dMSAARO(CXType_OCLImage2dMSAARO()),
103     OCLImage2dArrayMSAARO(CXType_OCLImage2dArrayMSAARO()),
104     OCLImage2dMSAADepthRO(CXType_OCLImage2dMSAADepthRO()),
105     OCLImage2dArrayMSAADepthRO(CXType_OCLImage2dArrayMSAADepthRO()),
106     OCLImage3dRO(CXType_OCLImage3dRO()),
107     OCLImage1dWO(CXType_OCLImage1dWO()),
108     OCLImage1dArrayWO(CXType_OCLImage1dArrayWO()),
109     OCLImage1dBufferWO(CXType_OCLImage1dBufferWO()),
110     OCLImage2dWO(CXType_OCLImage2dWO()),
111     OCLImage2dArrayWO(CXType_OCLImage2dArrayWO()),
112     OCLImage2dDepthWO(CXType_OCLImage2dDepthWO()),
113     OCLImage2dArrayDepthWO(CXType_OCLImage2dArrayDepthWO()),
114     OCLImage2dMSAAWO(CXType_OCLImage2dMSAAWO()),
115     OCLImage2dArrayMSAAWO(CXType_OCLImage2dArrayMSAAWO()),
116     OCLImage2dMSAADepthWO(CXType_OCLImage2dMSAADepthWO()),
117     OCLImage2dArrayMSAADepthWO(CXType_OCLImage2dArrayMSAADepthWO()),
118     OCLImage3dWO(CXType_OCLImage3dWO()),
119     OCLImage1dRW(CXType_OCLImage1dRW()),
120     OCLImage1dArrayRW(CXType_OCLImage1dArrayRW()),
121     OCLImage1dBufferRW(CXType_OCLImage1dBufferRW()),
122     OCLImage2dRW(CXType_OCLImage2dRW()),
123     OCLImage2dArrayRW(CXType_OCLImage2dArrayRW()),
124     OCLImage2dDepthRW(CXType_OCLImage2dDepthRW()),
125     OCLImage2dArrayDepthRW(CXType_OCLImage2dArrayDepthRW()),
126     OCLImage2dMSAARW(CXType_OCLImage2dMSAARW()),
127     OCLImage2dArrayMSAARW(CXType_OCLImage2dArrayMSAARW()),
128     OCLImage2dMSAADepthRW(CXType_OCLImage2dMSAADepthRW()),
129     OCLImage2dArrayMSAADepthRW(CXType_OCLImage2dArrayMSAADepthRW()),
130     OCLImage3dRW(CXType_OCLImage3dRW()),
131     OCLSampler(CXType_OCLSampler()),
132     OCLEvent(CXType_OCLEvent()),
133     OCLQueue(CXType_OCLQueue()),
134     OCLReserveID(CXType_OCLReserveID()),
135     ObjCObject(CXType_ObjCObject()),
136     ObjCTypeParam(CXType_ObjCTypeParam()),
137     Attributed(CXType_Attributed()),
138     OCLIntelSubgroupAVCMcePayload(CXType_OCLIntelSubgroupAVCMcePayload()),
139     OCLIntelSubgroupAVCImePayload(CXType_OCLIntelSubgroupAVCImePayload()),
140     OCLIntelSubgroupAVCRefPayload(CXType_OCLIntelSubgroupAVCRefPayload()),
141     OCLIntelSubgroupAVCSicPayload(CXType_OCLIntelSubgroupAVCSicPayload()),
142     OCLIntelSubgroupAVCMceResult(CXType_OCLIntelSubgroupAVCMceResult()),
143     OCLIntelSubgroupAVCImeResult(CXType_OCLIntelSubgroupAVCImeResult()),
144     OCLIntelSubgroupAVCRefResult(CXType_OCLIntelSubgroupAVCRefResult()),
145     OCLIntelSubgroupAVCSicResult(CXType_OCLIntelSubgroupAVCSicResult()),
146     OCLIntelSubgroupAVCImeResultSingleRefStreamout(CXType_OCLIntelSubgroupAVCImeResultSingleRefStreamout()),
147     OCLIntelSubgroupAVCImeResultDualRefStreamout(CXType_OCLIntelSubgroupAVCImeResultDualRefStreamout()),
148     OCLIntelSubgroupAVCImeSingleRefStreamin(CXType_OCLIntelSubgroupAVCImeSingleRefStreamin()),
149     OCLIntelSubgroupAVCImeDualRefStreamin(CXType_OCLIntelSubgroupAVCImeDualRefStreamin()),
150     ExtVector(CXType_ExtVector()),
151     Atomic(177);  // This is missing in auto-generated code
152 
153     private final int value;
154 
155     TypeKind(int value) {
156         this.value = value;
157     }
158 
159     public int value() {
160         return value;
161     }
162 
163     private final static Map<Integer, TypeKind> lookup;
164 
165     static {
166         lookup = new HashMap<>();
167         for (TypeKind e: TypeKind.values()) {
168             lookup.put(e.value(), e);
169         }
170     }
171 
172     public final static TypeKind valueOf(int value) {
173         TypeKind x = lookup.get(value);
174         if (null == x) {
175             throw new NoSuchElementException("kind = " + value);
176         }
177         return x;
178     }
179 }