//===----- CGHLSLRuntime.cpp - Interface to HLSL Runtime ----------------===// /////////////////////////////////////////////////////////////////////////////// // // // CGHLSLRuntime.cpp // // Copyright (C) Microsoft Corporation. All rights reserved. // // This file is distributed under the University of Illinois Open Source // // License. See LICENSE.TXT for details. // // // // This provides a class for HLSL code generation. // // // /////////////////////////////////////////////////////////////////////////////// #include "clang/AST/ASTContext.h" #include "clang/AST/DeclTemplate.h" #include "clang/AST/HlslTypes.h" #include "clang/AST/Type.h" #include "CGHLSLRuntime.h" using namespace clang; using namespace CodeGen; CGHLSLRuntime::~CGHLSLRuntime() {} bool CGHLSLRuntime::IsHLSLVecMatType(clang::QualType &type) { return hlsl::IsHLSLVecMatType(type); } const clang::ExtVectorType *CGHLSLRuntime::ConvertHLSLVecMatTypeToExtVectorType( const clang::ASTContext &context, clang::QualType &type) { return hlsl::ConvertHLSLVecMatTypeToExtVectorType(context, type); } QualType CGHLSLRuntime::GetHLSLVecMatElementType(QualType type) { const Type *Ty = type.getCanonicalType().getTypePtr(); // TODO: check isVecMatrix const RecordType *RT = cast(Ty); const ClassTemplateSpecializationDecl *templateDecl = cast(RT->getDecl()); const TemplateArgumentList &argList = templateDecl->getTemplateArgs(); const TemplateArgument &arg0 = argList[0]; return arg0.getAsType(); }