Coverage Report

Created: 2020-02-25 14:32

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/lib/CodeGen/CodeGenABITypes.cpp
Line
Count
Source (jump to first uncovered line)
1
//==--- CodeGenABITypes.cpp - Convert Clang types to LLVM types for ABI ----==//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// CodeGenABITypes is a simple interface for getting LLVM types for
10
// the parameters and the return value of a function given the Clang
11
// types.
12
//
13
// The class is implemented as a public wrapper around the private
14
// CodeGenTypes class in lib/CodeGen.
15
//
16
//===----------------------------------------------------------------------===//
17
18
#include "clang/CodeGen/CodeGenABITypes.h"
19
#include "CGRecordLayout.h"
20
#include "CodeGenModule.h"
21
#include "clang/CodeGen/CGFunctionInfo.h"
22
#include "clang/Lex/HeaderSearchOptions.h"
23
#include "clang/Lex/PreprocessorOptions.h"
24
25
using namespace clang;
26
using namespace CodeGen;
27
28
const CGFunctionInfo &
29
CodeGen::arrangeObjCMessageSendSignature(CodeGenModule &CGM,
30
                                         const ObjCMethodDecl *MD,
31
0
                                         QualType receiverType) {
32
0
  return CGM.getTypes().arrangeObjCMessageSendSignature(MD, receiverType);
33
0
}
34
35
const CGFunctionInfo &
36
CodeGen::arrangeFreeFunctionType(CodeGenModule &CGM,
37
0
                                 CanQual<FunctionProtoType> Ty) {
38
0
  return CGM.getTypes().arrangeFreeFunctionType(Ty);
39
0
}
40
41
const CGFunctionInfo &
42
CodeGen::arrangeFreeFunctionType(CodeGenModule &CGM,
43
0
                                 CanQual<FunctionNoProtoType> Ty) {
44
0
  return CGM.getTypes().arrangeFreeFunctionType(Ty);
45
0
}
46
47
const CGFunctionInfo &
48
CodeGen::arrangeCXXMethodType(CodeGenModule &CGM,
49
                              const CXXRecordDecl *RD,
50
                              const FunctionProtoType *FTP,
51
0
                              const CXXMethodDecl *MD) {
52
0
  return CGM.getTypes().arrangeCXXMethodType(RD, FTP, MD);
53
0
}
54
55
const CGFunctionInfo &
56
CodeGen::arrangeFreeFunctionCall(CodeGenModule &CGM,
57
                                 CanQualType returnType,
58
                                 ArrayRef<CanQualType> argTypes,
59
                                 FunctionType::ExtInfo info,
60
0
                                 RequiredArgs args) {
61
0
  return CGM.getTypes().arrangeLLVMFunctionInfo(
62
0
      returnType, /*instanceMethod=*/false, /*chainCall=*/false, argTypes,
63
0
      info, {}, args);
64
0
}
65
66
llvm::FunctionType *
67
0
CodeGen::convertFreeFunctionType(CodeGenModule &CGM, const FunctionDecl *FD) {
68
0
  assert(FD != nullptr && "Expected a non-null function declaration!");
69
0
  llvm::Type *T = CGM.getTypes().ConvertType(FD->getType());
70
0
71
0
  if (auto FT = dyn_cast<llvm::FunctionType>(T))
72
0
    return FT;
73
0
74
0
  return nullptr;
75
0
}
76
77
llvm::Type *
78
1
CodeGen::convertTypeForMemory(CodeGenModule &CGM, QualType T) {
79
1
  return CGM.getTypes().ConvertTypeForMem(T);
80
1
}
81
82
unsigned CodeGen::getLLVMFieldNumber(CodeGenModule &CGM,
83
                                     const RecordDecl *RD,
84
3
                                     const FieldDecl *FD) {
85
3
  return CGM.getTypes().getCGRecordLayout(RD).getLLVMFieldNo(FD);
86
3
}