18 #include "clang/Basic/TargetInfo.h"
29 "AppleObjCTypeEncodingParser ASTContext",
53 total = 10 * total + (type.
Next() -
'0');
62 : type(
clang::QualType()) {}
67 bool for_expression) {
74 retval.
type =
BuildType(ast_ctx, type, for_expression, &bitfield_size);
93 char opener,
char closer,
uint32_t kind) {
95 return clang::QualType();
102 const bool is_templated = name.find(
'<') != std::string::npos;
105 return clang::QualType();
106 bool in_union =
true;
107 std::vector<StructElement> elements;
109 if (type.
NextIf(closer)) {
114 if (element.type.isNull())
117 elements.push_back(element);
121 return clang::QualType();
124 return clang::QualType();
132 unsigned int count = 0;
133 for (
auto element : elements) {
134 if (element.name.empty()) {
136 elem_name.
Printf(
"__unnamed_%u", count);
140 union_type, element.name.c_str(), ast_ctx.
GetType(element.type),
152 return clang::QualType();
154 clang::QualType element_type(
BuildType(ast_ctx, type, for_expression));
156 return clang::QualType();
158 CompilerType(&ast_ctx, element_type.getAsOpaquePtr()), size,
false));
170 return clang::QualType();
199 switch (type.
Peek()) {
218 if (for_expression && !name.empty()) {
219 size_t less_than_pos = name.find(
'<');
221 if (less_than_pos != std::string::npos) {
222 if (less_than_pos == 0)
223 return ast_ctx.getObjCIdType();
225 name.erase(less_than_pos);
230 return clang::QualType();
237 #ifdef LLDB_CONFIGURATION_DEBUG
238 assert(!types.empty());
241 return ast_ctx.getObjCIdType();
247 return ast_ctx.getObjCIdType();
256 return clang::QualType();
260 switch (type.
Peek()) {
264 return BuildStruct(clang_ast_ctx, type, for_expression);
266 return BuildArray(clang_ast_ctx, type, for_expression);
268 return BuildUnion(clang_ast_ctx, type, for_expression);
273 switch (type.
Next()) {
276 return clang::QualType();
278 return ast_ctx.CharTy;
280 return ast_ctx.IntTy;
282 return ast_ctx.ShortTy;
284 return ast_ctx.getIntTypeForBitwidth(32,
true);
290 return ast_ctx.LongLongTy;
292 return ast_ctx.UnsignedCharTy;
294 return ast_ctx.UnsignedIntTy;
296 return ast_ctx.UnsignedShortTy;
298 return ast_ctx.getIntTypeForBitwidth(32,
false);
301 return ast_ctx.UnsignedLongLongTy;
303 return ast_ctx.FloatTy;
305 return ast_ctx.DoubleTy;
307 return ast_ctx.BoolTy;
309 return ast_ctx.VoidTy;
311 return ast_ctx.getPointerType(ast_ctx.CharTy);
313 return ast_ctx.getObjCClassType();
315 return ast_ctx.getObjCSelType();
318 if (bitfield_bit_size) {
319 *bitfield_bit_size = size;
320 return ast_ctx.UnsignedIntTy;
322 return clang::QualType();
325 clang::QualType target_type =
326 BuildType(clang_ast_ctx, type, for_expression);
327 if (target_type.isNull())
328 return clang::QualType();
329 else if (target_type == ast_ctx.UnknownAnyTy)
330 return ast_ctx.UnknownAnyTy;
332 return ast_ctx.getConstType(target_type);
341 return ast_ctx.VoidPtrTy;
343 clang::QualType target_type =
344 BuildType(clang_ast_ctx, type, for_expression);
345 if (target_type.isNull())
346 return clang::QualType();
347 else if (target_type == ast_ctx.UnknownAnyTy)
348 return ast_ctx.UnknownAnyTy;
350 return ast_ctx.getPointerType(target_type);
354 return for_expression ? ast_ctx.UnknownAnyTy : clang::QualType();
360 bool for_expression) {
361 if (name && name[0]) {
363 clang::QualType qual_type =
BuildType(ast_ctx, lexer, for_expression);
364 return ast_ctx.
GetType(qual_type);