float_cast_overflow is the only UBSan check without a source location attached.
This patch propagates SourceLocations where necessary to get them to the
EmitCheck() call.
Details
Diff Detail
Event Timeline
Thank you for working on this! This change looks good to me, but I'll let Richard say a final word.
Note that you would need to make a corresponding change in UBSan compiler-rt runtime. Also, this is an ABI-breaking change - e.g. shared objects built with older Clang will not work properly with new runtime. I would recommend you to add *some* diagnostic to ubsan runtime - e.g. if it tries to read SourceLocation from FloatCastOverflowData passed to handler, but it looks more like TypeDescriptor, than it would crash with a verbose message.
I finished this late last night, so I figured I'd upload the bigger patch and start getting comments. :-)
Also, this is an ABI-breaking change - e.g. shared objects built with older Clang will not work properly with new runtime. I would recommend you to add *some* diagnostic to ubsan runtime - e.g. if it tries to read SourceLocation from FloatCastOverflowData passed to handler, but it looks more like TypeDescriptor, than it would crash with a verbose message.
I've made the simple UBSan patch and am only missing changing tests (on my machine we do get file names and lines for those source locations, from debug info, but I'll figure out a way to differentiate those).
I'll add a small check for v1/v2 of FloatCastOverflowData.
I will only commit after both patches are accepted, too.
Looks good to me too (though please hold off on this until you and samsonov have agreed on what to do about the ubsan ABI change).
lib/CodeGen/CGOpenMPRuntime.cpp | ||
---|---|---|
1288 | Please reorder the parameters to put the source location before the body, so that the expected lambda parameter is last (see http://llvm.org/docs/CodingStandards.html#format-lambdas-like-blocks-of-code). |
Rebasing off of current trunk.
compiler-rt patch posted at http://reviews.llvm.org/D11793
Please reorder the parameters to put the source location before the body, so that the expected lambda parameter is last (see http://llvm.org/docs/CodingStandards.html#format-lambdas-like-blocks-of-code).