Esempio n. 1
0
  void
    TraverseTUnitConsumer::InvestigateASTContextTypes( ASTContext& context )
    {
      // const SmallVectorImpl<Type *>&
      auto& types = context.getTypes();

      TypePrinter printer(context.getPrintingPolicy(), /* indentation */ 2);

      const char *placeholder = ""; // "hey"

      for(const Type *type : types) {
        llvm::errs() << " - ";
        printer.print(type, Qualifiers(), llvm::errs(), placeholder);
        llvm::errs() << "\n";
      }

      (terrs().magenta() << "InvestigateASTContextTypes(): END.\n").reset();
    }
Esempio n. 2
0
void Type::Create(ASTContext& Context, unsigned i, Deserializer& D) {
  Type::TypeClass K = static_cast<Type::TypeClass>(D.ReadInt());
  SerializedPtrID PtrID = D.ReadPtrID();  
  
  switch (K) {
    default:
      assert (false && "Deserialization for type not supported.");
      break;
            
    case Type::Builtin:
      assert (i < Context.getTypes().size());
      assert (isa<BuiltinType>(Context.getTypes()[i]));
      D.RegisterPtr(PtrID,Context.getTypes()[i]); 
      break;
      
    case Type::ExtQual:
      D.RegisterPtr(PtrID,ExtQualType::CreateImpl(Context,D));
      break;
    
    case Type::Complex:
      D.RegisterPtr(PtrID,ComplexType::CreateImpl(Context,D));
      break;
      
    case Type::ConstantArray:
      D.RegisterPtr(PtrID,ConstantArrayType::CreateImpl(Context,D));
      break;
      
    case Type::FunctionNoProto:
      D.RegisterPtr(PtrID,FunctionNoProtoType::CreateImpl(Context,D));
      break;
      
    case Type::FunctionProto:
      D.RegisterPtr(PtrID,FunctionProtoType::CreateImpl(Context,D));
      break;
      
    case Type::IncompleteArray:
      D.RegisterPtr(PtrID,IncompleteArrayType::CreateImpl(Context,D));
      break;

    case Type::MemberPointer:
      D.RegisterPtr(PtrID, MemberPointerType::CreateImpl(Context, D));
      break;

    case Type::Pointer:
      D.RegisterPtr(PtrID, PointerType::CreateImpl(Context, D));
      break;

    case Type::BlockPointer:
      D.RegisterPtr(PtrID, BlockPointerType::CreateImpl(Context, D));
      break;

    case Type::LValueReference:
      D.RegisterPtr(PtrID, LValueReferenceType::CreateImpl(Context, D));
      break;

    case Type::RValueReference:
      D.RegisterPtr(PtrID, RValueReferenceType::CreateImpl(Context, D));
      break;

    case Type::Record:
    case Type::Enum:
      // FIXME: Implement this!
      assert(false && "Can't deserialize tag types!");
      break;

    case Type::Typedef:
      D.RegisterPtr(PtrID, TypedefType::CreateImpl(Context, D));
      break;

    case Type::TypeOfExpr:
      D.RegisterPtr(PtrID, TypeOfExprType::CreateImpl(Context, D));
      break;

    case Type::TypeOf:
      D.RegisterPtr(PtrID, TypeOfType::CreateImpl(Context, D));
      break;

    case Type::TemplateTypeParm:
      D.RegisterPtr(PtrID, TemplateTypeParmType::CreateImpl(Context, D));
      break;

    case Type::VariableArray:
      D.RegisterPtr(PtrID, VariableArrayType::CreateImpl(Context, D));
      break;
  }
}