Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/Support/CBindingWrapping.h
Line
Count
Source
1
//===- llvm/Support/CBindingWrapping.h - C Interface Wrapping ---*- C++ -*-===//
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
// This file declares the wrapping macros for the C interface.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_SUPPORT_CBINDINGWRAPPING_H
14
#define LLVM_SUPPORT_CBINDINGWRAPPING_H
15
16
#include "llvm-c/Types.h"
17
#include "llvm/Support/Casting.h"
18
19
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)     \
20
15.5k
  inline ty *unwrap(ref P) {                            \
21
15.5k
    return reinterpret_cast<ty*>(P);                    \
22
15.5k
  }                                                     \
llvm::unwrap(LLVMOpaqueMemoryBuffer*)
Line
Count
Source
20
33
  inline ty *unwrap(ref P) {                            \
21
33
    return reinterpret_cast<ty*>(P);                    \
22
33
  }                                                     \
Unexecuted instantiation: llvm::unwrap(LLVMOpaqueUse*)
llvm::unwrap(LLVMOpaqueValue*)
Line
Count
Source
20
11.7k
  inline ty *unwrap(ref P) {                            \
21
11.7k
    return reinterpret_cast<ty*>(P);                    \
22
11.7k
  }                                                     \
llvm::unwrap(LLVMOpaqueContext*)
Line
Count
Source
20
424
  inline ty *unwrap(ref P) {                            \
21
424
    return reinterpret_cast<ty*>(P);                    \
22
424
  }                                                     \
llvm::unwrap(LLVMOpaqueMetadata*)
Line
Count
Source
20
77
  inline ty *unwrap(ref P) {                            \
21
77
    return reinterpret_cast<ty*>(P);                    \
22
77
  }                                                     \
llvm::unwrap(LLVMOpaqueBasicBlock*)
Line
Count
Source
20
517
  inline ty *unwrap(ref P) {                            \
21
517
    return reinterpret_cast<ty*>(P);                    \
22
517
  }                                                     \
Unexecuted instantiation: llvm::unwrap(LLVMComdat*)
llvm::unwrap(LLVMOpaquePassRegistry*)
Line
Count
Source
20
24
  inline ty *unwrap(ref P) {                            \
21
24
    return reinterpret_cast<ty*>(P);                    \
22
24
  }                                                     \
llvm::unwrap(LLVMOpaqueModule*)
Line
Count
Source
20
888
  inline ty *unwrap(ref P) {                            \
21
888
    return reinterpret_cast<ty*>(P);                    \
22
888
  }                                                     \
llvm::unwrap(LLVMOpaquePassManager*)
Line
Count
Source
20
37
  inline ty *unwrap(ref P) {                            \
21
37
    return reinterpret_cast<ty*>(P);                    \
22
37
  }                                                     \
Unexecuted instantiation: llvm::object::unwrap(LLVMOpaqueBinary*)
llvm::unwrap(LLVMOpaqueDIBuilder*)
Line
Count
Source
20
43
  inline ty *unwrap(ref P) {                            \
21
43
    return reinterpret_cast<ty*>(P);                    \
22
43
  }                                                     \
unwrap(LLVMRemarkOpaqueParser*)
Line
Count
Source
20
4
  inline ty *unwrap(ref P) {                            \
21
4
    return reinterpret_cast<ty*>(P);                    \
22
4
  }                                                     \
llvm::unwrap(LLVMOpaqueNamedMDNode*)
Line
Count
Source
20
10
  inline ty *unwrap(ref P) {                            \
21
10
    return reinterpret_cast<ty*>(P);                    \
22
10
  }                                                     \
llvm::unwrap(LLVMOpaqueType*)
Line
Count
Source
20
1.34k
  inline ty *unwrap(ref P) {                            \
21
1.34k
    return reinterpret_cast<ty*>(P);                    \
22
1.34k
  }                                                     \
llvm::unwrap(LLVMOpaqueDiagnosticInfo*)
Line
Count
Source
20
4
  inline ty *unwrap(ref P) {                            \
21
4
    return reinterpret_cast<ty*>(P);                    \
22
4
  }                                                     \
llvm::unwrap(LLVMOpaqueBuilder*)
Line
Count
Source
20
436
  inline ty *unwrap(ref P) {                            \
21
436
    return reinterpret_cast<ty*>(P);                    \
22
436
  }                                                     \
23
                                                        \
24
4.19k
  inline ref wrap(const ty *P) {                        \
25
4.19k
    return reinterpret_cast<ref>(const_cast<ty*>(P));   \
26
4.19k
  }
Unexecuted instantiation: llvm::wrap(llvm::Use const*)
llvm::wrap(llvm::Value const*)
Line
Count
Source
24
2.36k
  inline ref wrap(const ty *P) {                        \
25
2.36k
    return reinterpret_cast<ref>(const_cast<ty*>(P));   \
26
2.36k
  }
llvm::wrap(llvm::Metadata const*)
Line
Count
Source
24
36
  inline ref wrap(const ty *P) {                        \
25
36
    return reinterpret_cast<ref>(const_cast<ty*>(P));   \
26
36
  }
Unexecuted instantiation: llvm::wrap(llvm::Comdat const*)
llvm::wrap(llvm::Module const*)
Line
Count
Source
24
65
  inline ref wrap(const ty *P) {                        \
25
65
    return reinterpret_cast<ref>(const_cast<ty*>(P));   \
26
65
  }
Unexecuted instantiation: llvm::wrap(llvm::DiagnosticInfo const*)
Unexecuted instantiation: llvm::object::wrap(llvm::object::Binary const*)
llvm::wrap(llvm::DIBuilder const*)
Line
Count
Source
24
1
  inline ref wrap(const ty *P) {                        \
25
1
    return reinterpret_cast<ref>(const_cast<ty*>(P));   \
26
1
  }
Unexecuted instantiation: llvm::remarks::wrap(llvm::remarks::Argument const*)
llvm::remarks::wrap(llvm::remarks::Remark const*)
Line
Count
Source
24
1
  inline ref wrap(const ty *P) {                        \
25
1
    return reinterpret_cast<ref>(const_cast<ty*>(P));   \
26
1
  }
wrap(CParser const*)
Line
Count
Source
24
1
  inline ref wrap(const ty *P) {                        \
25
1
    return reinterpret_cast<ref>(const_cast<ty*>(P));   \
26
1
  }
llvm::wrap(llvm::LLVMContext const*)
Line
Count
Source
24
535
  inline ref wrap(const ty *P) {                        \
25
535
    return reinterpret_cast<ref>(const_cast<ty*>(P));   \
26
535
  }
llvm::wrap(llvm::NamedMDNode const*)
Line
Count
Source
24
14
  inline ref wrap(const ty *P) {                        \
25
14
    return reinterpret_cast<ref>(const_cast<ty*>(P));   \
26
14
  }
llvm::wrap(llvm::BasicBlock const*)
Line
Count
Source
24
301
  inline ref wrap(const ty *P) {                        \
25
301
    return reinterpret_cast<ref>(const_cast<ty*>(P));   \
26
301
  }
llvm::wrap(llvm::Type const*)
Line
Count
Source
24
763
  inline ref wrap(const ty *P) {                        \
25
763
    return reinterpret_cast<ref>(const_cast<ty*>(P));   \
26
763
  }
llvm::wrap(llvm::PassRegistry const*)
Line
Count
Source
24
24
  inline ref wrap(const ty *P) {                        \
25
24
    return reinterpret_cast<ref>(const_cast<ty*>(P));   \
26
24
  }
llvm::wrap(llvm::legacy::PassManagerBase const*)
Line
Count
Source
24
9
  inline ref wrap(const ty *P) {                        \
25
9
    return reinterpret_cast<ref>(const_cast<ty*>(P));   \
26
9
  }
llvm::wrap(llvm::MemoryBuffer const*)
Line
Count
Source
24
19
  inline ref wrap(const ty *P) {                        \
25
19
    return reinterpret_cast<ref>(const_cast<ty*>(P));   \
26
19
  }
llvm::wrap(llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter> const*)
Line
Count
Source
24
61
  inline ref wrap(const ty *P) {                        \
25
61
    return reinterpret_cast<ref>(const_cast<ty*>(P));   \
26
61
  }
27
28
#define DEFINE_ISA_CONVERSION_FUNCTIONS(ty, ref)        \
29
  DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)           \
30
                                                        \
31
  template<typename T>                                  \
32
9.61k
  inline T *unwrap(ref P) {                             \
33
9.61k
    return cast<T>(unwrap(P));                          \
34
9.61k
  }
llvm::GlobalObject* llvm::unwrap<llvm::GlobalObject>(LLVMOpaqueValue*)
Line
Count
Source
32
64
  inline T *unwrap(ref P) {                             \
33
64
    return cast<T>(unwrap(P));                          \
34
64
  }
llvm::Constant* llvm::unwrap<llvm::Constant>(LLVMOpaqueValue*)
Line
Count
Source
32
39
  inline T *unwrap(ref P) {                             \
33
39
    return cast<T>(unwrap(P));                          \
34
39
  }
llvm::DIType* llvm::unwrap<llvm::DIType>(LLVMOpaqueMetadata*)
Line
Count
Source
32
4
  inline T *unwrap(ref P) {                             \
33
4
    return cast<T>(unwrap(P));                          \
34
4
  }
llvm::DIExpression* llvm::unwrap<llvm::DIExpression>(LLVMOpaqueMetadata*)
Line
Count
Source
32
6
  inline T *unwrap(ref P) {                             \
33
6
    return cast<T>(unwrap(P));                          \
34
6
  }
llvm::Metadata* llvm::unwrap<llvm::Metadata>(LLVMOpaqueMetadata*)
Line
Count
Source
32
1
  inline T *unwrap(ref P) {                             \
33
1
    return cast<T>(unwrap(P));                          \
34
1
  }
llvm::DILocalVariable* llvm::unwrap<llvm::DILocalVariable>(LLVMOpaqueMetadata*)
Line
Count
Source
32
4
  inline T *unwrap(ref P) {                             \
33
4
    return cast<T>(unwrap(P));                          \
34
4
  }
llvm::DILocation* llvm::unwrap<llvm::DILocation>(LLVMOpaqueMetadata*)
Line
Count
Source
32
4
  inline T *unwrap(ref P) {                             \
33
4
    return cast<T>(unwrap(P));                          \
34
4
  }
llvm::Instruction* llvm::unwrap<llvm::Instruction>(LLVMOpaqueValue*)
Line
Count
Source
32
544
  inline T *unwrap(ref P) {                             \
33
544
    return cast<T>(unwrap(P));                          \
34
544
  }
llvm::DIScope* llvm::unwrap<llvm::DIScope>(LLVMOpaqueMetadata*)
Line
Count
Source
32
4
  inline T *unwrap(ref P) {                             \
33
4
    return cast<T>(unwrap(P));                          \
34
4
  }
llvm::DIFile* llvm::unwrap<llvm::DIFile>(LLVMOpaqueMetadata*)
Line
Count
Source
32
4
  inline T *unwrap(ref P) {                             \
33
4
    return cast<T>(unwrap(P));                          \
34
4
  }
llvm::Function* llvm::unwrap<llvm::Function>(LLVMOpaqueValue*)
Line
Count
Source
32
5.15k
  inline T *unwrap(ref P) {                             \
33
5.15k
    return cast<T>(unwrap(P));                          \
34
5.15k
  }
llvm::DISubprogram* llvm::unwrap<llvm::DISubprogram>(LLVMOpaqueMetadata*)
Line
Count
Source
32
1
  inline T *unwrap(ref P) {                             \
33
1
    return cast<T>(unwrap(P));                          \
34
1
  }
llvm::MDNode* llvm::unwrap<llvm::MDNode>(LLVMOpaqueMetadata*)
Line
Count
Source
32
43
  inline T *unwrap(ref P) {                             \
33
43
    return cast<T>(unwrap(P));                          \
34
43
  }
llvm::FunctionType* llvm::unwrap<llvm::FunctionType>(LLVMOpaqueType*)
Line
Count
Source
32
138
  inline T *unwrap(ref P) {                             \
33
138
    return cast<T>(unwrap(P));                          \
34
138
  }
llvm::IntegerType* llvm::unwrap<llvm::IntegerType>(LLVMOpaqueType*)
Line
Count
Source
32
243
  inline T *unwrap(ref P) {                             \
33
243
    return cast<T>(unwrap(P));                          \
34
243
  }
llvm::StructType* llvm::unwrap<llvm::StructType>(LLVMOpaqueType*)
Line
Count
Source
32
140
  inline T *unwrap(ref P) {                             \
33
140
    return cast<T>(unwrap(P));                          \
34
140
  }
llvm::Type* llvm::unwrap<llvm::Type>(LLVMOpaqueType*)
Line
Count
Source
32
145
  inline T *unwrap(ref P) {                             \
33
145
    return cast<T>(unwrap(P));                          \
34
145
  }
llvm::ArrayType* llvm::unwrap<llvm::ArrayType>(LLVMOpaqueType*)
Line
Count
Source
32
10
  inline T *unwrap(ref P) {                             \
33
10
    return cast<T>(unwrap(P));                          \
34
10
  }
llvm::PointerType* llvm::unwrap<llvm::PointerType>(LLVMOpaqueType*)
Line
Count
Source
32
90
  inline T *unwrap(ref P) {                             \
33
90
    return cast<T>(unwrap(P));                          \
34
90
  }
llvm::VectorType* llvm::unwrap<llvm::VectorType>(LLVMOpaqueType*)
Line
Count
Source
32
1
  inline T *unwrap(ref P) {                             \
33
1
    return cast<T>(unwrap(P));                          \
34
1
  }
llvm::MetadataAsValue* llvm::unwrap<llvm::MetadataAsValue>(LLVMOpaqueValue*)
Line
Count
Source
32
7
  inline T *unwrap(ref P) {                             \
33
7
    return cast<T>(unwrap(P));                          \
34
7
  }
Unexecuted instantiation: llvm::User* llvm::unwrap<llvm::User>(LLVMOpaqueValue*)
llvm::NamedMDNode* llvm::unwrap<llvm::NamedMDNode>(LLVMOpaqueNamedMDNode*)
Line
Count
Source
32
10
  inline T *unwrap(ref P) {                             \
33
10
    return cast<T>(unwrap(P));                          \
34
10
  }
llvm::ConstantInt* llvm::unwrap<llvm::ConstantInt>(LLVMOpaqueValue*)
Line
Count
Source
32
70
  inline T *unwrap(ref P) {                             \
33
70
    return cast<T>(unwrap(P));                          \
34
70
  }
Unexecuted instantiation: llvm::ConstantFP* llvm::unwrap<llvm::ConstantFP>(LLVMOpaqueValue*)
llvm::ConstantDataSequential* llvm::unwrap<llvm::ConstantDataSequential>(LLVMOpaqueValue*)
Line
Count
Source
32
31
  inline T *unwrap(ref P) {                             \
33
31
    return cast<T>(unwrap(P));                          \
34
31
  }
llvm::ConstantExpr* llvm::unwrap<llvm::ConstantExpr>(LLVMOpaqueValue*)
Line
Count
Source
32
4
  inline T *unwrap(ref P) {                             \
33
4
    return cast<T>(unwrap(P));                          \
34
4
  }
llvm::GlobalValue* llvm::unwrap<llvm::GlobalValue>(LLVMOpaqueValue*)
Line
Count
Source
32
196
  inline T *unwrap(ref P) {                             \
33
196
    return cast<T>(unwrap(P));                          \
34
196
  }
llvm::Value* llvm::unwrap<llvm::Value>(LLVMOpaqueValue*)
Line
Count
Source
32
61
  inline T *unwrap(ref P) {                             \
33
61
    return cast<T>(unwrap(P));                          \
34
61
  }
llvm::GlobalVariable* llvm::unwrap<llvm::GlobalVariable>(LLVMOpaqueValue*)
Line
Count
Source
32
227
  inline T *unwrap(ref P) {                             \
33
227
    return cast<T>(unwrap(P));                          \
34
227
  }
llvm::GlobalAlias* llvm::unwrap<llvm::GlobalAlias>(LLVMOpaqueValue*)
Line
Count
Source
32
29
  inline T *unwrap(ref P) {                             \
33
29
    return cast<T>(unwrap(P));                          \
34
29
  }
llvm::Argument* llvm::unwrap<llvm::Argument>(LLVMOpaqueValue*)
Line
Count
Source
32
66
  inline T *unwrap(ref P) {                             \
33
66
    return cast<T>(unwrap(P));                          \
34
66
  }
llvm::GlobalIFunc* llvm::unwrap<llvm::GlobalIFunc>(LLVMOpaqueValue*)
Line
Count
Source
32
4
  inline T *unwrap(ref P) {                             \
33
4
    return cast<T>(unwrap(P));                          \
34
4
  }
llvm::BasicBlock* llvm::unwrap<llvm::BasicBlock>(LLVMOpaqueValue*)
Line
Count
Source
32
78
  inline T *unwrap(ref P) {                             \
33
78
    return cast<T>(unwrap(P));                          \
34
78
  }
llvm::CallBase* llvm::unwrap<llvm::CallBase>(LLVMOpaqueValue*)
Line
Count
Source
32
2.06k
  inline T *unwrap(ref P) {                             \
33
2.06k
    return cast<T>(unwrap(P));                          \
34
2.06k
  }
llvm::CallInst* llvm::unwrap<llvm::CallInst>(LLVMOpaqueValue*)
Line
Count
Source
32
18
  inline T *unwrap(ref P) {                             \
33
18
    return cast<T>(unwrap(P));                          \
34
18
  }
llvm::InvokeInst* llvm::unwrap<llvm::InvokeInst>(LLVMOpaqueValue*)
Line
Count
Source
32
12
  inline T *unwrap(ref P) {                             \
33
12
    return cast<T>(unwrap(P));                          \
34
12
  }
llvm::BranchInst* llvm::unwrap<llvm::BranchInst>(LLVMOpaqueValue*)
Line
Count
Source
32
31
  inline T *unwrap(ref P) {                             \
33
31
    return cast<T>(unwrap(P));                          \
34
31
  }
Unexecuted instantiation: llvm::SwitchInst* llvm::unwrap<llvm::SwitchInst>(LLVMOpaqueValue*)
llvm::AllocaInst* llvm::unwrap<llvm::AllocaInst>(LLVMOpaqueValue*)
Line
Count
Source
32
17
  inline T *unwrap(ref P) {                             \
33
17
    return cast<T>(unwrap(P));                          \
34
17
  }
llvm::GetElementPtrInst* llvm::unwrap<llvm::GetElementPtrInst>(LLVMOpaqueValue*)
Line
Count
Source
32
4
  inline T *unwrap(ref P) {                             \
33
4
    return cast<T>(unwrap(P));                          \
34
4
  }
llvm::PHINode* llvm::unwrap<llvm::PHINode>(LLVMOpaqueValue*)
Line
Count
Source
32
20
  inline T *unwrap(ref P) {                             \
33
20
    return cast<T>(unwrap(P));                          \
34
20
  }
llvm::CatchPadInst* llvm::unwrap<llvm::CatchPadInst>(LLVMOpaqueValue*)
Line
Count
Source
32
4
  inline T *unwrap(ref P) {                             \
33
4
    return cast<T>(unwrap(P));                          \
34
4
  }
llvm::CleanupPadInst* llvm::unwrap<llvm::CleanupPadInst>(LLVMOpaqueValue*)
Line
Count
Source
32
2
  inline T *unwrap(ref P) {                             \
33
2
    return cast<T>(unwrap(P));                          \
34
2
  }
Unexecuted instantiation: llvm::IndirectBrInst* llvm::unwrap<llvm::IndirectBrInst>(LLVMOpaqueValue*)
llvm::LandingPadInst* llvm::unwrap<llvm::LandingPadInst>(LLVMOpaqueValue*)
Line
Count
Source
32
9
  inline T *unwrap(ref P) {                             \
33
9
    return cast<T>(unwrap(P));                          \
34
9
  }
llvm::CatchSwitchInst* llvm::unwrap<llvm::CatchSwitchInst>(LLVMOpaqueValue*)
Line
Count
Source
32
7
  inline T *unwrap(ref P) {                             \
33
7
    return cast<T>(unwrap(P));                          \
34
7
  }
Unexecuted instantiation: llvm::FuncletPadInst* llvm::unwrap<llvm::FuncletPadInst>(LLVMOpaqueValue*)
35
36
#define DEFINE_STDCXX_CONVERSION_FUNCTIONS(ty, ref)     \
37
  DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)           \
38
                                                        \
39
  template<typename T>                                  \
40
13
  inline T *unwrap(ref P) {                             \
41
13
    T *Q = (T*)unwrap(P);                               \
42
13
    assert(Q && "Invalid cast!");                       \
43
13
    return Q;                                           \
44
13
  }
llvm::legacy::FunctionPassManager* llvm::unwrap<llvm::legacy::FunctionPassManager>(LLVMOpaquePassManager*)
Line
Count
Source
40
5
  inline T *unwrap(ref P) {                             \
41
5
    T *Q = (T*)unwrap(P);                               \
42
5
    assert(Q && "Invalid cast!");                       \
43
5
    return Q;                                           \
44
5
  }
llvm::legacy::PassManager* llvm::unwrap<llvm::legacy::PassManager>(LLVMOpaquePassManager*)
Line
Count
Source
40
8
  inline T *unwrap(ref P) {                             \
41
8
    T *Q = (T*)unwrap(P);                               \
42
8
    assert(Q && "Invalid cast!");                       \
43
8
    return Q;                                           \
44
8
  }
45
46
#endif