LSC: Allow targets to pass with -fsanitize=null under --config=asan.

This is a manually-generated change. Ensure that behavior and style are
preserved by carefully inspecting the diff.

This CL fixes one of the many targets in TAP that test with ASan but fail
with `-fsanitize=null`. We would like to enable the Null Pointer Sanitizer
in builds that use Address Sanitizer globally, and this change gets us one
step closer to that goal.

PiperOrigin-RevId: 306704264
Change-Id: I15fc65a7e3c7b3ed81e5b72038b070c6b847ff3f
This commit is contained in:
A. Unique TensorFlower 2020-04-15 13:04:37 -07:00 committed by TensorFlower Gardener
parent dffe477012
commit 97e4f0d394

View File

@ -1505,9 +1505,17 @@ const FunctionDef* FunctionLibraryDefinition::GetAttrImpl(
// function's attrs to see if noinline is specified. Otherwise,
// uses func's attrs.
if (!grad_name.empty()) {
return &(FindHelper(grad_name)->fdef);
if (const auto helper = FindHelper(grad_name)) {
return &(helper->fdef);
} else {
return nullptr;
}
}
if (const auto helper = FindHelper(func_name)) {
return &(helper->fdef);
} else {
return nullptr;
}
return &(FindHelper(func_name)->fdef);
}
}