aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-02-27 19:46:19 +0000
committerVedant Kumar <vsk@apple.com>2017-02-27 19:46:19 +0000
commit5a9726535156adb72f0aeaeccaaca8229b7d26cd (patch)
tree28f170f8abc11e9f3a375f13ecaf0cebf8a2451c /clang/lib/CodeGen/CodeGenFunction.h
parentaaf519136482705d483b702b699990643fbbf764 (diff)
downloadllvm-5a9726535156adb72f0aeaeccaaca8229b7d26cd.zip
llvm-5a9726535156adb72f0aeaeccaaca8229b7d26cd.tar.gz
llvm-5a9726535156adb72f0aeaeccaaca8229b7d26cd.tar.bz2
[ubsan] Factor out logic to emit a range check. NFC.
This is a readability improvement, but it will also help prep an upcoming patch to detect UB loads from bitfields. llvm-svn: 296374
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index e011c11..25174a1 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -2866,6 +2866,13 @@ public:
/// representation to its value representation.
llvm::Value *EmitFromMemory(llvm::Value *Value, QualType Ty);
+ /// Check if the scalar \p Value is within the valid range for the given
+ /// type \p Ty.
+ ///
+ /// Returns true if a check is needed (even if the range is unknown).
+ bool EmitScalarRangeCheck(llvm::Value *Value, QualType Ty,
+ SourceLocation Loc);
+
/// EmitLoadOfScalar - Load a scalar value from an address, taking
/// care to appropriately convert from the memory representation to
/// the LLVM value representation.