ClangASTContext.h revision 5e8eb5c428e91b99f3884b53fc5deea0ecb001cd
1//===-- ClangASTContext.h ---------------------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef liblldb_ClangASTContext_h_ 11#define liblldb_ClangASTContext_h_ 12 13// C Includes 14// C++ Includes 15#include <string> 16#include <vector> 17#include <memory> 18#include <stdint.h> 19 20// Other libraries and framework includes 21#include "llvm/ADT/OwningPtr.h" 22#include "llvm/ADT/SmallVector.h" 23#include "clang/AST/TemplateBase.h" 24 25// Project includes 26#include "lldb/lldb-enumerations.h" 27#include "lldb/Core/ClangForward.h" 28#include "lldb/Symbol/ClangASTType.h" 29 30namespace lldb_private { 31 32class Declaration; 33 34class ClangASTContext 35{ 36public: 37 enum { 38 eTypeHasChildren = (1u << 0), 39 eTypeHasValue = (1u << 1), 40 eTypeIsArray = (1u << 2), 41 eTypeIsBlock = (1u << 3), 42 eTypeIsBuiltIn = (1u << 4), 43 eTypeIsClass = (1u << 5), 44 eTypeIsCPlusPlus = (1u << 6), 45 eTypeIsEnumeration = (1u << 7), 46 eTypeIsFuncPrototype = (1u << 8), 47 eTypeIsMember = (1u << 9), 48 eTypeIsObjC = (1u << 10), 49 eTypeIsPointer = (1u << 11), 50 eTypeIsReference = (1u << 12), 51 eTypeIsStructUnion = (1u << 13), 52 eTypeIsTemplate = (1u << 14), 53 eTypeIsTypedef = (1u << 15), 54 eTypeIsVector = (1u << 16), 55 eTypeIsScalar = (1u << 17) 56 }; 57 58 typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *); 59 typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton, clang::ObjCInterfaceDecl *); 60 61 //------------------------------------------------------------------ 62 // Constructors and Destructors 63 //------------------------------------------------------------------ 64 ClangASTContext (const char *triple = NULL); 65 66 ~ClangASTContext(); 67 68 clang::ASTContext * 69 getASTContext(); 70 71 clang::Builtin::Context * 72 getBuiltinContext(); 73 74 clang::IdentifierTable * 75 getIdentifierTable(); 76 77 clang::LangOptions * 78 getLanguageOptions(); 79 80 clang::SelectorTable * 81 getSelectorTable(); 82 83 clang::FileManager * 84 getFileManager(); 85 86 clang::SourceManager * 87 getSourceManager(); 88 89 clang::DiagnosticsEngine * 90 getDiagnosticsEngine(); 91 92 clang::DiagnosticConsumer * 93 getDiagnosticConsumer(); 94 95 clang::TargetOptions * 96 getTargetOptions(); 97 98 clang::TargetInfo * 99 getTargetInfo(); 100 101 void 102 Clear(); 103 104 const char * 105 GetTargetTriple (); 106 107 void 108 SetTargetTriple (const char *target_triple); 109 110 void 111 SetArchitecture (const ArchSpec &arch); 112 113 bool 114 HasExternalSource (); 115 116 void 117 SetExternalSource (llvm::OwningPtr<clang::ExternalASTSource> &ast_source_ap); 118 119 void 120 RemoveExternalSource (); 121 122 bool 123 GetCompleteType (lldb::clang_type_t clang_type); 124 125 static bool 126 GetCompleteType (clang::ASTContext *ast, 127 lldb::clang_type_t clang_type); 128 129 bool 130 GetCompleteDecl (clang::Decl *decl) 131 { 132 return ClangASTContext::GetCompleteDecl(getASTContext(), decl); 133 } 134 135 static bool 136 GetCompleteDecl (clang::ASTContext *ast, 137 clang::Decl *decl); 138 139 //------------------------------------------------------------------ 140 // Basic Types 141 //------------------------------------------------------------------ 142 143 lldb::clang_type_t 144 GetBuiltinTypeForEncodingAndBitSize (lldb::Encoding encoding, 145 uint32_t bit_size); 146 147 static lldb::clang_type_t 148 GetBuiltinTypeForEncodingAndBitSize (clang::ASTContext *ast, 149 lldb::Encoding encoding, 150 uint32_t bit_size); 151 152 lldb::clang_type_t 153 GetBuiltinTypeForDWARFEncodingAndBitSize ( 154 const char *type_name, 155 uint32_t dw_ate, 156 uint32_t bit_size); 157 158 static lldb::clang_type_t 159 GetBuiltInType_void(clang::ASTContext *ast); 160 161 lldb::clang_type_t 162 GetBuiltInType_void() 163 { 164 return GetBuiltInType_void(getASTContext()); 165 } 166 167 lldb::clang_type_t 168 GetBuiltInType_bool(); 169 170 lldb::clang_type_t 171 GetBuiltInType_objc_id(); 172 173 lldb::clang_type_t 174 GetBuiltInType_objc_Class(); 175 176 static lldb::clang_type_t 177 GetUnknownAnyType(clang::ASTContext *ast); 178 179 lldb::clang_type_t 180 GetUnknownAnyType() 181 { 182 return ClangASTContext::GetUnknownAnyType(getASTContext()); 183 } 184 185 lldb::clang_type_t 186 GetBuiltInType_objc_selector(); 187 188 lldb::clang_type_t 189 GetCStringType(bool is_const); 190 191 lldb::clang_type_t 192 GetVoidPtrType(bool is_const); 193 194 static lldb::clang_type_t 195 GetVoidPtrType(clang::ASTContext *ast, bool is_const); 196 197 static lldb::clang_type_t 198 CopyType(clang::ASTContext *dest_context, 199 clang::ASTContext *source_context, 200 lldb::clang_type_t clang_type); 201 202 static clang::Decl * 203 CopyDecl (clang::ASTContext *dest_context, 204 clang::ASTContext *source_context, 205 clang::Decl *source_decl); 206 207 static bool 208 AreTypesSame(clang::ASTContext *ast, 209 lldb::clang_type_t type1, 210 lldb::clang_type_t type2); 211 212 bool 213 AreTypesSame(lldb::clang_type_t type1, 214 lldb::clang_type_t type2) 215 { 216 return ClangASTContext::AreTypesSame(getASTContext(), type1, type2); 217 } 218 219 220 lldb::clang_type_t 221 GetTypeForDecl (clang::TagDecl *decl); 222 223 lldb::clang_type_t 224 GetTypeForDecl (clang::ObjCInterfaceDecl *objc_decl); 225 226 //------------------------------------------------------------------ 227 // CVR modifiers 228 //------------------------------------------------------------------ 229 230 static lldb::clang_type_t 231 AddConstModifier (lldb::clang_type_t clang_type); 232 233 static lldb::clang_type_t 234 AddRestrictModifier (lldb::clang_type_t clang_type); 235 236 static lldb::clang_type_t 237 AddVolatileModifier (lldb::clang_type_t clang_type); 238 239 //------------------------------------------------------------------ 240 // Structure, Unions, Classes 241 //------------------------------------------------------------------ 242 243 lldb::clang_type_t 244 CreateRecordType (clang::DeclContext *decl_ctx, 245 lldb::AccessType access_type, 246 const char *name, 247 int kind, 248 lldb::LanguageType language); 249 250 static bool 251 AddFieldToRecordType (clang::ASTContext *ast, 252 lldb::clang_type_t record_qual_type, 253 const char *name, 254 lldb::clang_type_t field_type, 255 lldb::AccessType access, 256 uint32_t bitfield_bit_size); 257 258 bool 259 AddFieldToRecordType (lldb::clang_type_t record_qual_type, 260 const char *name, 261 lldb::clang_type_t field_type, 262 lldb::AccessType access, 263 uint32_t bitfield_bit_size) 264 { 265 return ClangASTContext::AddFieldToRecordType (getASTContext(), 266 record_qual_type, 267 name, 268 field_type, 269 access, 270 bitfield_bit_size); 271 } 272 273 static clang::CXXMethodDecl * 274 AddMethodToCXXRecordType (clang::ASTContext *ast, 275 lldb::clang_type_t record_opaque_type, 276 const char *name, 277 lldb::clang_type_t method_type, 278 lldb::AccessType access, 279 bool is_virtual, 280 bool is_static, 281 bool is_inline, 282 bool is_explicit); 283 284 clang::CXXMethodDecl * 285 AddMethodToCXXRecordType (lldb::clang_type_t record_opaque_type, 286 const char *name, 287 lldb::clang_type_t method_type, 288 lldb::AccessType access, 289 bool is_virtual, 290 bool is_static, 291 bool is_inline, 292 bool is_explicit) 293 294 { 295 return ClangASTContext::AddMethodToCXXRecordType (getASTContext(), 296 record_opaque_type, 297 name, 298 method_type, 299 access, 300 is_virtual, 301 is_static, 302 is_inline, 303 is_explicit); 304 } 305 306 class TemplateParameterInfos 307 { 308 public: 309 bool 310 IsValid() const 311 { 312 if (args.empty()) 313 return false; 314 return args.size() == names.size(); 315 } 316 317 size_t 318 GetSize () const 319 { 320 if (IsValid()) 321 return args.size(); 322 return 0; 323 } 324 325 llvm::SmallVector<const char *, 8> names; 326 llvm::SmallVector<clang::TemplateArgument, 8> args; 327 }; 328 329 clang::ClassTemplateDecl * 330 CreateClassTemplateDecl (clang::DeclContext *decl_ctx, 331 lldb::AccessType access_type, 332 const char *class_name, 333 int kind, 334 const TemplateParameterInfos &infos); 335 336 clang::ClassTemplateSpecializationDecl * 337 CreateClassTemplateSpecializationDecl (clang::DeclContext *decl_ctx, 338 clang::ClassTemplateDecl *class_template_decl, 339 int kind, 340 const TemplateParameterInfos &infos); 341 342 lldb::clang_type_t 343 CreateClassTemplateSpecializationType (clang::ClassTemplateSpecializationDecl *class_template_specialization_decl); 344 345 static clang::DeclContext * 346 GetAsDeclContext (clang::CXXMethodDecl *cxx_method_decl); 347 348 static clang::DeclContext * 349 GetAsDeclContext (clang::ObjCMethodDecl *objc_method_decl); 350 351 352 static bool 353 CheckOverloadedOperatorKindParameterCount (uint32_t op_kind, 354 uint32_t num_params); 355 356 bool 357 FieldIsBitfield (clang::FieldDecl* field, 358 uint32_t& bitfield_bit_size); 359 360 static bool 361 FieldIsBitfield (clang::ASTContext *ast, 362 clang::FieldDecl* field, 363 uint32_t& bitfield_bit_size); 364 365 static bool 366 RecordHasFields (const clang::RecordDecl *record_decl); 367 368 void 369 SetDefaultAccessForRecordFields (lldb::clang_type_t clang_type, 370 int default_accessibility, 371 int *assigned_accessibilities, 372 size_t num_assigned_accessibilities); 373 374 lldb::clang_type_t 375 CreateObjCClass (const char *name, 376 clang::DeclContext *decl_ctx, 377 bool isForwardDecl, 378 bool isInternal); 379 380 static bool 381 AddObjCClassIVar (clang::ASTContext *ast, 382 lldb::clang_type_t class_opaque_type, 383 const char *name, 384 lldb::clang_type_t ivar_opaque_type, 385 lldb::AccessType access, 386 uint32_t bitfield_bit_size, 387 bool isSynthesized); 388 389 bool 390 AddObjCClassIVar (lldb::clang_type_t class_opaque_type, 391 const char *name, 392 lldb::clang_type_t ivar_opaque_type, 393 lldb::AccessType access, 394 uint32_t bitfield_bit_size, 395 bool isSynthesized) 396 { 397 return ClangASTContext::AddObjCClassIVar (getASTContext(), 398 class_opaque_type, 399 name, 400 ivar_opaque_type, 401 access, 402 bitfield_bit_size, 403 isSynthesized); 404 } 405 406 bool 407 SetObjCSuperClass (lldb::clang_type_t class_clang_type, 408 lldb::clang_type_t superclass_clang_type); 409 410 static bool 411 ObjCTypeHasIVars (lldb::clang_type_t class_clang_type, bool check_superclass); 412 413 static bool 414 ObjCDeclHasIVars (clang::ObjCInterfaceDecl *class_interface_decl, 415 bool check_superclass); 416 417 418 static clang::ObjCMethodDecl * 419 AddMethodToObjCObjectType (clang::ASTContext *ast, 420 lldb::clang_type_t class_opaque_type, 421 const char *name, // the full symbol name as seen in the symbol table ("-[NString stringWithCString:]") 422 lldb::clang_type_t method_opaque_type, 423 lldb::AccessType access); 424 425 clang::ObjCMethodDecl * 426 AddMethodToObjCObjectType (lldb::clang_type_t class_opaque_type, 427 const char *name, // the full symbol name as seen in the symbol table ("-[NString stringWithCString:]") 428 lldb::clang_type_t method_opaque_type, 429 lldb::AccessType access) 430 { 431 return AddMethodToObjCObjectType (getASTContext(), 432 class_opaque_type, 433 name, 434 method_opaque_type, 435 access); 436 } 437 438 static bool 439 SetHasExternalStorage (lldb::clang_type_t clang_type, bool has_extern); 440 441 //------------------------------------------------------------------ 442 // Aggregate Types 443 //------------------------------------------------------------------ 444 static bool 445 IsAggregateType (lldb::clang_type_t clang_type); 446 447 // Returns a mask containing bits from the ClangASTContext::eTypeXXX enumerations 448 static uint32_t 449 GetTypeInfo (lldb::clang_type_t clang_type, 450 clang::ASTContext *ast, // The AST for clang_type (can be NULL) 451 lldb::clang_type_t *pointee_or_element_type); // (can be NULL) 452 453 static uint32_t 454 GetNumChildren (clang::ASTContext *ast, 455 lldb::clang_type_t clang_type, 456 bool omit_empty_base_classes); 457 458 static uint32_t 459 GetNumDirectBaseClasses (clang::ASTContext *ast, 460 lldb::clang_type_t clang_type); 461 462 static uint32_t 463 GetNumVirtualBaseClasses (clang::ASTContext *ast, 464 lldb::clang_type_t clang_type); 465 466 static uint32_t 467 GetNumFields (clang::ASTContext *ast, 468 lldb::clang_type_t clang_type); 469 470 static lldb::clang_type_t 471 GetDirectBaseClassAtIndex (clang::ASTContext *ast, 472 lldb::clang_type_t clang_type, 473 uint32_t idx, 474 uint32_t *byte_offset_ptr); 475 476 static lldb::clang_type_t 477 GetVirtualBaseClassAtIndex (clang::ASTContext *ast, 478 lldb::clang_type_t clang_type, 479 uint32_t idx, 480 uint32_t *byte_offset_ptr); 481 482 static lldb::clang_type_t 483 GetFieldAtIndex (clang::ASTContext *ast, 484 lldb::clang_type_t clang_type, 485 uint32_t idx, 486 std::string& name, 487 uint32_t *byte_offset_ptr); 488 489 static uint32_t 490 GetNumPointeeChildren (lldb::clang_type_t clang_type); 491 492 lldb::clang_type_t 493 GetChildClangTypeAtIndex (ExecutionContext *exe_ctx, 494 const char *parent_name, 495 lldb::clang_type_t parent_clang_type, 496 uint32_t idx, 497 bool transparent_pointers, 498 bool omit_empty_base_classes, 499 bool ignore_array_bounds, 500 std::string& child_name, 501 uint32_t &child_byte_size, 502 int32_t &child_byte_offset, 503 uint32_t &child_bitfield_bit_size, 504 uint32_t &child_bitfield_bit_offset, 505 bool &child_is_base_class, 506 bool &child_is_deref_of_parent); 507 508 static lldb::clang_type_t 509 GetChildClangTypeAtIndex (ExecutionContext *exe_ctx, 510 clang::ASTContext *ast, 511 const char *parent_name, 512 lldb::clang_type_t parent_clang_type, 513 uint32_t idx, 514 bool transparent_pointers, 515 bool omit_empty_base_classes, 516 bool ignore_array_bounds, 517 std::string& child_name, 518 uint32_t &child_byte_size, 519 int32_t &child_byte_offset, 520 uint32_t &child_bitfield_bit_size, 521 uint32_t &child_bitfield_bit_offset, 522 bool &child_is_base_class, 523 bool &child_is_deref_of_parent); 524 525 // Lookup a child given a name. This function will match base class names 526 // and member member names in "clang_type" only, not descendants. 527 static uint32_t 528 GetIndexOfChildWithName (clang::ASTContext *ast, 529 lldb::clang_type_t clang_type, 530 const char *name, 531 bool omit_empty_base_classes); 532 533 // Lookup a child member given a name. This function will match member names 534 // only and will descend into "clang_type" children in search for the first 535 // member in this class, or any base class that matches "name". 536 // TODO: Return all matches for a given name by returning a vector<vector<uint32_t>> 537 // so we catch all names that match a given child name, not just the first. 538 static size_t 539 GetIndexOfChildMemberWithName (clang::ASTContext *ast, 540 lldb::clang_type_t clang_type, 541 const char *name, 542 bool omit_empty_base_classes, 543 std::vector<uint32_t>& child_indexes); 544 545 //------------------------------------------------------------------ 546 // clang::TagType 547 //------------------------------------------------------------------ 548 549 bool 550 SetTagTypeKind (lldb::clang_type_t tag_qual_type, 551 int kind); 552 553 //------------------------------------------------------------------ 554 // C++ Base Classes 555 //------------------------------------------------------------------ 556 557 clang::CXXBaseSpecifier * 558 CreateBaseClassSpecifier (lldb::clang_type_t base_class_type, 559 lldb::AccessType access, 560 bool is_virtual, 561 bool base_of_class); 562 563 static void 564 DeleteBaseClassSpecifiers (clang::CXXBaseSpecifier **base_classes, 565 unsigned num_base_classes); 566 567 bool 568 SetBaseClassesForClassType (lldb::clang_type_t class_clang_type, 569 clang::CXXBaseSpecifier const * const *base_classes, 570 unsigned num_base_classes); 571 572 //------------------------------------------------------------------ 573 // DeclContext Functions 574 //------------------------------------------------------------------ 575 576 static clang::DeclContext * 577 GetDeclContextForType (lldb::clang_type_t qual_type); 578 579 //------------------------------------------------------------------ 580 // Namespace Declarations 581 //------------------------------------------------------------------ 582 583 clang::NamespaceDecl * 584 GetUniqueNamespaceDeclaration (const char *name, 585 clang::DeclContext *decl_ctx); 586 587 //------------------------------------------------------------------ 588 // Function Types 589 //------------------------------------------------------------------ 590 591 clang::FunctionDecl * 592 CreateFunctionDeclaration (clang::DeclContext *decl_ctx, 593 const char *name, 594 lldb::clang_type_t function_Type, 595 int storage, 596 bool is_inline); 597 598 static lldb::clang_type_t 599 CreateFunctionType (clang::ASTContext *ast, 600 lldb::clang_type_t result_type, 601 lldb::clang_type_t *args, 602 unsigned num_args, 603 bool is_variadic, 604 unsigned type_quals); 605 606 lldb::clang_type_t 607 CreateFunctionType (lldb::clang_type_t result_type, 608 lldb::clang_type_t *args, 609 unsigned num_args, 610 bool is_variadic, 611 unsigned type_quals) 612 { 613 return ClangASTContext::CreateFunctionType(getASTContext(), 614 result_type, 615 args, 616 num_args, 617 is_variadic, 618 type_quals); 619 } 620 621 clang::ParmVarDecl * 622 CreateParameterDeclaration (const char *name, 623 lldb::clang_type_t param_type, 624 int storage); 625 626 void 627 SetFunctionParameters (clang::FunctionDecl *function_decl, 628 clang::ParmVarDecl **params, 629 unsigned num_params); 630 631 //------------------------------------------------------------------ 632 // Array Types 633 //------------------------------------------------------------------ 634 635 lldb::clang_type_t 636 CreateArrayType (lldb::clang_type_t element_type, 637 size_t element_count, 638 uint32_t bit_stride); 639 640 //------------------------------------------------------------------ 641 // Tag Declarations 642 //------------------------------------------------------------------ 643 bool 644 StartTagDeclarationDefinition (lldb::clang_type_t qual_type); 645 646 bool 647 CompleteTagDeclarationDefinition (lldb::clang_type_t qual_type); 648 649 //------------------------------------------------------------------ 650 // Enumeration Types 651 //------------------------------------------------------------------ 652 lldb::clang_type_t 653 CreateEnumerationType (const char *name, 654 clang::DeclContext *decl_ctx, 655 const Declaration &decl, 656 lldb::clang_type_t integer_qual_type); 657 658 static lldb::clang_type_t 659 GetEnumerationIntegerType (lldb::clang_type_t enum_clang_type); 660 661 bool 662 AddEnumerationValueToEnumerationType (lldb::clang_type_t enum_qual_type, 663 lldb::clang_type_t enumerator_qual_type, 664 const Declaration &decl, 665 const char *name, 666 int64_t enum_value, 667 uint32_t enum_value_bit_size); 668 669 //------------------------------------------------------------------ 670 // Pointers & References 671 //------------------------------------------------------------------ 672 lldb::clang_type_t 673 CreatePointerType (lldb::clang_type_t clang_type); 674 675 static lldb::clang_type_t 676 CreatePointerType (clang::ASTContext *ast, 677 lldb::clang_type_t clang_type); 678 679 static lldb::clang_type_t 680 CreateLValueReferenceType (clang::ASTContext *ast_context, 681 lldb::clang_type_t clang_type); 682 683 static lldb::clang_type_t 684 CreateRValueReferenceType (clang::ASTContext *ast_context, 685 lldb::clang_type_t clang_type); 686 687 lldb::clang_type_t 688 CreateLValueReferenceType (lldb::clang_type_t clang_type) 689 { 690 return ClangASTContext::CreateLValueReferenceType(getASTContext(), clang_type); 691 } 692 693 lldb::clang_type_t 694 CreateRValueReferenceType (lldb::clang_type_t clang_type) 695 { 696 return ClangASTContext::CreateRValueReferenceType(getASTContext(), clang_type); 697 } 698 699 lldb::clang_type_t 700 CreateMemberPointerType (lldb::clang_type_t clang_pointee_type, 701 lldb::clang_type_t clang_class_type); 702 703 uint32_t 704 GetPointerBitSize (); 705 706 static bool 707 IsIntegerType (lldb::clang_type_t clang_type, bool &is_signed); 708 709 static bool 710 IsPointerType (lldb::clang_type_t clang_type, lldb::clang_type_t *target_type = NULL); 711 712 static bool 713 IsPointerOrReferenceType (lldb::clang_type_t clang_type, lldb::clang_type_t *target_type = NULL); 714 715 static bool 716 IsPossibleCPlusPlusDynamicType (clang::ASTContext *ast, 717 lldb::clang_type_t clang_type, 718 lldb::clang_type_t *target_type = NULL); 719 720 static bool 721 IsPossibleDynamicType (clang::ASTContext *ast, 722 lldb::clang_type_t clang_type, 723 lldb::clang_type_t *dynamic_pointee_type = NULL); 724 725 static bool 726 IsCStringType (lldb::clang_type_t clang_type, uint32_t &length); 727 728 static bool 729 IsFunctionPointerType (lldb::clang_type_t clang_type); 730 731 static bool 732 IsArrayType (lldb::clang_type_t clang_type, lldb::clang_type_t *member_type = NULL, uint64_t *size = NULL); 733 734 //------------------------------------------------------------------ 735 // Typedefs 736 //------------------------------------------------------------------ 737 lldb::clang_type_t 738 CreateTypedefType (const char *name, 739 lldb::clang_type_t clang_type, 740 clang::DeclContext *decl_ctx); 741 742 //------------------------------------------------------------------ 743 // Type names 744 //------------------------------------------------------------------ 745 static bool 746 IsFloatingPointType (lldb::clang_type_t clang_type, uint32_t &count, bool &is_complex); 747 748 // true iff this is one of the types that can "fit" 749 // in a Scalar object 750 static bool 751 IsScalarType (lldb::clang_type_t clang_type); 752 753 static bool 754 IsPointerToScalarType (lldb::clang_type_t clang_type); 755 756 static bool 757 IsArrayOfScalarType (lldb::clang_type_t clang_type); 758 759 static bool 760 GetCXXClassName (lldb::clang_type_t clang_type, 761 std::string &class_name); 762 763 static bool 764 IsCXXClassType (lldb::clang_type_t clang_type); 765 766 static bool 767 IsBeingDefined (lldb::clang_type_t clang_type); 768 769 static bool 770 IsObjCClassType (lldb::clang_type_t clang_type); 771 772 static bool 773 IsCharType (lldb::clang_type_t clang_type); 774 775 static size_t 776 GetArraySize (lldb::clang_type_t clang_type); 777 778 //static bool 779 //ConvertFloatValueToString (clang::ASTContext *ast, 780 // lldb::clang_type_t clang_type, 781 // const uint8_t* bytes, 782 // size_t byte_size, 783 // int apint_byte_order, 784 // std::string &float_str); 785 786 static size_t 787 ConvertStringToFloatValue (clang::ASTContext *ast, 788 lldb::clang_type_t clang_type, 789 const char *s, 790 uint8_t *dst, 791 size_t dst_size); 792 793 //------------------------------------------------------------------ 794 // Qualifiers 795 //------------------------------------------------------------------ 796 static unsigned 797 GetTypeQualifiers(lldb::clang_type_t clang_type); 798protected: 799 //------------------------------------------------------------------ 800 // Classes that inherit from ClangASTContext can see and modify these 801 //------------------------------------------------------------------ 802 std::string m_target_triple; 803 std::auto_ptr<clang::ASTContext> m_ast_ap; 804 std::auto_ptr<clang::LangOptions> m_language_options_ap; 805 std::auto_ptr<clang::FileManager> m_file_manager_ap; 806 std::auto_ptr<clang::FileSystemOptions> m_file_system_options_ap; 807 std::auto_ptr<clang::SourceManager> m_source_manager_ap; 808 std::auto_ptr<clang::DiagnosticsEngine> m_diagnostics_engine_ap; 809 std::auto_ptr<clang::DiagnosticConsumer> m_diagnostic_consumer_ap; 810 std::auto_ptr<clang::TargetOptions> m_target_options_ap; 811 std::auto_ptr<clang::TargetInfo> m_target_info_ap; 812 std::auto_ptr<clang::IdentifierTable> m_identifier_table_ap; 813 std::auto_ptr<clang::SelectorTable> m_selector_table_ap; 814 std::auto_ptr<clang::Builtin::Context> m_builtins_ap; 815 CompleteTagDeclCallback m_callback_tag_decl; 816 CompleteObjCInterfaceDeclCallback m_callback_objc_decl; 817 void * m_callback_baton; 818private: 819 //------------------------------------------------------------------ 820 // For ClangASTContext only 821 //------------------------------------------------------------------ 822 ClangASTContext(const ClangASTContext&); 823 const ClangASTContext& operator=(const ClangASTContext&); 824}; 825 826} // namespace lldb_private 827 828#endif // liblldb_ClangASTContext_h_ 829