clang 8.0.0

Macros | Functions
CodeGenFunction.cpp File Reference
`#include "CodeGenFunction.h"`
`#include "CGBlocks.h"`
`#include "CGCleanup.h"`
`#include "CGCUDARuntime.h"`
`#include "CGCXXABI.h"`
`#include "CGDebugInfo.h"`
`#include "CGOpenMPRuntime.h"`
`#include "CodeGenModule.h"`
`#include "CodeGenPGO.h"`
`#include "TargetInfo.h"`
`#include "clang/AST/ASTContext.h"`
`#include "clang/AST/ASTLambda.h"`
`#include "clang/AST/Decl.h"`
`#include "clang/AST/DeclCXX.h"`
`#include "clang/AST/StmtCXX.h"`
`#include "clang/AST/StmtObjC.h"`
`#include "clang/Basic/Builtins.h"`
`#include "clang/Basic/CodeGenOptions.h"`
`#include "clang/Basic/TargetInfo.h"`
`#include "clang/CodeGen/CGFunctionInfo.h"`
`#include "clang/Frontend/FrontendDiagnostic.h"`
`#include "llvm/IR/DataLayout.h"`
`#include "llvm/IR/Dominators.h"`
`#include "llvm/IR/Intrinsics.h"`
`#include "llvm/IR/MDBuilder.h"`
`#include "llvm/IR/Operator.h"`
`#include "llvm/Transforms/Utils/PromoteMemToReg.h"`
`#include "clang/AST/TypeNodes.def"`
`#include "clang/Basic/Sanitizers.def"`
Include dependency graph for CodeGenFunction.cpp:

Go to the source code of this file.

## Macros
#define | TYPE(name, parent)
#define | ABSTRACT_TYPE(name, parent)
#define | NON_CANONICAL_TYPE(name, parent) case Type::name:
#define | DEPENDENT_TYPE(name, parent) case Type::name:
#define | NON_CANONICAL_UNLESS_DEPENDENT_TYPE(name, parent) case Type::name:
#define | SANITIZER(NAME, ID)
#define | TYPE(Class, Base)
#define | ABSTRACT_TYPE(Class, Base)
#define | NON_CANONICAL_TYPE(Class, Base)
#define | DEPENDENT_TYPE(Class, Base) case Type::Class:
#define | NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base)

## Functions
static bool | shouldEmitLifetimeMarkers (const CodeGenOptions &CGOpts, const LangOptions &LangOpts)
| shouldEmitLifetimeMarkers - Decide whether we need emit the life-time markers. More...
static void | EmitIfUsed (CodeGenFunction &CGF, llvm::BasicBlock *BB)
static void | removeImageAccessQualifier (std::string &TyName)
static unsigned | ArgInfoAddressSpace (LangAS AS)
static void | GenOpenCLArgMetadata (const FunctionDecl *FD, llvm::Function *Fn, CodeGenModule &CGM, llvm::LLVMContext &Context, CGBuilderTy &Builder, ASTContext &ASTCtx)
static bool | endsWithReturn (const Decl *F)
| Determine whether the function F ends with a return stmt. More...
static bool | matchesStlAllocatorFn (const Decl *D, const ASTContext &Ctx)
static llvm::Constant * | getPrologueSignature (CodeGenModule &CGM, const FunctionDecl *FD)
| Return the UBSan prologue signature for `FD` if one is available. More...
static void | TryMarkNoThrow (llvm::Function *F)
| Tries to mark the given function nounwind based on the non-existence of any throwing calls within it. More...
static bool | shouldUseUndefinedBehaviorReturnOptimization (const FunctionDecl *FD, const ASTContext &Context)
static void | emitNonZeroVLAInit (CodeGenFunction &CGF, QualType baseType, Address dest, Address src, llvm::Value *sizeInChars)
| emitNonZeroVLAInit - Emit the "zero" initialization of a variable-length array whose elements have a non-zero bit-pattern. More...
static bool | hasRequiredFeatures (const SmallVectorImpl< StringRef > &ReqFeatures, CodeGenModule &CGM, const FunctionDecl *FD, std::string &FirstMissing)
static void | CreateMultiVersionResolverReturn (CodeGenModule &CGM, llvm::Function *Resolver, CGBuilderTy &Builder, llvm::Function *FuncToReturn, bool SupportsIFunc)

## Macro Definition Documentation

## ◆ ABSTRACT_TYPE [1/2]

#define ABSTRACT_TYPE | ( |  | name,
|  |  | parent
| ) |  |

## ◆ ABSTRACT_TYPE [2/2]

#define ABSTRACT_TYPE | ( |  | Class,
|  |  | Base
| ) |  |

## ◆ DEPENDENT_TYPE [1/2]

#define DEPENDENT_TYPE | ( |  | name,
|  |  | parent
| ) |  | case Type::name:

## ◆ DEPENDENT_TYPE [2/2]

#define DEPENDENT_TYPE | ( |  | Class,
|  |  | Base
| ) |  | case Type::Class:

## ◆ NON_CANONICAL_TYPE [1/2]

#define NON_CANONICAL_TYPE | ( |  | name,
|  |  | parent
| ) |  | case Type::name:

## ◆ NON_CANONICAL_TYPE [2/2]

#define NON_CANONICAL_TYPE | ( |  | Class,
|  |  | Base
| ) |  |

## ◆ NON_CANONICAL_UNLESS_DEPENDENT_TYPE [1/2]

#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE | ( |  | name,
|  |  | parent
| ) |  | case Type::name:

## ◆ NON_CANONICAL_UNLESS_DEPENDENT_TYPE [2/2]

#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE | ( |  | Class,
|  |  | Base
| ) |  |

## ◆ SANITIZER

#define SANITIZER | ( |  | NAME,
|  |  | ID
| ) |  |

Value:
if (SanOpts.empty()) \
break; \
if (SanOpts.has(SanitizerKind::ID)) \
if (CGM.isInSanitizerBlacklist(SanitizerKind::ID, Fn, Loc)) \
SanOpts.set(SanitizerKind::ID, false);
clang::Builtin::ID
ID
Definition: Builtins.h:49

## ◆ TYPE [1/2]

#define TYPE | ( |  | name,
|  |  | parent
| ) |  |

## ◆ TYPE [2/2]

#define TYPE | ( |  | Class,
|  |  | Base
| ) |  |

## Function Documentation

## ◆ ArgInfoAddressSpace()

static unsigned ArgInfoAddressSpace | ( | LangAS | AS | ) |
| static

Definition at line 551 of file CodeGenFunction.cpp.

References clang::opencl_constant, clang::opencl_generic, clang::opencl_global, and clang::opencl_local.

## ◆ CreateMultiVersionResolverReturn()

static void CreateMultiVersionResolverReturn | ( | CodeGenModule & | CGM,
|  | llvm::Function * | Resolver,
|  | CGBuilderTy & | Builder,
|  | llvm::Function * | FuncToReturn,
|  | bool | SupportsIFunc
| ) |  |
| static

Definition at line 2437 of file CodeGenFunction.cpp.

## ◆ EmitIfUsed()

static void EmitIfUsed | ( | CodeGenFunction & | CGF,
|  | llvm::BasicBlock * | BB
| ) |  |
| static

Definition at line 290 of file CodeGenFunction.cpp.

References clang::CodeGen::CodeGenFunction::CurFn.

Referenced by clang::CodeGen::CodeGenFunction::FinishFunction().

## ◆ emitNonZeroVLAInit()

static void emitNonZeroVLAInit | ( | CodeGenFunction & | CGF,
|  | QualType | baseType,
|  | Address | dest,
|  | Address | src,
|  | llvm::Value * | sizeInChars
| ) |  |
| static

emitNonZeroVLAInit - Emit the "zero" initialization of a variable-length array whose elements have a non-zero bit-pattern.

Parameters

  baseType | the inner-most element type of the array
  src | - a char* pointing to the bit-pattern for a single base element of the array
  sizeInChars | - the total size of the VLA, in chars

Definition at line 1740 of file CodeGenFunction.cpp.

References clang::CharUnits::alignmentOfArrayElement(), clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CGBuilderTy::CreateElementBitCast(), clang::CodeGen::CGBuilderTy::CreateMemCpy(), clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::Address::getAlignment(), clang::CodeGen::CodeGenFunction::getContext(), clang::CharUnits::getQuantity(), clang::ASTContext::getTypeSizeInChars(), clang::CodeGen::CodeGenTypeCache::Int8Ty, and clang::CodeGen::CodeGenTypeCache::IntPtrTy.

Referenced by clang::CodeGen::CodeGenFunction::EmitNullInitialization().

## ◆ endsWithReturn()

static bool endsWithReturn | ( | const Decl * | F | ) |
| static

Determine whether the function F ends with a return stmt.

Definition at line 775 of file CodeGenFunction.cpp.

References clang::FunctionDecl::getBody().

Referenced by clang::CodeGen::CodeGenFunction::StartFunction().

## ◆ GenOpenCLArgMetadata()

static void GenOpenCLArgMetadata | ( | const FunctionDecl * | FD,
|  | llvm::Function * | Fn,
|  | CodeGenModule & | CGM,
|  | llvm::LLVMContext & | Context,
|  | CGBuilderTy & | Builder,
|  | ASTContext & | ASTCtx
| ) |  |
| static

Definition at line 565 of file CodeGenFunction.cpp.

## ◆ getPrologueSignature()

static llvm::Constant* getPrologueSignature | ( | CodeGenModule & | CGM,
|  | const FunctionDecl * | FD
| ) |  |
| static

Return the UBSan prologue signature for `FD` if one is available.

Definition at line 818 of file CodeGenFunction.cpp.

References clang::CodeGen::CodeGenModule::getTargetCodeGenInfo(), and clang::CodeGen::TargetCodeGenInfo::getUBSanFunctionSignature().

Referenced by clang::CodeGen::CodeGenFunction::StartFunction().

## ◆ hasRequiredFeatures()

static bool hasRequiredFeatures | ( | const SmallVectorImpl< StringRef > & | ReqFeatures,
|  | CodeGenModule & | CGM,
|  | const FunctionDecl * | FD,
|  | std::string & | FirstMissing
| ) |  |
| static

Definition at line 2326 of file CodeGenFunction.cpp.

References clang::CodeGen::CodeGenModule::getFunctionFeatureMap().

Referenced by clang::CodeGen::CodeGenFunction::checkTargetFeatures().

## ◆ matchesStlAllocatorFn()

static bool matchesStlAllocatorFn | ( | const Decl * | D,
|  | const ASTContext & | Ctx
| ) |  |
| static

Definition at line 797 of file CodeGenFunction.cpp.

References clang::ASTContext::getSizeType().

Referenced by clang::CodeGen::CodeGenFunction::StartFunction().

## ◆ removeImageAccessQualifier()

static void removeImageAccessQualifier | ( | std::string & | TyName | ) |
| static

Definition at line 525 of file CodeGenFunction.cpp.

## ◆ shouldEmitLifetimeMarkers()

static bool shouldEmitLifetimeMarkers | ( | const CodeGenOptions & | CGOpts,
|  | const LangOptions & | LangOpts
| ) |  |
| static

shouldEmitLifetimeMarkers - Decide whether we need emit the life-time markers.

Definition at line 46 of file CodeGenFunction.cpp.

References clang::SanitizerSet::has(), and clang::LangOptions::Sanitize.

## ◆ shouldUseUndefinedBehaviorReturnOptimization()

static bool shouldUseUndefinedBehaviorReturnOptimization | ( | const FunctionDecl * | FD,
|  | const ASTContext & | Context
| ) |  |
| static

Definition at line 1295 of file CodeGenFunction.cpp.

Referenced by clang::CodeGen::CodeGenFunction::GenerateCode().

## ◆ TryMarkNoThrow()

static void TryMarkNoThrow | ( | llvm::Function * | F | ) |
| static

Tries to mark the given function nounwind based on the non-existence of any throwing calls within it.

We believe this is lightweight enough to do at -O0.

Definition at line 1238 of file CodeGenFunction.cpp.

Referenced by clang::CodeGen::CodeGenFunction::GenerateCode().