diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-09-08 02:08:36 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-09-08 02:08:36 +0000 |
commit | 7ac9ef1c82c779a5348ed11b3d10e01c58803b35 (patch) | |
tree | 75bafb315db7d2fb2f554e867ea52fb01cb7ae4f /lib/CodeGen/CodeGenFunction.h | |
parent | 82f2ad456a82da1b9cb7ddfc994c8f5fa44b59e6 (diff) |
-fcatch-undefined-behavior: Factor emission of the creation of, and branch to,
the trap BB out of the individual checks and into a common function, to prepare
for making this code call into a runtime library. Rename the existing EmitCheck
to EmitTypeCheck to clarify it and to move it out of the way of the new
EmitCheck.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163451 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.h | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index 0e4e5e63c4..c9c4a6dbe4 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -1835,27 +1835,27 @@ public: /// \brief Situations in which we might emit a check for the suitability of a /// pointer or glvalue. - enum CheckType { + enum TypeCheckKind { /// Checking the operand of a load. Must be suitably sized and aligned. - CT_Load, + TCK_Load, /// Checking the destination of a store. Must be suitably sized and aligned. - CT_Store, + TCK_Store, /// Checking the bound value in a reference binding. Must be suitably sized /// and aligned, but is not required to refer to an object (until the /// reference is used), per core issue 453. - CT_ReferenceBinding, + TCK_ReferenceBinding, /// Checking the object expression in a non-static data member access. Must /// be an object within its lifetime. - CT_MemberAccess, + TCK_MemberAccess, /// Checking the 'this' pointer for a call to a non-static member function. /// Must be an object within its lifetime. - CT_MemberCall + TCK_MemberCall }; - /// EmitCheck - Emit a check that \p V is the address of storage of the + /// \brief Emit a check that \p V is the address of storage of the /// appropriate size and alignment for an object of type \p Type. - void EmitCheck(CheckType CT, llvm::Value *V, - QualType Type, CharUnits Alignment = CharUnits::Zero()); + void EmitTypeCheck(TypeCheckKind TCK, llvm::Value *V, + QualType Type, CharUnits Alignment = CharUnits::Zero()); llvm::Value *EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV, bool isInc, bool isPre); @@ -2053,11 +2053,10 @@ public: /// LValue EmitLValue(const Expr *E); - /// EmitCheckedLValue - Same as EmitLValue but additionally we generate - /// checking code to guard against undefined behavior. This is only - /// suitable when we know that the address will be used to access the - /// object. - LValue EmitCheckedLValue(const Expr *E, CheckType CT); + /// \brief Same as EmitLValue but additionally we generate checking code to + /// guard against undefined behavior. This is only suitable when we know + /// that the address will be used to access the object. + LValue EmitCheckedLValue(const Expr *E, TypeCheckKind TCK); /// EmitToMemory - Change a scalar value from its value /// representation to its in-memory representation. @@ -2536,9 +2535,9 @@ public: void EmitBranchOnBoolExpr(const Expr *Cond, llvm::BasicBlock *TrueBlock, llvm::BasicBlock *FalseBlock); - /// getTrapBB - Create a basic block that will call the trap intrinsic. We'll - /// generate a branch around the created basic block as necessary. - llvm::BasicBlock *getTrapBB(); + /// \brief Create a basic block that will call the trap intrinsic, and emit a + /// conditional branch to it. + void EmitCheck(llvm::Value *Checked); /// EmitCallArg - Emit a single call argument. void EmitCallArg(CallArgList &args, const Expr *E, QualType ArgType); |