summaryrefslogtreecommitdiff
path: root/lib/ubsan
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2013-10-02 02:29:47 +0000
committerNick Lewycky <nicholas@mxc.ca>2013-10-02 02:29:47 +0000
commitd1bf52ecb1211af7fa3fe5f5b05d08033eb1a90c (patch)
tree5043c10ba218fc82f3a22605ca5e26cd70e56363 /lib/ubsan
parentc349466646968133e0bad48d24e267580bad6c07 (diff)
Make the InvalidValueData take a SourceLocation.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@191807 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ubsan')
-rw-r--r--lib/ubsan/ubsan_handlers.cc11
-rw-r--r--lib/ubsan/ubsan_handlers.h2
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/ubsan/ubsan_handlers.cc b/lib/ubsan/ubsan_handlers.cc
index fa93b095d..5ed0d5923 100644
--- a/lib/ubsan/ubsan_handlers.cc
+++ b/lib/ubsan/ubsan_handlers.cc
@@ -246,15 +246,16 @@ void __ubsan::__ubsan_handle_float_cast_overflow_abort(
void __ubsan::__ubsan_handle_load_invalid_value(InvalidValueData *Data,
ValueHandle Val) {
- // TODO: Add deduplication once a SourceLocation is generated for this check.
- Diag(getCallerLocation(), DL_Error,
+ SourceLocation Loc = Data->Loc.acquire();
+ if (Loc.isDisabled())
+ return;
+
+ Diag(Loc, DL_Error,
"load of value %0, which is not a valid value for type %1")
<< Value(Data->Type, Val) << Data->Type;
}
void __ubsan::__ubsan_handle_load_invalid_value_abort(InvalidValueData *Data,
ValueHandle Val) {
- Diag(getCallerLocation(), DL_Error,
- "load of value %0, which is not a valid value for type %1")
- << Value(Data->Type, Val) << Data->Type;
+ __ubsan_handle_load_invalid_value(Data, Val);
Die();
}
diff --git a/lib/ubsan/ubsan_handlers.h b/lib/ubsan/ubsan_handlers.h
index 5e237e1aa..9406207fa 100644
--- a/lib/ubsan/ubsan_handlers.h
+++ b/lib/ubsan/ubsan_handlers.h
@@ -105,7 +105,7 @@ struct FloatCastOverflowData {
RECOVERABLE(float_cast_overflow, FloatCastOverflowData *Data, ValueHandle From)
struct InvalidValueData {
- // FIXME: SourceLocation Loc;
+ SourceLocation Loc;
const TypeDescriptor &Type;
};