[compiler-rt] r191807 - Make the InvalidValueData take a SourceLocation.

Nick Lewycky nicholas at mxc.ca
Tue Oct 1 19:29:47 PDT 2013


Author: nicholas
Date: Tue Oct  1 21:29:47 2013
New Revision: 191807

URL: http://llvm.org/viewvc/llvm-project?rev=191807&view=rev
Log:
Make the InvalidValueData take a SourceLocation.

Modified:
    compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc
    compiler-rt/trunk/lib/ubsan/ubsan_handlers.h

Modified: compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc?rev=191807&r1=191806&r2=191807&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc (original)
+++ compiler-rt/trunk/lib/ubsan/ubsan_handlers.cc Tue Oct  1 21:29:47 2013
@@ -246,15 +246,16 @@ void __ubsan::__ubsan_handle_float_cast_
 
 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();
 }

Modified: compiler-rt/trunk/lib/ubsan/ubsan_handlers.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_handlers.h?rev=191807&r1=191806&r2=191807&view=diff
==============================================================================
--- compiler-rt/trunk/lib/ubsan/ubsan_handlers.h (original)
+++ compiler-rt/trunk/lib/ubsan/ubsan_handlers.h Tue Oct  1 21:29:47 2013
@@ -105,7 +105,7 @@ struct FloatCastOverflowData {
 RECOVERABLE(float_cast_overflow, FloatCastOverflowData *Data, ValueHandle From)
 
 struct InvalidValueData {
-  // FIXME: SourceLocation Loc;
+  SourceLocation Loc;
   const TypeDescriptor &Type;
 };
 





More information about the llvm-commits mailing list