From 1c338cbe701cacb8136b58b0a62766b8ffe51fb5 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Sat, 29 Jul 2017 00:20:02 +0000 Subject: [ubsan] Diagnose invalid uses of builtins (compiler-rt) Differential Revision: https://reviews.llvm.org/D34591 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@309461 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ubsan/ubsan_handlers.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/ubsan/ubsan_handlers.h') diff --git a/lib/ubsan/ubsan_handlers.h b/lib/ubsan/ubsan_handlers.h index 796321b81..5a9e902ce 100644 --- a/lib/ubsan/ubsan_handlers.h +++ b/lib/ubsan/ubsan_handlers.h @@ -122,6 +122,21 @@ struct InvalidValueData { /// \brief Handle a load of an invalid value for the type. RECOVERABLE(load_invalid_value, InvalidValueData *Data, ValueHandle Val) +/// Known builtin check kinds. +/// Keep in sync with the enum of the same name in CodeGenFunction.h +enum BuiltinCheckKind : unsigned char { + BCK_CTZPassedZero, + BCK_CLZPassedZero, +}; + +struct InvalidBuiltinData { + SourceLocation Loc; + unsigned char Kind; +}; + +/// Handle a builtin called in an invalid way. +RECOVERABLE(invalid_builtin, InvalidBuiltinData *Data) + struct FunctionTypeMismatchData { SourceLocation Loc; const TypeDescriptor &Type; -- cgit v1.2.3